So I have decided to make one! I'm hoping to use this project to re-learn some of the electronics theory I have forgotten and share it with everyone else so that someone else can benefit from my efforts. Its a win win! I get a function generator for my efforts and the people who bother to read this get to learn a little bit about electronics and how some instrumentation is designed....At least that is the plan.
A function generator for those that don't know is a piece of electronic equipment that simulates electronic signals. These signals can be sine waves, square waves, ramp waves or pulses or an arbitrary electronic signal of some kind. The output frequency and voltage can be varied as required.
Electronics engineers use these devices to test different types of electronic circuits including:
Signal or Instrumentation Amplifiers
Electronic Filters - all different types
So here goes....lets list the kind of features for the function generator that we need or want.
Sine wave output
Square wave output
triangle wave output
Monostable pulse output
Voltage variable from 0V to 5V
Frequency variable from 1Hz to 10MHz
Software control of instrument from a computer
Building a piece of equipment like this from scratch is a lot of work....However if we break the problem up into sections we can make things easier for ourselves.
|Block Diagram of Function Generator|
Anyway...so for our function generator we need a way of generating waveforms and a microprocessor to control it and some way of interacting with the microprocessor to tell it which wave we want (sine, square or triangle), how big it needs to be (Voltage) and how often the wave repeats (Frequency).
So the first part of the diagram we need to make is the wave generator. There are thousands of different circuits for doing this and all of them have their place. Look in any electronics text book or online encyclopaedia for oscillator and you will find mention of a waveform generator circuit. One of the more popular circuits is called a Wien Bridge Oscillator. The modern circuit is based on a very popular Master's thesis by some bloke named William Hewlett. He went on to form Hewlett Packard and became incredibly famous and rich! Here is the wikipedia entry:
But I'm not going to make a Wien bridge oscillator for this function generator. I'm using a component from Analogue Devices called a Direct Digital Synthesis (DDS) generator. The one I'm going to use is the AD9835 and here is the datasheet:
The reason I'm going with this device is because it comes already laid out on a breakout board from Sparkfun Electronics, although I bought mine from Proto-Pic
I like this breakout board for two reasons. It has a good frequency output range from 1Hz to at least 25MHz and it is easy to control via the arduino. The reason this is the case is because an excellent library has been written to make the control very simple! It was written by Lachlan Gunn and can be downloaded here:
It's an excellent library. I wish I had the programming skill to write similar libraries. So having downloaded the library and read the instructions and made the connections specified, I switched everything on....It worked straight out of the box! Here is the obligatory youtube clip showing it working!
In order to properly use the DDS breakout board we will need to filter out the fundamental 50MHz clock signal which is on the breakout board. The next post will be on filters! If people would like to know how the AD9835 device works then this is the site for you:
http://alternatezone.com/electronics/dds-art.htm - Kudos yet again to David Jones of the EEVblog.
Check out all of his stuff and his videos here: EEVBlog
Best of luck and enjoy - Langster!