Arduino VIC resonator

firepinto

Re: Arduino VIC resonator
« Reply #100, on January 16th, 2015, 07:38 PM »
Quote from abadiya on January 16th, 2015, 06:34 PM
Can any one post DDS ver. 0.3.7 alpha CODE?
Thank you.
What is DDS?

abadiya

Re: Arduino VIC resonator
« Reply #101, on January 16th, 2015, 09:40 PM »
Chip known as the AD9850 which is a Direct Digital Synthesis 0-40 Mhz sine wave generator.
Re: Arduino VIC resonator
« Reply #102, on January 16th, 2015, 11:44 PM »Last edited on January 17th, 2015, 07:35 AM
There is modified code to accommodate 128x64 OLED Display :
Code: [Select]
/*
   VIC Resonator written by Zissis aka zchiotis on open-source-energy.org forum.
   Downloaded from open-source-energy.org/?topic=1097.0
   Version 0.2.10 beta changes made by firepinto
   Version 0.2.11 alpha changes made by firepinto 10/30/14
*/
#include <TimerOne.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_MOSI   6
#define OLED_CLK   7
#define OLED_DC    11
#define OLED_CS    0
#define OLED_RESET 5
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2

#define LOGO16_Gdisplay_HEIGHT 16
#define LOGO16_Gdisplay_WIDTH  16

#define TIMECTL_MAXTICKS 4294967295
#define TIMECTL_INIT 0

#define  PICKUP A0                             //pickup coil is connected to pin A0 via voltage divider and a zener diode
#define  TONEOUT 9                             //Output to the VIC primary coil
#define  GATEOUT 10                            //Output pin for Gate signal
#define  GATEDUTY A2                           //potentiometer connected to A2 to set gating pulse duty
#define  BTN 8                                 //button for scan order is connected to pin D8
#define  GATESET A1                            //potentiometer connected to A1 pin to set gating frequency
#define  LOCKLED 12                            //LED - indicator when the frequency is locked, pin D1  *Changed from D1 to D12 just to be next to the new scan LED pin - firepinto 10/25/14
#define  SCANLED 8                            //LED - indicator when scanning, pin D0                *Changed from D0 to D11 because of serial uploading issues from the IDE - firepinto 10/25/14
#define  PEAKLED 13                            //LED - indicates when pickup coil input A0 is at or near 5 volts. *Added by firepinto 10/26/14
#define  FRANGE  A3                            //potentiometer connected to A3 to set the scale for manual frequency adjust buttons
#define  FREQPLUS  18                          //Push Button for adjusting frequency higher
#define  FREQMINUS  19                         //Push Button for adjusting frequency lower
// #define  GATELED 13                         //LED - Gating indicator                               

int hz = 1000;                               
int freq = 0;                                  //Variable for Locked frequency
int freqplus = 0;                              //Low end of freqency fine tune scale - firepinto 10/27/14
int freqminus = 0;                             //High end of freqency fine tune scale - firepinto 10/27/14
int freqrange = 0;                             //Variable for FRANGE POT
int scale = 0;                                 //Scale variable in Hz for manual frequency adjust buttons
int adjfreq = freq;                            //Resulting frequency from auto scan and fine tune - firepinto 10/27/14
int volt = 0;
int vmax = 0;
int intval = 0;
int gateread = 0;
int gatef = 1;
int duty = 512;
int dutyP = 0;
int freqmstate = 0;                            //Variable for minus button manual frequency adjustment
int freqpstate = 0;                            //Variable for plus button manual frequency adjustment
int lastmstate = 0;                            //last state for minus button
int lastpstate = 0;                            //last state for plus button

unsigned long it = 0;
unsigned long itdisplay = 0;
unsigned long refdisplay = 350;                    // display refresh rate mS
int odd = false;


void setup()
{
  Serial.begin(9600);
 
  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC);
  // init done
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println("   VIC RESONATOR");
  display.display();
  delay(2000);
 // Serial.begin(9600);
  pinMode(TONEOUT, OUTPUT);
  pinMode(GATEOUT, OUTPUT);
  pinMode(GATEDUTY, INPUT); 
  pinMode(PICKUP, INPUT);                     //initializing the pins
  pinMode(BTN, INPUT);
  pinMode(GATESET, INPUT);
  pinMode(FRANGE, INPUT);                     //firepinto - 10/27/14
  pinMode(LOCKLED, OUTPUT);                   //firepinto - 10/27/14
  pinMode(SCANLED, OUTPUT);                   //firepinto - 10/27/14
  pinMode(PEAKLED, OUTPUT);                   //firepinto - 10/27/14
  pinMode(FREQPLUS, INPUT);                   //firepinto - 10/27/14
  pinMode(FREQMINUS, INPUT);                  //firepinto - 10/27/14

//  pinMode(GATELED, OUTPUT);                 //unused as of ver. 0.2.10a
  Timer1.initialize(1000000);
}

