USB controlled DDS signal generator with ATmega88
A simple signal generator which produces sine waves (or any waveform really) at audio frequencies using DDS and is controlled a USB serial connection.
Only 2 chips are used in this circuit. The AVRATmega88 which produces the signal, and an FT232R for the USB interface. While a computer is required to control the varying frequency of the oscillator, a fixed frequency project could be made without the USB interface. Likewise one could say that a sound card could be used to generate the signal, but this circuit could be useful if an independent signal is required, for instance when testing a piece of equipment and the sound card is needed as an input device.
The waveform is produced using DDS (Direct Digital Synthesis). A decision is made as to the number of bits of resolution required for the waveform. For example, if 8 bits is selected, 256 separate points can be produced throughout 360 degrees of the waveform. For this application 6 bits was selected, giving up to 64 data points. In practice this gives a fairly good sine wave, with slightly noticeable digital noise on the waveform. This can be filtered somewhat using a capacitor of say 0.01uF across the ouput, at the expense of attenuation at higher frequencies.
The USB interface uses the FT232R chip from FTDIchip which allows use of UART interface to the microcontroller with very few components. A FT245R chip could also be used giving a parallel interface to the microcontroller, but this involves a higher pin count on the board. These FT devices appear as a serial device on the USB port.
A very basic GTK2 interface is provided, and was produced using glade-2 GUI builder. The output of this is used with the perl-Gtk2 module to produce a working program. A simple C or C++ program could similarly be used with the Glade2 file instead of the perl one. This interface worked well on OS X and Linux, perhaps a VB or other GUI would be more suitable for Windows. All that is needed is a control loop that can send an integer that corresponds to a value on a control widget.
A sine wave is given as the main example in the code, and a lookup table for a sawtooth wave is also provided. A square wave would simply require all bits on or all bits off, and is left to the reader to work out.
The raw number is applied to PORT C, which outputs either a high or low bit on each leg of the resistor network. The output voltage is then produced as per the formula
The delay between the change from one data point in the lookup table to the next determines the frequency.
A single sided board was used to make for simple construction. The board itself was made using techniques described in PCB toner transfer method from the output of Eagle. Note that one single wire could not be routed as a track, and a wire needs to be added between pin 5 of the FT232R and pin 31 of the ATmega88.
For more detail: USB controlled DDS signal generator with ATmega88
Leave a Comment
You must be logged in to post a comment.