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.
Continue reading “Cheap Function Generator Teardown and Improvement”
[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!
Continue reading “Build Your Own Function Generator”
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.
What do you do when you’ve got three broken function generators? Build your own, obviously. Since your workshop has already gone through three of these bad boys, you might find yourself repairing your build. Better not use any fancy ICs and go with a transistor only build.
When [Miroslav] sent in his ‘guerilla homebrew’ square wave generator, we were really impressed. With a relatively simple schematic that uses parts that could be salvaged from old radios, this is a real MacGyver build.
The generator is based around a simple astable multivibrator. It doesn’t provide sine waves, but it’s the easiest circuit to get working. The build started off with a quartet of 2N4401 transistors, but according to the datasheet and the venerable Tektronix 502A, these had a very bad rise time compared to 2N3904s.
[Miroslav]’s project generates square waves up to 2.22 MHz and pulses with a variable duty cycle from 1-49% and 51-99%. Output is either 5 Volt TTL levels or an adjustable 0-3.38 level. The generator is exactly what [Miroslav] needed, so that makes it a great tool in our book.