void loop()
{
vmax = 0;                                     //comment if you want to keep the best frequency of all scans
intval = 0;                                   //comment if you want to see the frequency found interval in all scans
noTone(TONEOUT);                              // used to have LOCKLED pin
digitalWrite(LOCKLED, LOW);
Timer1.stop();
digitalWrite(GATEOUT, LOW);
//digitalWrite(GATELED, LOW);                 //unused as of ver. 0.2.10a
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.clearDisplay();
  display.println("SCANNING...");
  digitalWrite(SCANLED, HIGH);
  display.setCursor(70,8);
  display.println("Hz");
  display.display();
for (hz=1000; hz<=32000; hz=hz+10)             //start from 1khz to 32khz to oscillate the circuit
{
  tone(TONEOUT,hz);                           //will send a tone at first
  delay(1);                                   //wait for a millisec
  volt = analogRead(PICKUP);                  //then read the voltage
  if (volt > 818)                             //If pick-up coil voltage is greater than 4 volts
    {
    digitalWrite(PEAKLED, HIGH);              //turn on peak LED
    }
     else
    {
    digitalWrite(PEAKLED, LOW);               //turn off peak LED
    }
  if (vmax < volt)                            //if there is a resonant point voltage should have the highest value on this frequency
  {
    vmax = volt;                              //store as the best voltage
    freq = hz;                                //remember that frequency
    intval = intval++;                        //times found a nice frequency interval, is showing during scan on the left of the display
  display.clearDisplay();
  display.setCursor(0,12);
  display.println("SCANNING >");
  display.setCursor(66,12);
  display.println(intval);
  display.setCursor(106,12);
  display.println("Hz");
  display.display();
  }
  display.clearDisplay();
  display.setCursor(0,12);
  display.println("SCANNING >");
  display.setCursor(66,12);
  display.println(hz);
  display.setCursor(106,12);
  display.println("Hz");
  display.display();
  }
  for (hz=32000; hz>=1000; hz=hz-10)           //do the same for a descent scan
  {
    tone(TONEOUT,hz);   
    delay(1);
    volt = analogRead(PICKUP);
    if (volt > 818)                           // *Added by firepinto 10/26/14
    {
    digitalWrite(PEAKLED, HIGH);
    }
     else
    {
    digitalWrite(PEAKLED, LOW);
    }
    if (vmax < volt)
    {
      vmax = volt;
      freq = hz;
      adjfreq = freq;
      intval = intval++  ;
 //     display.clearDisplay();
      display.setCursor(0,0);
      display.println(intval);
      display.display();
    }
    if (hz < 10000)
    {
 //     display.clearDisplay();
      display.setCursor(0,0);
      display.println(" ");
      display.display();
    }
    display.clearDisplay();
    display.setCursor(0,12);
    display.println("SCANNING <");
    display.setCursor(66,12);
    display.println(hz);
    display.setCursor(106,12);
    display.println("Hz");
    display.display();
  }
  digitalWrite(SCANLED, LOW);
  tone(TONEOUT,freq);                          //output the frequency found with higher voltage reading
  //tone(LOCKLED, (4));                        //LOCKLED isn't on a PWM pin - firepinto 10/27/14
  display.clearDisplay();
  display.setCursor(0,0);
  display.println("RESONANCE FOUND");
  display.setCursor(0,8);                         //printlning to display
  display.println(freq);
  display.setCursor(106,8);
  display.println("Hz");
  display.display();
  delay(5000);                                 //Changed from delay(2500); to delay(1500); - firepinto 10/26/14
 
  display.clearDisplay();
  display.setCursor(0, 0);
  display.println("WAITING FOR");
  display.setCursor(0, 8);
  display.println("STABILIZATION...");
  display.display();
  delay(5000);                                 //waiting for a stabilizing time for the circuit, comment to avoid *Changed from delay(5500); to delay(2500); - firepinto 10/26/14
  volt = analogRead(PICKUP);                   //read again the voltage from the pickup coil
    if (volt > 818)                            // *Added by firepinto 10/26/14
    {
    digitalWrite(PEAKLED, HIGH);
    }
     else
    {
    digitalWrite(PEAKLED, LOW);
    }
  if (volt > vmax-51)                          //check if read voltage is less than 10% of the best voltage found
   {
   display.clearDisplay();                                //if not, scan will start again
   display.setCursor(0,0);
   display.println("FREQUENCY");
   display.setCursor(69,0);
   display.println(byte(0));
   display.setCursor(0,8);
   display.println("LOCKED");
   display.display();
   //noTone(SCANLED);                          //LOCKLED pin doesn't have PWM - firepinto 10/27/14
   digitalWrite(LOCKLED, HIGH);
 
   delay(5000);                                //Changed from delay(2000); to delay(1000); - firepinto 10/26/14
  }
 
  adjfreq = freq;                              //sets adjustable frequency equal to the locked frequency
 
  while (digitalRead(BTN) == LOW)              //until the scan button is pressed, do the following
  { 
  tone(TONEOUT,adjfreq);                       //turns on pulse signal to pin 9 with adjustable frequency
  gateread = analogRead(GATESET);              //reads Gate frequency potentiometer and sets the variable
  duty = analogRead(GATEDUTY);                 //read the gating set value from pin A1
  freqrange = analogRead(FRANGE);              //reads the scale for manual frequency adjustment buttons from the potentiometer and sets the variable
  gatef = map (gateread, 0, 1023, 1, 120);     //limit the gating frequency from 1 to 120 hz
  scale = map (freqrange, 0, 1023, 1, 1000);     //limit the gating frequency from 1 to 120 hz ---fp
  dutyP = map (duty, 0, 1023, 100, 0);         //translate T(miliseconds) into f(Hz) for gating frequency
  Timer1.pwm(GATEOUT, duty, 1000000/gatef);    //turns on Gating signal to pin 10

 
                                               //unused as of ver. 0.2.10a
  //if (istime(&it,*******))                   //start Gating function
 //{                                           //"IsTime()" function will return a pulse of a true value every set miliseconds
   //odd = !odd;
 // if (odd)                                   //if odd variable is true, turn on frequency generation
 // {tone(TONEOUT,freq);
  // digitalWrite(GATELED, HIGH);              //light an LED also because we can! :P
 
 
 
   volt = analogRead(PICKUP);                  //read the voltage on the VIC           *Needed to uncomment this line for the pick up coil voltage to be read during gating - firepinto 10/25/14


     if (volt > 818)                           //If pickup coil voltage is over 4 volts at pin, light LED. *Added by firepinto 10/26/14
         {
         digitalWrite(PEAKLED, HIGH);          //Turn ON pick-up coil peak voltage LED
         }
       else
         {
         digitalWrite(PEAKLED, LOW);           //Turn OFF pick-up coil peak voltage LED
         } 
 
 //  }                                         //unused as of ver. 0.2.10a
  // else                                      //or if odd is false, turn off frequency generation
  // {
   // volt = analogRead(PICKUP);
    // noTone(TONEOUT);
    // digitalWrite(GATELED, LOW);
  // }
 // }
 
  freqpstate = digitalRead(FREQPLUS);          //reads frequency plus push button and sets the variable to its value
      {
  if (adjfreq < 32000)                         //sets maximum frequency to 24390 through the manual "plus" push button
   {
    if (lastpstate != 1)                       //if last state of plus button does not equal 1

      {
       if (freqpstate == HIGH)                 //if plus button state is HIGH
        {
        adjfreq+=scale;                        //Add scale frequency to adjustable frequency
        digitalWrite(SCANLED, HIGH);           //Turn on Scan LED
        lastpstate = freqpstate;               //set plus button last state variable
        delay(100);                            //100 millisecond delay for button debounce (there may be a better option than this)
        }
      else                                     //if not
        {
        digitalWrite(SCANLED, LOW);            //Turn off Scan LED
        lastpstate = freqpstate;               //set plus button last state variable
        }
     }
     else                                      //if not
      {
      lastpstate = freqpstate;                 //set plus button last state variable
      }
   }
 
   
  freqmstate = digitalRead(FREQMINUS);         //reads frequency increase push button and sets the variable to its value

   if (adjfreq > scale)                        //sets minimum frequency to the scale frequency through the manual "minus" push button
      {
      if (lastmstate != 1)                     //if last state of minus button does not equal 1
      {
          if (freqmstate == HIGH)              //if minus button state is HIGH
            {
            adjfreq-=scale;                    //Subtract scale frequency from adjustable frequency
            digitalWrite(SCANLED, HIGH);       //Turn on Scan LED
            lastmstate = freqmstate;           //set minus button last state variable
            delay(100);                        //100 millisecond delay for button debounce (there may be a better option than this)
            }
           else                                //if not
            {
            digitalWrite(SCANLED, LOW);        //Turn off Scan LED
            lastmstate = freqmstate;           //set minus button last state variable
            }
          }
         else                                  //if not
          {
          lastmstate = freqmstate;             //set minus button last state variable
          }
      }
      }
 if (adjfreq < 35)                             //blocks the minus push button from going lower than 31 Hz
   {
    adjfreq = 35;
   }
if (adjfreq > 35000)                           //blocks the plus push button from going higher than 24390 Hz
   {
   adjfreq = 35000;
   }
     

 
  double vdisp = volt*(5.0/1023.0);            //scale digital signal to analog 0.0 - 5.0 volts
   if (adjfreq == 0)                           //resets adjustable frequency to locked frequency if it is zero
      {
      adjfreq = freq;
      }
   if (adjfreq != freq)                        //if adjustable frequency does not equal locked frequency.
       {
       digitalWrite(LOCKLED, LOW);             //then turn off Lock LED
       }
     else                                      //if not
       {
       digitalWrite(LOCKLED, HIGH);            //turn on Lock LED
       }
   if (istime(&itdisplay,refdisplay))                  //Original ver. 0.2.10a code
       {                                       //Reorganized display and relabeled titles to Stanley Meyer terminology (May want to println titles elsewhere so they don't need to continually refresh and slow down the program, if possible)
           display.clearDisplay();
           display.setCursor(0,0);                 //Move to digit 0 row 0
             display.println("T1=      Hz");         //Pulse frequency title "T1=" with units label "Hz"
       //      display.println("     ");               //Overwrites with spaces to clearDisplay digits
           display.setCursor(19,0);                 //Move to digit 3 row 0
             display.println(adjfreq);               //Adjustable frequency
           display.setCursor(70,0);                //Move to digit 13 row 0
             display.println("VT=");                 //Pick-up coil voltage title "VT="
           display.setCursor(89,0);                //Move to digit 16 row 0
      //       display.println("    ");                //Overwrites with spaces to clearDisplay digits
      //     display.setCursor(16,0);                //Move to digit 16 row 0
             display.println(vdisp);                 //Pick-up coil voltage
           display.setCursor(0,8);                 //same idea continued below
             display.println("T3=      Hz");
           display.setCursor(19,8);
     //        display.println("   ");
     //      display.setCursor(3,1);
             display.println(gatef);
           display.setCursor(70,8);
             display.println("DY=   %");
           display.setCursor(89,8);
     //        display.println("   ");
     //      display.setCursor(16,1);
             display.println(dutyP);
           display.setCursor(0,16);
             display.println("LK=      Hz");
    //         display.println("     ");
           display.setCursor(19,16);
             display.println(freq);
           display.setCursor(70,16);
             display.println("SL=");
    //         display.println("    ");
           display.setCursor(89,16);
             display.println(scale);
           display.display();
            delay(5000);
          } 
   // {
    if (volt < vmax-51)                         //after frequency has been locked and gating is on, whenever the voltage drops over 10% of the last best voltage found
       {
       if (adjfreq == freq)                     //Disables the auto scan feature commented above when the adjustable frequency is not equal to the locked frequency
          break;                                //scan will accur again by itself
          }

        }
        }

     //   }
