Hey guys, I'm trying to get my head around creating a variable frequency output driver to power ultrasonic transducers, the frequency output will be used to drive fets that are on both sides of a centre taped transformer. The idea is to have control over the frequency and offtime between the two fets so I can control frequency sweeps between ~19kHz and 40kHz. I've been looking at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235060559/0#4 but think I might need some ideas on how to have specific control over this output? Any ideas are greatly appreciated.
Do you need Pulse Width Modulation or just a variable frequency square wave?
The frequency output of a timer can be adjusted with a combination of clock pre-scaler and how far you let the timer run before you reset. To generate a square wave at a particular frequency you generally have to specify both. The source code for the Tone() function (Tone.cpp) is a good starting place for generating a square wave at a specified frequency.
I have downloaded the Arduino zip file for Windows. It does not appear to contain the source code file for Tone(), "Tone.cpp". Where can I get the source files for functions like Tone(). I want to be able to generate multiple frequencies simultaneously. I want some of those frequencies to be the same, but phase offset from a primary. I doubt that anyone has done this before. In looking at the ATmega 2560 data sheet, I believe that this can be done. What I need is some software example to use as a guide. Since Tone() does this for a single frequency at a time, perhaps I can use this as a guide to write software to do it for multiple simultaneous frequencies. I appreciate any help that anyone is willing to give.
Are you sure your transducer is rated to work over that complete range? Most pizo based elements are pretty narrow bandwidth devices both for sending and receiving and if operated too far from their resonant frequency can have really poor sensitivity. A datasheet I guess is what would hold the answer.