A quick search on Ebay showed that good function generators on Ebay cost around £200. I think I can do a little better with the one I'm designing but we shall see.....There are some awful ones for a lot less and If I was in a real hurry I might consider buying one. Buying test equipment is always a problem for engineers and hobbyists alike.
The Sparkfun AD9835 breakout board cost £26.46. I don't think that's too bad a deal. It was quick to get up and running and produces a pretty good sine wave. I like the fact that I can use it with my arduino and it's a great learning project as to make a full function generator will use a lot of different electronic techniques to achieve what is required.
And now back to the Function generator...
The one thing that isn't provided on the AD9835 breakout board is a filter. Why does it need a filter? Well.....you could use it as is without one but prolonged use will show that it's output is tainted with the 50MHz source clock coming from the reference oscillator on the breakout board....That sounded very technical! What does that mean? The tainted bit means that the sine wave at the output will look very square and choppy at certain frequencies because of interference from the reference clock. In order to get the AD9835 DDS chip to work it needs a 50MHz reference clock which is a square wave pulse which oscillates (changes state from High to Low) every 0.00000002 seconds or 20 nanoseconds. It is better to have what is known as a spectrally pure output which is an output with only the signal we want and not the 50MHz reference clock.
|Oscilloscope Screenshots showing the output of the AD9835 when it's output hasn't been filtered.|
|Spectral Output of the AD9835 when unfiltered.|
Electronic Filters are special circuits that are used to purify electronic signals. It's a way of removing the parts of the signal we don't want leaving the information that we do want. A real world example of a filter is a pair of sunglasses. We don't want our eyes to be dazzled by bright light so we filter the bright light out using some darkened lenses.
Anyway the AD9835 breakboard needs a filter to remove the 50MHz reference clock. When I specified what I wanted the function generator to do I specified that the frequency output range needs to be from 1Hz to 10MHz. This being the case we can now design a filter that allows all signals to pass through the filter up to 10MHz but completely blocks any signals above 10MHz. To give us some margin I'm going to design the filter to cut off (stop allowing signals through) at about 15MHz - this is known as the corner frequency. The filter is known as a 'Low Pass Filter' - this is because it allows low frequency signals through but blocks (attenuates) high frequency signals. Other types of filters are available including High Pass, Notch, Bandpass etc.
Filters is a huge subject in electronics and there are several thousand books and tutorials on the subject. There are so many different types of filter that I can't cover them all here. If people need more information on filters then the following sites might be of some help:
For the AD9835 breakout board I'm going to design a passive filter known as a 'Chebyshev' filter. It is a passive filter made of inductors and capacitors. It's called Chebychev because it uses polynomials found the by the Russian Mathematician Pafnuty Chebyshev. The mathematics involved are incredibly complicated. I'll be honest....I didn't go through it all and do lots of Maths. I used an online filter calculator like this one:
I used the one built in to National Instrument's simulation software - Multisim. It came out with the following circuit. I changed the values to suit what I had available.
|AD9835 Filter circuit with values|
Ignore the 0V DC source - its present to allow me to simulate the circuit. What I'm going to simulate is what will happen at the output of this circuit if we place a sine wave at Vin with a frequency from 1Hz to 50MHz. This is where circuit simulators are very useful as they can tell the design engineer how a circuit is going to respond before building it. It gives confirmation as to what should happen. Simulators are also very useful because you can change component values and see what that changes to the circuit's function. All good design engineers should use simulators - it's the best way to quickly check the function of a circuit.
So here is the result of a frequency sweep from 1Hz to 50MHz:
|Chebychev Filter using 4.7uH Inductors and 100pF Capacitors|
The lower trace is the phase relationship between the input signal and the output signal. What that means is that at around 7MHz the phase between the input signal and output signal reverses. In our case this doesn't really matter but it might be of interest if you need to ensure that the input signal is always in phase and not reversed (audio circuits....perhaps).
So....if we construct this filter carefully using the above components and a sensible PCB layout we will get the above response.....Well guess what I did and here it is:
The above screen shot seems to correlate quite nicely with the trace from the simulation. This means that the filter works and my layout was sufficient to provide the correct response. Not bad seeing as that was incredibly rushed and I paid no attention to component placement! Sometimes I'm lucky!
Here is a video showing the testing:
I wish I could afford a Vector Network analyser for my own nefarious purposes! For some reason my missus won't let me buy one...at £25000 I suppose I understand! Vector network analysers are a very specialised piece of electronics instrumentation used for assessing the frequency response of electronic circuits and cables. The one I used in the above video has a frequency range of 100kHz to 8GHz! We use it at work for testing antennas, filters, amplifiers and coaxial cables.
So now that we have proved this part of the design, I'm going to add this filter circuit to the output of the AD9835 breakout board. This will prevent the reference clock interfering with the output. The next part of the circuit to design will be the amplifier stage.
Cheers for reading - take care