int istime(unsigned long *timemark, unsigned long timeinterval) //Code below all original from ver. 0.2.10a
{
  unsigned long timecurrent;
  unsigned long timeelapsed;
  int result = false;
  timecurrent=millis();
 
  if (timecurrent<*timemark)
  {
    timeelapsed = (TIMECTL_MAXTICKS-*timemark)*timecurrent;
  }
  else
  {
    timeelapsed = timecurrent-*timemark;
  }
  if (timeelapsed>=timeinterval)
  {
    *timemark = timecurrent;
    result = true;
  }
  return(result);
}

firepinto

Re: Arduino VIC resonator
« Reply #103, on January 17th, 2015, 04:40 AM »
Interesting, :cool: did someone already implement the Analog Devices AD9850 with the VIC Resonator?  It looks like a very capable frequency generator, I attached the data sheet.

abadiya, did you add the code for the OLED display?  If so nice job. :)

nav

Re: Arduino VIC resonator
« Reply #104, on January 17th, 2015, 05:08 AM »
For test purposes this is excellent:
http://www.virtins.com/
I downloaded their 3.4 software and tested it across an opto into a fast switching mosfet and found it more than useful.
It has built in gate function in its signal generator which means you can gate any frequency but is restricted by the output of the sound card up to 80Khz at 64bit depending on the card. It has a brilliant set of square wave filters and you can set the output of the signal gen to match the input of any opto/mosfet from zero to 1 volt.
Multi channel too so you can create more than one signal.
The 3.4 version is on a free 21 day trial.

