3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Arbitrary waveform generator, for ~20$

Arbitrary waveform generator, for ~20$
An arbitrary waveform generator (AWG) is a useful but often expensive piece of test equipment (ebay it for laughs). Use it to determine component frequency response, generate carrier signals, as an LCR meter if you have a scope, tune resonant circuits, play sounds, or just draw cool graphics on your scope. It has many other uses as well, both benign and sinister, use your imagination (at your own risk)!

This project will describe how to make an AWG that can produce decent sine waves up to about 2Mhz, and of course all kinds of other waveforms, for around 20$ (assuming you own an stk500 or equivalent programmer).

This project assumes the builder is familiar with assembly language, atmel microcontrollers and their programmers, oscilloscope use, and basic electronics. All novel ideas and schematics are released under the GPL, all non-schematic images are released under a Creative Commons license.

Parts:
2x 10 pF capacitors
1x crystal, preferably 16Mhz, I used 14Mhz
1x 5v voltage regulator
2x 9v battery
7x 50kohm resistors, 1%
10x 100kohm resistors, 1%
2x 4.7kohm resistors
1x 100kohm potentiometer
1x 10kohm potentiometer
1x OPA2132 op-amp, or any op-amp you're familiar with
2x 220uF electrolytic capacitors, rated 18v or higher

Finally, you will need the datasheets for the atmega16-16pu, and your opamp of choice. In the amplifier circuit, I labeled the pins by function and not by number, the datasheet will show you which pins are which (I used the same naming scheme as the datasheet).

The original html version of this project is available at http://legionlabs.nullnode.com/

The photo demonstrates a 1Mhz sine wave generated by the device.

 
Remove these adsRemove these ads by Signing Up
 

Step 1First circuit.

First circuit.
This circuit contains the microcontroller and the digital to analog converter (called an R/2R network) which generates the waveform. The waveform generated is between 0 and +0.2v, the 100kohm resistor and potentiometer act as a bias to make it between -0.1v and +0.1v.

VERY IMPORTANT: Unless you want to include switches that change the waveform type/frequency... I didn't because it involves a performance tradeoff... you will be reprogramming this microcontroller frequently. Either be fancy and include ISP, or do what I did: solder an IC socket to the circuit board, and also lodge the microcontroller into another IC socket... the electrical contact between the two IC sockets is just fine, and an IC removal tool lets you pull it out with minimum force.

Alternatively, spend an extra few dollars and get a ZIF socket. If I were to redo this project, this is what I would do.

When this stage is complete, you have a functioning waveform generator... which you should proceed to test with your scope (test the bias!). A later step will include a link to a useful site that has assembly code compatible with this microcontroller that will generate various waveforms.

Next, we will ad an amplifier stage to increase the signal voltage to useful levels.
« Previous StepDownload PDFView All StepsNext Step »
32 comments
Sep 14, 2010. 3:48 AMaafram says:
you can use the arduino IDE to program the AVR easily. Also you can use the PWM to replace the R-2R DAC.
Sep 6, 2009. 10:22 AMBlackice504 says:
love it thats all a Dlink is good for a case lol.
Aug 14, 2009. 4:33 AMinsmac says:
This illustration shows (or implies) that there are two 9 volt batteries or voltage sources. The common terminal as shown would be the ground (or more appropriately called circuit common). If you used a single 18V source and the circuit shown, then the common terminal created by the voltage divider would be referred to as a virtual ground (or circuit common).
Aug 14, 2009. 7:33 AMinsmac says:
Switchers in sensitive circuits are always an issue. Special filtering is required, or a switcher designed for noise free DC (which just means the filtering is in the switcher)...read more $$. ;-)
Jun 23, 2008. 5:50 AMnickbuls says:
can you hack up an AM transmitter to it and put it on the frequency your transmitter is so your transmitter can send further?
Jul 15, 2009. 6:31 PMUnit042 says:
Forgive my ignorance, but what about an amplifier where the antenna was, then a different antenna on the ouput of that?
Jul 19, 2009. 7:35 PMUnit042 says:
Yes, devils in the details.... A guide as in, a how-to manual, or a radio lingo guide? Would the aforementioned circuit work for 1MHz? (or close thereto?)
Jul 25, 2009. 10:44 PMUnit042 says:
I don't like super-high frequency stuff that requires waveguides... the physics makes my head hurt! But I respect those who understand stuff like this....
Jun 1, 2009. 8:43 PMdrj113 says:
Are you sure that the dip is caused by the loop function I would have expected the dip to occur every cycle, not every 10 cycles. Is there a watchdog that has to be reset? This is a great, simple project - well done!
Nov 1, 2008. 10:17 AMjunits15 says:
what is that white goop u used to glue down the wires?
Nov 3, 2008. 12:44 PMjunits15 says:
oh because it looks very similar to the white goop that i found inside a computer PSU, it made it really hadr to take apart
May 1, 2008. 4:07 AMPKM says:
Does insulting DLink with a high-frequency pulse generator make it an RF burn?

I apologise profusely.

This is a neat demonstration of just how much you can do with simple microcontrollers. My only reservation is that fine control of the frequency appears to be impossible- can you replace the crystal with an adjustable frequency clock? Also, I'm not quite sure I understand how your circuit is generating the signal voltages- does it provide analog outputs or is the ladder of resistors on the first circuit diagram used as a potential divider somehow?
May 1, 2008. 11:12 AMPKM says:
So.. you output the value in 8-bit binary and the resistor network acts as a DAC to turn it into a voltage level? That's really clever- is it an established technique? My GCSE electronics (last time I did stuff like that) is fading into the mists of time...
Apr 30, 2008. 4:58 PMburzvingion says:
Nice instructable, very thorough. I think you've misused the term virtual ground however. In my experience, virtual grounding refers to using a +Vcc/2 bias on the signal so that a single-ended supply can be used. In your schematic, you're using a double-ended supply (presumably two 9-volt batteries), meaning it's not really a virtual ground. Someone else wanna confirm me on this?
Apr 30, 2008. 6:41 PMgmoon says:
As it's pictured, it is a "false" or "virtual" ground.

But as pointed out, with two batteries you've got a bipolar supply with the ground being the connection between the two batteries (wired in series.)

You knew that already, of course....

Did I miss the Atmega source code, or is that on an outside link?
May 1, 2008. 4:29 AMgmoon says:
Hey, not an engineer here, either. The way I figure--if it works, and you know why it works, that's enough.

Thanks, I'll check out the source when you post it...
Apr 30, 2008. 8:41 PMincorrigible packrat says:
Heh, heh, heh. Knock the "L" out of Dlink...
Apr 30, 2008. 2:40 PMjdege says:
I've an old analog oscilloscope I never use anymore, that I keep around solely for setting providing atmosphere for my Mad Scientist's Lab on Halloween. I wired together a simple sine-wave generator, just to give it something to display. Your's sounds much more capable.
Apr 30, 2008. 2:26 PMWasagi says:
Wow! Great instructable! I'll try to do this sometime!

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
10
Followers
7
Author:legionlabs
I publish my failures and my successes, as my teachers have done before me. I am a member of Foulab, an independent, nonprofit research and engineering group in Montreal. Check out our webpage at...
more »