I finally had time today to assemble the FG085 function generator kit that I bought last September (it’s been a busy 9 months). I bought the kit from Sparkfun, on sale for $38 (it is now $50 from them or $47 from jyetech, who make the kit).
The assembly is fairly simple, as they’ve already done all the surface-mount soldering, leaving only the through-hole parts to solder—about 200 solder points. I managed to make two stupid mistakes that required unsoldering—I soldered one of the 21 push buttons on the wrong side of the board and I forgot to peel the protective strip off the LCD display before soldering the BNC connector in place. The BNC connector is strangely mounted, so that the front panel can’t be removed without unsoldering the connector. Both errors were ones I realized right after I made them, and were fairly easy to fix.
The function generator seems pretty easy to use, though not all the user interface is intuitive, as there are well-hidden features like that pressing “.” twice allows you to change the duty cycle of the square wave. Jyetech has pretty good documentation on-line though, including a user’s manual and a schematic for the function generator.
They do direct digital synthesis with a 2.5MHz sampling rate and an 8-bit DAC, then scale the amplitude and add an offset. At 40Hz and below they drop the sampling frequency to 10kHz,in order to get a more precise frequency. They only claim to go to 200kHz (12.5 samples per period), but their low-pass filter at the DAC has a corner frequency of 1.426MHz (C=180pF, R=470Ω+150Ω) if their schematic is right. (Update 2015 Jun 30: that’s from Schematic_085F.pdf—from Schematic_085G.pdf, the corner frequency should be 713kHz.) So they are not really filtering down to 200kHz, and the software allows the user to enter up to 999,999Hz (in steps of 1 Hz).
I checked the amplitude of the output using my Bitscope USB oscilloscope, with the FG085 set for 5V peak-to-peak and 0V offset:
At the higher frequencies the waveform is far from sinusoidal (3 points per period at 833,333Hz), and the beating due to phase change if the period is not exactly a power of 2 times the sampling period makes for pretty dancing patterns on the oscilloscope, but the amplitude is hard to read. I think that the bandwidth is about 400kHz, though the distortion of the waveform is pretty bad when the number of samples is tiny, so treating the signal as a sine wave is a bit dubious above about 100kHz. Because the bandwidth is so different from what I compute from their schematic, I suspected that either their resistor value or capacitor value in the low-pass-filter is misreported. A 2kΩ resistor instead of a 470Ω resistor for R9 leading into a 180pF capacitor C12 would match the behavior better (or C13 was populated despite the schematics). It is a little hard to figure out the size of capacitors on the PC board (they’re not labeled), but the resistor R9 does appear to be 470Ω, so I’m still a little mystified where the 400kHz corner frequency is coming from.
I don’t know for sure whether the inaccuracy in the voltage measurements at low frequency is from the frequency generator being miscalibrated or from the Bitscope’s lack of calibration, but I suspect the function generator. If the 2V peak-to-peak 1kHz signal out of my Kikusui oscilloscope is accurate (a bit questionable), then the Bitscope is only reading 1% high, so the voltage errors would be in the function generator.
I tried doing an FFT with the Bitscope, to see how much harmonic distortion there is (limited by the 8-bit resolution of both the function generator and the oscilloscope. The oscilloscope reports components at the desired frequency, but also at 2.5MHz ± the desired frequency. These two sidebands are about 40dB down, which is not too bad for an 8-bit DAC.
Incidentally, I noticed that they used a very cheap and noisy DAC—just a resistor ladder with ordinary output pins from the processor driving it. Looking at a low-frequency waveform, there seems to be a glitch of about 30mV (on a 2V peak-to-peak signal) at the 8 transitions that correspond to the top three bit positions. This sort of non-linearity error is what you would expect from the very low-quality DAC they used. On the Bitscope FFT, the errors are near the noise floor, but there is a consistent set of 9th, 11th and 13th harmonics about 50dB below the fundamental. The FFT also points out a 3rd harmonic about 40dB down from the fundamental.
I suspect that they could have made a better function generator for about the same price by using a more modern microprocessor—Freescale’s KL25Z includes a 12-bit DAC with a 550kHz bandwidth, with much better non-linearity than what they achieved—the chip is a bit more expensive, but would add at most $1 to their parts cost—it may actually be cheaper, if it replaces some of their other parts as well.
They adjust the gain and offset in amplifiers after the DAC, but it looks like they just use a 100-position digital potentiometer for the gain and PWM from the ATMega168 for the offset. They monitor the output voltage (before a 22Ω output resistor, not directly at the output), and adjust the offset and voltage to get the peaks more or less right. Given that the digital pot has only 100 positions, the accuracy on that can’t be much better than 1% of the largest amplitude setting, or 0.1V.
For under $50, I did not expect a super-high quality function generator, and I didn’t get one, but FG085 looks like it might be usable for a number of less critical applications. I’ll probably try doing the labs in the book using it—most of them don’t rely on a very high quality sine wave, nor a very high frequency. The ability to set the DC offset to 0V makes this a much more useful function generator than the one built into the Bitscope or the analog Elenco FG500 that I’ve talked about before.