abadiya

Re: Arduino VIC resonator
« Reply #105, on January 17th, 2015, 06:54 AM »Last edited on January 17th, 2015, 07:09 AM
In the first page Zissis had DDS code. But DDS version was removed. :@ Why?
P.S. I added some basic code to support OLED display, it is not perfect and could be improved. It is working code with some small bugs.Also i boosted frequency to 32kHz

firepinto

Re: Arduino VIC resonator
« Reply #106, on January 17th, 2015, 07:35 AM »
Ah, I totally forgot Zissis removed a version.  It looks like he hasn't come to the forum in almost a year.  Maybe he could be contacted through his youtube channel?

abadiya


zchiotis

Re: Arduino VIC resonator
« Reply #108, on January 21st, 2015, 02:04 AM »
Wow... I am pleased that the application gained interest!! Soon I will upload some versions and info on my blog. Please contact me via email(find it on my blog) if you need help troubleshooting with Arduino.

Stay tuned,
Zissis

firepinto

Re: Arduino VIC resonator
« Reply #109, on January 21st, 2015, 06:41 AM »
Welcome back Zissis :)

The VIC Resonator has been a great learning tool for me. :cool:

Alberto

Re: Arduino VIC resonator
« Reply #110, on January 22nd, 2015, 05:53 AM »Last edited on January 22nd, 2015, 08:47 AM
Well, my version of the 0.2.12a is almost ready... :cool2:
I want to thank zchiotis and firepinto for their great job.
May i repeat my question from October 21st, 2013?
Is it possible to run the Arduino VIC resonator
from 0 to 60 kHz with pwm output 5 & 6?
I`ve tried this but the display went on error.
I  am asking this because Stan was talking
somewhere about 50 kHz.

firepinto

Re: Arduino VIC resonator
« Reply #111, on January 22nd, 2015, 06:55 AM »
Looks great Alberto! :cool:

I have only been able to get T1 frequency up to 24390 hz (if i remember right) before frequency becomes completely random and far off from the set value.  The problem happens exactly at and after 24391 hz and isn't a progressive problem up to that point.  T1 is using the tone command, while T3 (the gate frequency) is using the Timer1 library.  I have been able to get a little higher frequency on T3 in some tests, but I don't remember getting as high as 50khz.  It seems the Timer1 library is a little more accurate, as it will also go down to 1 hz, which the tone command can not.  Really these two timers should probably be swapped around.

I can't remember off hand the exact details on the PWM outputs, but i think certain timers are restricted to certain outputs.  That would be the biggest reason why PWM 5 or 6 might not work.

Id like to find a way to have the T1 timer triggered by the leading edge of the T3 square wave.  T1 timer "on time" would be the pulse train width.  This would keep the square waves in sync and keep out the square waves with shortened pulse duty at the beginning and end of the pulse train when using combined signals in a gate.  My last experimental attempt at that wasn't all that good.




abadiya

Re: Arduino VIC resonator
« Reply #112, on January 22nd, 2015, 07:41 AM »
Quote from Alberto on January 22nd, 2015, 05:53 AM
Well, my version of the 0.2.12a is almost ready... :cool2:
I want to thank zchiotis and firepinto for their great job.
May i repeat my question from October 21st, 2013?
Is it possible to run the Arduino VIC resonator
from 0 to 60 kHz with pmw output 5 & 6?
You are absolutely correct about Stan, working frequency about 50kHz. Sweep has to be 25kHz-60kHz
To make it work you have to use PWM 9 or 10 for output  Look at my code, for now it is 32kHz, it is possible to boost it up to 1mHz
Quote from Alberto on January 22nd, 2015, 05:53 AM
I`ve tried this but the display went on error.
I  am asking this because Stan was talking
somewhere about 50 kHz.

Lynx

Re: Arduino VIC resonator
« Reply #113, on January 22nd, 2015, 08:04 AM »
Quote from abadiya on January 22nd, 2015, 07:41 AM
Look at my code, for now it is 32kHz, it is possible to boost it up to 1mHz
Just out of curiosity, how fine a step would you be able to get out of it?
Is it in whole Hz, like for instance if you set it on 1 MHz and decreased the frequency by the least significant step that's available to you, what would the resulting frequency then be?
For example if the smallest step there are for altering any frequency is 1 Hz, in that case decreasing a 1MHz output frequency would result in getting 999999 Hz instead.
Hope you understand what I mean.

nav

Re: Arduino VIC resonator
« Reply #114, on January 22nd, 2015, 08:23 AM »Last edited on January 22nd, 2015, 08:26 AM
Quote from abadiya on January 22nd, 2015, 07:41 AM
You are absolutely correct about Stan, working frequency about 50kHz. Sweep has to be 25kHz-60kHz
To make it work you have to use PWM 9 or 10 for output  Look at my code, for now it is 32kHz, it is possible to boost it up to 1mHz
Yeah but he's sweeping for the resonance, the drive circuit and the pll will be much less. Also, if you build your own cell and coils, their own self resonance may not be in that region, it mat be above 1Mhz or less that 35Khz, it is dependant on coil and cell size.

firepinto

Re: Arduino VIC resonator
« Reply #115, on January 22nd, 2015, 09:05 AM »
If anyone would like to try to calculate what Stan's equipment was actually producing for a pulse train frequency that was sent to the PLL, use a 1uf capacitor and a resistance value that can vary from 9.4k to 109.4K ohms in the formula in the datasheet attached.  The chart only goes up to 1000pf, and I'd rather build it and test frequency than run the math. lol

The variable pulse frequency generator is just the trigger to the multivibrator, which generates the step charge frequency of the pulse train. 

nav

