Thursday, October 1, 2015

Function Generator

I finally completed this project after tinkering with an Arduino for almost two years. I had purchased an Arduino Uno development board for my birthday in 2013. Arduino is an open sourced microcontroller platform with numerous software/hardware applications freely available on the internet. I had always wanted to build a function generator so this seemed like the perfect opportunity to put my creative skills to work. Waveforms are generated using direct digital synthesis (DDS) technology. I purchased an LCD display and a DDS module (AD9850) off of e-Bay. Adding a rotary encoder and a switch essentially completed the hardware. Now I just needed to tie everything together. That’s where the Arduino came into play. Starting with publicly available software that was written to interface with a rotary encoder (rotary-encoders-done-properly) and LCD display/DDS chipset (ad9850-dds-vfo), I modified the code to work for my particular needs. The result is a compact, easy to use function generator with the following specs:

· 10Hz-1MHz square wave (~5Vpp to 890mVpp)
· 10Hz-30MHz sine wave (~1.6Vpp to 80mVpp)
· Selectable frequency increments of 10Hz, 50Hz, 100Hz, 500Hz, 1kHz, 5kHz, 10kHz, 100kHz and 1MHz


Eventually I plan on adding a buffer/amplifier/integrator to the output to increase the gain and provide a triangle waveform.

Update (Summer 2024)
After sitting idle in my workshop for MANY years, I finally decided to finish this project and make the improvements I originally proposed. These are summarized below:

1) Triangle wave support.  My initial idea was to take the generator's square wave output and feed it into an RC integrator, thus creating a triangle wave.  This works fine for a single frequency but when the frequency changes so does the output level.  Another frequency related issue concerned the "flatness" of the triangle wave itself.  Ideally, the RC time constant for an integrator should be ~10 times greater than the period of the input signal.  As the frequency changes so does the need to change this time constant value in order to maintain a "flat" curve.  After tinkering with these issues for a while and still not finding a satisfactory solution, I went in another direction and eventually found a replacement chip for the AD9850.  The AD9833 is another DDS device but with added support for generating a triangle wave.  Also, the signal level for all three waveforms remains virtually the same throughout its frequency range.  The main tradeoff is that it has a reduced upper frequency limit compared with the original chip.

2) Increased load capacity.  Using an OPA690 high speed op-amp at the generator output, I can now drive loads up to 160mA.

3) Bias adjustment.  Signal polarity can now be shifted from fully positive to fully negative.  

4) Amplitude adjustment.  The output signal level (normally ~3.2Vpp) can be attenuated down to 0V.

Here is a picture of the newly completed unit:




No comments:

Post a Comment