In need of a waveform generator for another project, [David Cook] crammed out the old turntable to modify it for a handy hack: By adding a simple reflectance sensor to the pickup he turned it into a waveform generator that optically plays back arbitrary waveforms from printed paper discs.
In general, you get what you pay for, and when [Craig] picked up a cheap function generator off eBay, he didn’t expect much from it. But as he shows us in his blog post and a series of videos below, while the instrument lived down to his expectations, he was able to fix it up a bit.
Having spent only $100USD for the MHS-5200A, [Craig]’s adventure is a complete teardown and analysis of the function generator. While it sort of lives up to its specs, it’s pretty clear that some design decisions resulted in suboptimal performance. At higher frequencies and higher amplitudes, the sine wave output took on a markedly non-sinusoidal character, approaching more of a triangle waveform. The spectrum analyzer told the tale of multiple harmonics across the spectrum. With a reverse-engineered schematic in hand, he traced the signal generation and conditioning circuits and finally nailed the culprit – an AD812 op-amp used as the final amplifier. An in-depth discussion of slew rate follows in part 2, and part 3 covers replacement of the dodgy chip with a better selection that improves the output signal. We’re also treated to improvements to a low-pass filter that fixed a nasty overshoot and ringing problem with the unit’s square wave function.
If hacking the MHS-5200A seems a bit familiar to you, that’s because we covered another reverse-engineering exploit of it recently. That hack of the serial protocol of the instrument was by [WD5GNR], also known as Hackaday’s own [Al Williams]. Cheers to both [Craig] and [Al] for showing us what you can do with a hundred bucks and a little know-how.
[Scullcom] has posted the second part of his function generator build tutorial. [Scullcom] previously posted the first part of this build which covered the XR2206 monolithic function generator IC on which his design is based. In this part [Scullcom] covers the output stages and final assembly.
We’ve covered digital and analog function generator builds before. [Scullcom]’s design complements these well by providing a detailed description of the design he used, and has provided full schematics and code from the Arduino Nano used in this project. The design covers audio frequencies (~40Hz to 30KHz) with square, sine and triangle wave outputs. While the XR2206 can’t compete with modern DDS function generators, if you’re a hacker on a budget and looking for a fun project this may be just the thing for you. And even if you don’t decide to build the one, you might find [Scullcom]’s description of the output stage interesting.
Great project [Scullcom] and we look forward to your next build!
Signal generators are a useful piece of kit to have on your electronics bench. The downside is that they tend to be rather expensive. If you have $100 to drop on a new toy, the MHS-5200A is a low cost, two channel, 25 MHz generator that can be found on eBay.
The downside is the software. It’s an ugly Windows interface that’s a pain to use. The good news is that [wd5gnr] reverse engineered the protocol so you don’t have to. This means other software can be developed to control the device.
When connected to a computer, this function generator shows up as a virtual USB serial port. The documentation that [wd5gnr] assembled lists all the serial commands you can send, and what they do. If you aren’t into manually setting waveforms from a serial terminal (who is?) there’s a tool for doing that automatically on Github. This takes in a CSV file describing a waveform, and programs the generator to make it for you.
The software is also compatible with Waveform Manager Plus, a free GUI tool for defining waveforms. Putting this all together, you can have a pretty capable waveform generator for less than $100.
No one is sitting around their workbench trying to come up with the next great oscilloscope or multimeter, but function generators still remain one of the pieces of test equipment anyone – even someone with an Arduino starter pack – can build at home. Most of these function generators aren’t very good; you’re lucky if you can get a sine wave above the audio spectrum. [Bruce Land] had the idea to play around with DMA channels on a PIC32 and ended up with a function generator that uses zero CPU cycles. It’s perfect for a homebrew function generator build, or even a very cool audio synthesizer.
The main obstacles to generating a good sine wave at high frequencies are a high sample rate and an accurate DAC. For homebrew function generators, it’s usually the sample rate that’s terrible; it’s hard pushing bits out a port that fast. By using the DMA channel on a PIC32, [Bruce] can shove arbitrary waveforms out of the chip without using any CPU cycles. By writing a sine wave, or any other wave for that matter, to memory, the PIC32 will just spit them out and leave the CPU to do more important work.
[Bruce] was able to generate a great-looking sine wave up to 200 kHz, and the highest amplitude of the harmonics was about 40db below the fundamental up to 100 kHz. That’s a spectacular sine wave, and the perfect basis for a DIY function generator build.
[tari] sent in a tip about a MAX5214 DAC evaluation board AVNET is giving away this summer. The MAX5214 / MAX5216 is a neat little chip providing a 14 or 16 bit DAC with a serial interface in a tiny 8-pin package. [tari] thinks this eval board could be hacked into a function generator, and we’ve got to agree. Now, who wants to build one?
It’s entirely possible to take the MAX5214 chip and put it in a circuit with a small ARM uC, a display, and a few knobs, but that seems like a waste of time given function generators of this caliber are already available for about $60. It seems the most efficient hack of this dev board will be simply adding an amplifier to this board’s output and possibly programming a better interface than the current LabView software available.
If you want to tinker around with some free hardware and make something useful in the process, have a go at making a function generator out of this dev board. Be sure to send it in when you’re done.
Function generators are a handy bench tool to have around, and while you can usually cobble something together that works, it is much more handy to grab a device when you need it. Thats where this function generator sent to us by [Mohonri]comes in. Based around a ATTiny25 and a rail to rail op amp which is able to replicate frequencies from 1Hz to about 40KHz, in square, triangle, and sinewaves simultaneously.
The function generator also features independent amplitude control on each output. And it’s all on one palm-sized, single-sided PCB. The main part of the code is split into two parts: the main loop gets the inputs and constructs a waveform table in SRAM, and then an ISR reads that table and outputs it to one of the timers, which produces a PWM output, which is low-pass-filtered and then passes through a potentiometer (for amplitude control) and then to an op-amp before landing on a set of terminals.
Though its not 100% perfect, trading speed for a 6 bit resolution, it should be more than enough for most electronic projects. You can pick it up in kit form from the on-line shop, but schematics, software and PCB layouts are also available for download.