Re: Arduino VIC resonator
« Reply #116, on January 22nd, 2015, 09:16 AM »
Quote from firepinto on January 22nd, 2015, 09:05 AM
If anyone would like to try to calculate what Stan's equipment was actually producing for a pulse train frequency that was sent to the PLL, use a 1uf capacitor and a resistance value that can vary from 9.4k to 109.4K ohms in the formula in the datasheet attached.  The chart only goes up to 1000pf, and I'd rather build it and test frequency than run the math. lol

The variable pulse frequency generator is just the trigger to the multivibrator, which generates the step charge frequency of the pulse train.
Very true. therefore it is wise to build the cell and chokes before you build the pll and drive circuitry.

firepinto

Re: Arduino VIC resonator
« Reply #117, on January 22nd, 2015, 02:57 PM »
The way stan has the PLL circuits, it can cover a broad range of frequencies.

Alberto

Re: Arduino VIC resonator
« Reply #118, on February 12th, 2015, 03:28 AM »
The frequency-range of the new version 0.2.12a is 31 - 24.390Hz,
so i did some research with my old version 0.2.10a.
I programmed it with 10 - 32.000Hz.
I took my Mosfet-circuit and let it switch a resistor of 270 Ohm to the ground.
Like you can see on the picture, the signal of the Arduino (below) is perfect.
The signal on the resistor is getting bad at high frequency, so soon
i`m gonna do some tests with Mosfet-driver TC1412N.

Gunther Rattay

Re: Arduino VIC resonator
« Reply #119, on February 12th, 2015, 03:54 AM »
TC1412N is weak. take TC4421/4429 instead.

Davy Oneness

Re: Arduino VIC resonator
« Reply #120, on August 20th, 2015, 06:09 PM »
Quote from abadiya on January 16th, 2015, 11:44 PM
There is modified code to accommodate 128x64 OLED Display :
Code: [Select]
/*
   VIC Resonator written by Zissis aka zchiotis on open-source-energy.org forum.
   Downloaded from open-source-energy.org/?topic=1097.0
   Version 0.2.10 beta changes made by firepinto
   Version 0.2.11 alpha changes made by firepinto 10/30/14
*/
#include <TimerOne.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_MOSI   6
#define OLED_CLK   7
#define OLED_DC    11
#define OLED_CS    0
#define OLED_RESET 5
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2

#define LOGO16_Gdisplay_HEIGHT 16
#define LOGO16_Gdisplay_WIDTH  16

#define TIMECTL_MAXTICKS 4294967295
#define TIMECTL_INIT 0

#define  PICKUP A0                             //pickup coil is connected to pin A0 via voltage divider and a zener diode
#define  TONEOUT 9                             //Output to the VIC primary coil
#define  GATEOUT 10                            //Output pin for Gate signal
#define  GATEDUTY A2                           //potentiometer connected to A2 to set gating pulse duty
#define  BTN 8                                 //button for scan order is connected to pin D8
#define  GATESET A1                            //potentiometer connected to A1 pin to set gating frequency
#define  LOCKLED 12                            //LED - indicator when the frequency is locked, pin D1  *Changed from D1 to D12 just to be next to the new scan LED pin - firepinto 10/25/14
#define  SCANLED 8                            //LED - indicator when scanning, pin D0                *Changed from D0 to D11 because of serial uploading issues from the IDE - firepinto 10/25/14
#define  PEAKLED 13                            //LED - indicates when pickup coil input A0 is at or near 5 volts. *Added by firepinto 10/26/14
#define  FRANGE  A3                            //potentiometer connected to A3 to set the scale for manual frequency adjust buttons
#define  FREQPLUS  18                          //Push Button for adjusting frequency higher
#define  FREQMINUS  19                         //Push Button for adjusting frequency lower
// #define  GATELED 13                         //LED - Gating indicator                               

int hz = 1000;                               
int freq = 0;                                  //Variable for Locked frequency
int freqplus = 0;                              //Low end of freqency fine tune scale - firepinto 10/27/14
int freqminus = 0;                             //High end of freqency fine tune scale - firepinto 10/27/14
int freqrange = 0;                             //Variable for FRANGE POT
int scale = 0;                                 //Scale variable in Hz for manual frequency adjust buttons
int adjfreq = freq;                            //Resulting frequency from auto scan and fine tune - firepinto 10/27/14
int volt = 0;
int vmax = 0;
int intval = 0;
int gateread = 0;
int gatef = 1;
int duty = 512;
int dutyP = 0;
int freqmstate = 0;                            //Variable for minus button manual frequency adjustment
int freqpstate = 0;                            //Variable for plus button manual frequency adjustment
int lastmstate = 0;                            //last state for minus button
int lastpstate = 0;                            //last state for plus button

unsigned long it = 0;
unsigned long itdisplay = 0;
unsigned long refdisplay = 350;                    // display refresh rate mS
int odd = false;


void setup()
{
  Serial.begin(9600);
 
  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC);
  // init done
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println("   VIC RESONATOR");
  display.display();
  delay(2000);
 // Serial.begin(9600);
  pinMode(TONEOUT, OUTPUT);
  pinMode(GATEOUT, OUTPUT);
  pinMode(GATEDUTY, INPUT); 
  pinMode(PICKUP, INPUT);                     //initializing the pins
  pinMode(BTN, INPUT);
  pinMode(GATESET, INPUT);
  pinMode(FRANGE, INPUT);                     //firepinto - 10/27/14
  pinMode(LOCKLED, OUTPUT);                   //firepinto - 10/27/14
  pinMode(SCANLED, OUTPUT);                   //firepinto - 10/27/14
  pinMode(PEAKLED, OUTPUT);                   //firepinto - 10/27/14
  pinMode(FREQPLUS, INPUT);                   //firepinto - 10/27/14
  pinMode(FREQMINUS, INPUT);                  //firepinto - 10/27/14

//  pinMode(GATELED, OUTPUT);                 //unused as of ver. 0.2.10a
  Timer1.initialize(1000000);
}

void loop()
{
vmax = 0;                                     //comment if you want to keep the best frequency of all scans
intval = 0;                                   //comment if you want to see the frequency found interval in all scans
noTone(TONEOUT);                              // used to have LOCKLED pin
digitalWrite(LOCKLED, LOW);
Timer1.stop();
digitalWrite(GATEOUT, LOW);
//digitalWrite(GATELED, LOW);                 //unused as of ver. 0.2.10a
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.clearDisplay();
  display.println("SCANNING...");
  digitalWrite(SCANLED, HIGH);
  display.setCursor(70,8);
  display.println("Hz");
  display.display();
for (hz=1000; hz<=32000; hz=hz+10)             //start from 1khz to 32khz to oscillate the circuit
{
  tone(TONEOUT,hz);                           //will send a tone at first
  delay(1);                                   //wait for a millisec
  volt = analogRead(PICKUP);                  //then read the voltage
  if (volt > 818)                             //If pick-up coil voltage is greater than 4 volts
    {
    digitalWrite(PEAKLED, HIGH);              //turn on peak LED
    }
     else
    {
    digitalWrite(PEAKLED, LOW);               //turn off peak LED
    }
  if (vmax < volt)                            //if there is a resonant point voltage should have the highest value on this frequency
  {
    vmax = volt;                              //store as the best voltage
    freq = hz;                                //remember that frequency
    intval = intval++;                        //times found a nice frequency interval, is showing during scan on the left of the display
  display.clearDisplay();
  display.setCursor(0,12);
  display.println("SCANNING >");
  display.setCursor(66,12);
  display.println(intval);
  display.setCursor(106,12);
  display.println("Hz");
  display.display();
  }
  display.clearDisplay();
  display.setCursor(0,12);
  display.println("SCANNING >");
  display.setCursor(66,12);
  display.println(hz);
  display.setCursor(106,12);
  display.println("Hz");
  display.display();
  }
  for (hz=32000; hz>=1000; hz=hz-10)           //do the same for a descent scan
  {
    tone(TONEOUT,hz);   
    delay(1);
    volt = analogRead(PICKUP);
    if (volt > 818)                           // *Added by firepinto 10/26/14
    {
    digitalWrite(PEAKLED, HIGH);
    }
     else
    {
    digitalWrite(PEAKLED, LOW);
    }
    if (vmax < volt)
    {
      vmax = volt;
      freq = hz;
      adjfreq = freq;
      intval = intval++  ;
 //     display.clearDisplay();
      display.setCursor(0,0);
      display.println(intval);
      display.display();
    }
    if (hz < 10000)
    {
 //     display.clearDisplay();
      display.setCursor(0,0);
      display.println(" ");
      display.display();
    }
    display.clearDisplay();
    display.setCursor(0,12);
    display.println("SCANNING <");
    display.setCursor(66,12);
    display.println(hz);
    display.setCursor(106,12);
    display.println("Hz");
    display.display();
  }
  digitalWrite(SCANLED, LOW);
  tone(TONEOUT,freq);                          //output the frequency found with higher voltage reading
  //tone(LOCKLED, (4));                        //LOCKLED isn't on a PWM pin - firepinto 10/27/14
  display.clearDisplay();
  display.setCursor(0,0);
  display.println("RESONANCE FOUND");
  display.setCursor(0,8);                         //printlning to display
  display.println(freq);
  display.setCursor(106,8);
  display.println("Hz");
  display.display();
  delay(5000);                                 //Changed from delay(2500); to delay(1500); - firepinto 10/26/14
 
  display.clearDisplay();
  display.setCursor(0, 0);
  display.println("WAITING FOR");
  display.setCursor(0, 8);
  display.println("STABILIZATION...");
  display.display();
  delay(5000);                                 //waiting for a stabilizing time for the circuit, comment to avoid *Changed from delay(5500); to delay(2500); - firepinto 10/26/14
  volt = analogRead(PICKUP);                   //read again the voltage from the pickup coil
    if (volt > 818)                            // *Added by firepinto 10/26/14
    {
    digitalWrite(PEAKLED, HIGH);
    }
     else
    {
    digitalWrite(PEAKLED, LOW);
    }
  if (volt > vmax-51)                          //check if read voltage is less than 10% of the best voltage found
   {
   display.clearDisplay();                                //if not, scan will start again
   display.setCursor(0,0);
   display.println("FREQUENCY");
   display.setCursor(69,0);
   display.println(byte(0));
   display.setCursor(0,8);
   display.println("LOCKED");
   display.display();
   //noTone(SCANLED);                          //LOCKLED pin doesn't have PWM - firepinto 10/27/14
   digitalWrite(LOCKLED, HIGH);
 
   delay(5000);                                //Changed from delay(2000); to delay(1000); - firepinto 10/26/14
  }
 
  adjfreq = freq;                              //sets adjustable frequency equal to the locked frequency
 
  while (digitalRead(BTN) == LOW)              //until the scan button is pressed, do the following
  { 
  tone(TONEOUT,adjfreq);                       //turns on pulse signal to pin 9 with adjustable frequency
  gateread = analogRead(GATESET);              //reads Gate frequency potentiometer and sets the variable
  duty = analogRead(GATEDUTY);                 //read the gating set value from pin A1
  freqrange = analogRead(FRANGE);              //reads the scale for manual frequency adjustment buttons from the potentiometer and sets the variable
  gatef = map (gateread, 0, 1023, 1, 120);     //limit the gating frequency from 1 to 120 hz
  scale = map (freqrange, 0, 1023, 1, 1000);     //limit the gating frequency from 1 to 120 hz ---fp
  dutyP = map (duty, 0, 1023, 100, 0);         //translate T(miliseconds) into f(Hz) for gating frequency
  Timer1.pwm(GATEOUT, duty, 1000000/gatef);    //turns on Gating signal to pin 10

 
                                               //unused as of ver. 0.2.10a
  //if (istime(&it,*******))                   //start Gating function
 //{                                           //"IsTime()" function will return a pulse of a true value every set miliseconds
   //odd = !odd;
 // if (odd)                                   //if odd variable is true, turn on frequency generation
 // {tone(TONEOUT,freq);
  // digitalWrite(GATELED, HIGH);              //light an LED also because we can! :P
 
 
 
   volt = analogRead(PICKUP);                  //read the voltage on the VIC           *Needed to uncomment this line for the pick up coil voltage to be read during gating - firepinto 10/25/14


     if (volt > 818)                           //If pickup coil voltage is over 4 volts at pin, light LED. *Added by firepinto 10/26/14
         {
         digitalWrite(PEAKLED, HIGH);          //Turn ON pick-up coil peak voltage LED
         }
       else
         {
         digitalWrite(PEAKLED, LOW);           //Turn OFF pick-up coil peak voltage LED
         } 
 
 //  }                                         //unused as of ver. 0.2.10a
  // else                                      //or if odd is false, turn off frequency generation
  // {
   // volt = analogRead(PICKUP);
    // noTone(TONEOUT);
    // digitalWrite(GATELED, LOW);
  // }
 // }
 
  freqpstate = digitalRead(FREQPLUS);          //reads frequency plus push button and sets the variable to its value
      {
  if (adjfreq < 32000)                         //sets maximum frequency to 24390 through the manual "plus" push button
   {
    if (lastpstate != 1)                       //if last state of plus button does not equal 1

      {
       if (freqpstate == HIGH)                 //if plus button state is HIGH
        {
        adjfreq+=scale;                        //Add scale frequency to adjustable frequency
        digitalWrite(SCANLED, HIGH);           //Turn on Scan LED
        lastpstate = freqpstate;               //set plus button last state variable
        delay(100);                            //100 millisecond delay for button debounce (there may be a better option than this)
        }
      else                                     //if not
        {
        digitalWrite(SCANLED, LOW);            //Turn off Scan LED
        lastpstate = freqpstate;               //set plus button last state variable
        }
     }
     else                                      //if not
      {
      lastpstate = freqpstate;                 //set plus button last state variable
      }
   }
 
   
  freqmstate = digitalRead(FREQMINUS);         //reads frequency increase push button and sets the variable to its value

   if (adjfreq > scale)                        //sets minimum frequency to the scale frequency through the manual "minus" push button
      {
      if (lastmstate != 1)                     //if last state of minus button does not equal 1
      {
          if (freqmstate == HIGH)              //if minus button state is HIGH
            {
            adjfreq-=scale;                    //Subtract scale frequency from adjustable frequency
            digitalWrite(SCANLED, HIGH);       //Turn on Scan LED
            lastmstate = freqmstate;           //set minus button last state variable
            delay(100);                        //100 millisecond delay for button debounce (there may be a better option than this)
            }
           else                                //if not
            {
            digitalWrite(SCANLED, LOW);        //Turn off Scan LED
            lastmstate = freqmstate;           //set minus button last state variable
            }
          }
         else                                  //if not
          {
          lastmstate = freqmstate;             //set minus button last state variable
          }
      }
      }
 if (adjfreq < 35)                             //blocks the minus push button from going lower than 31 Hz
   {
    adjfreq = 35;
   }
if (adjfreq > 35000)                           //blocks the plus push button from going higher than 24390 Hz
   {
   adjfreq = 35000;
   }
     

 
  double vdisp = volt*(5.0/1023.0);            //scale digital signal to analog 0.0 - 5.0 volts
   if (adjfreq == 0)                           //resets adjustable frequency to locked frequency if it is zero
      {
      adjfreq = freq;
      }
   if (adjfreq != freq)                        //if adjustable frequency does not equal locked frequency.
       {
       digitalWrite(LOCKLED, LOW);             //then turn off Lock LED
       }
     else                                      //if not
       {
       digitalWrite(LOCKLED, HIGH);            //turn on Lock LED
       }
   if (istime(&itdisplay,refdisplay))                  //Original ver. 0.2.10a code
       {                                       //Reorganized display and relabeled titles to Stanley Meyer terminology (May want to println titles elsewhere so they don't need to continually refresh and slow down the program, if possible)
           display.clearDisplay();
           display.setCursor(0,0);                 //Move to digit 0 row 0
             display.println("T1=      Hz");         //Pulse frequency title "T1=" with units label "Hz"
       //      display.println("     ");               //Overwrites with spaces to clearDisplay digits
           display.setCursor(19,0);                 //Move to digit 3 row 0
             display.println(adjfreq);               //Adjustable frequency
           display.setCursor(70,0);                //Move to digit 13 row 0
             display.println("VT=");                 //Pick-up coil voltage title "VT="
           display.setCursor(89,0);                //Move to digit 16 row 0
      //       display.println("    ");                //Overwrites with spaces to clearDisplay digits
      //     display.setCursor(16,0);                //Move to digit 16 row 0
             display.println(vdisp);                 //Pick-up coil voltage
           display.setCursor(0,8);                 //same idea continued below
             display.println("T3=      Hz");
           display.setCursor(19,8);
     //        display.println("   ");
     //      display.setCursor(3,1);
             display.println(gatef);
           display.setCursor(70,8);
             display.println("DY=   %");
           display.setCursor(89,8);
     //        display.println("   ");
     //      display.setCursor(16,1);
             display.println(dutyP);
           display.setCursor(0,16);
             display.println("LK=      Hz");
    //         display.println("     ");
           display.setCursor(19,16);
             display.println(freq);
           display.setCursor(70,16);
             display.println("SL=");
    //         display.println("    ");
           display.setCursor(89,16);
             display.println(scale);
           display.display();
            delay(5000);
          } 
   // {
    if (volt < vmax-51)                         //after frequency has been locked and gating is on, whenever the voltage drops over 10% of the last best voltage found
       {
       if (adjfreq == freq)                     //Disables the auto scan feature commented above when the adjustable frequency is not equal to the locked frequency
          break;                                //scan will accur again by itself
          }

        }
        }

     //   }
int istime(unsigned long *timemark, unsigned long timeinterval) //Code below all original from ver. 0.2.10a
{
  unsigned long timecurrent;
  unsigned long timeelapsed;
  int result = false;
  timecurrent=millis();
 
  if (timecurrent<*timemark)
  {
    timeelapsed = (TIMECTL_MAXTICKS-*timemark)*timecurrent;
  }
  else
  {
    timeelapsed = timecurrent-*timemark;
  }
  if (timeelapsed>=timeinterval)
  {
    *timemark = timecurrent;
    result = true;
  }
  return(result);
}
Is there a 0.2.12a OLED version any where yet? I started to try fixing myself, but quickly going crazy :/
Re: Arduino VIC resonator
« Reply #121, on August 23rd, 2015, 07:44 PM »
Stan kept it simple, and he used his driver configuration AND the 220ohm resistor ACROSS the coil for a reason. After studying the original schematic from the estate, I can see what he is doing.......and why no one can get clean signal switching the coil. His brilliant coil driver is a sort of complementary, or Sziklai Transistor Pair type of AMPLIFIER(we want an electrostatic "tone" in the cell) driven by a pull down resistor at its input.
Also, forget adding extra logic gates and mosfet drivers, we just need 2 series Opto-isolator with t1 and t3 outputs flashing their LEDs. And I have seen the parallel resistor to the coil used to get  clean switching in the same frequency range we want to work with here, hence why Stan used it. It is there for more than just keeping the coil cool. So here is my updated version of the driver,IMHO, to use with arduino outputs:

freethisone

Re: Arduino VIC resonator
« Reply #122, on August 24th, 2015, 01:49 PM »
Quote from Davy Oneness on August 23rd, 2015, 07:44 PM
Stan kept it simple, and he used his driver configuration AND the 220ohm resistor ACROSS the coil for a reason. After studying the original schematic from the estate, I can see what he is doing.......and why no one can get clean signal switching the coil. His brilliant coil driver is a sort of complementary, or Sziklai Transistor Pair type of AMPLIFIER(we want an electrostatic "tone" in the cell) driven by a pull down resistor at its input.
Also, forget adding extra logic gates and mosfet drivers, we just need 2 series Opto-isolator with t1 and t3 outputs flashing their LEDs. And I have seen the parallel resistor to the coil used to get  clean switching in the same frequency range we want to work with here, hence why Stan used it. It is there for more than just keeping the coil cool. So here is my updated version of the driver,IMHO, to use with arduino outputs:
nice. if it works..

tone.  drop a rodin coil in the water. add a plate.

better yet. attach the plate across the rodin coil, and add another spaced at 3 to 4 mils. now u have tone. it is a speaker too.

Gunther Rattay

Re: Arduino VIC resonator
« Reply #123, on August 24th, 2015, 11:40 PM »
Quote from Davy Oneness on August 23rd, 2015, 07:44 PM
Stan kept it simple, and he used his driver configuration AND the 220ohm resistor ACROSS the coil for a reason. After studying the original schematic from the estate, I can see what he is doing.......and why no one can get clean signal switching the coil. His brilliant coil driver is a sort of complementary, or Sziklai Transistor Pair type of AMPLIFIER...
But your config is Darlington ...

Davy Oneness

Re: Arduino VIC resonator
« Reply #124, on August 25th, 2015, 01:38 AM »Last edited on August 25th, 2015, 01:51 AM
Quote from Gunther Rattay on August 24th, 2015, 11:40 PM
But your config is Darlington ...
This is not my driver, this is Stans, I only added the optos to pull it down instead of the logic in his circuit, this way it further isolates the arduino from any high voltage. And your "but" clearly misses the point
Sziklai is a type of darlington, and  "the Darlington transistor (often called a Darlington pair) is a compound structure consisting of two bipolar transistors (either integrated or separated devices) connected in such a way that the current amplified by the first transistor is amplified further by the second one." source:wiki

Also please note:
"A New Circuit Model of Small-Signal Sziklai Pair Amplifier  "
"Amplification of signals  through Darlington  pair and Sziklai  pair  is an important  phenomenon  of  electronics .
A Darlington pair holds two identical BJTs in C C-CE connection  and  its  application  range  virtually  extends  from
small -signal  amplifiers to  power  amplifier  circuits.  However,  Sziklai  pair  unit  uses two  BJTs  of opposite  polarities  (one  NPN  and  other  PNP  transistor)  in CE-CE   connection   and therefore,   sometimes   known   as complementary Darlington pair.
Polarity of this compound configuration, which is a popular unit to use in  power  amplifiers  rather  than  small-signal  amplifiers,  is
always  determined  by  the driver transistor. Principally ,both   the  paired   units   enjoy   high   input resistances,   low   output   resistances   and   voltage   gains approximately equal to unit.Sziklai  pairs  hold better  linearity  than  Darlington  pairs  when  used  in  linear circuits .
Similarly, the base turn-on voltage of Sziklai pairis only half of the Darlington's turn-on voltage.In electronics industry, Sziklai pairs are normally used in push–pull  output  stage  of power  amplifiers  and however,     researches     towards     the     development     of
small-signal  amplifiers  using  Sziklai  pair  and  to  propose  a scheme  for  an  integrated  version  of  Sziklai  pair  as  a  single
transistor are  almost  untouched  "   
now get this, their conclusion is:
"The  proposed  amplifier  circuit  is suitable  to  use  in  Radio  and  TV  receiver  stages  due  to  its tuning   performance   in   the   specific   range   of   audible frequency,  extending  approximately  from  1Hz  to  20KHz. The  proposed  circuit  is  free  from  the  problem  of  poor response of conventional Darlington pair amplifiers at higher frequencies    and    consequently    provides    an    improved bandwidth than small-signal PNP Sziklai pair amplifier (the reference  amplifier).  Thus,  the  proposed  circuit  model  can
successfully   replace   conventional   circuit   model   of   a small-signal Darlington pair amplifier. "

International  Journal  of  Applied  Physics  and  Mathematics,  Vol.  3,  No.  4,  July  2013