Are you sick of 555 timers? I sure am. That's why I decided to build a semi-decent function generator as my term project in my analog electronics course. This design is capable of producing a square, triangle, and approximate sine wave reliably up to a frequency of around 300kHz.

Make It Real Challenge
This project has been entered in the "Make it Real Challenge", which awards a 3D printer to the winner. "To enter, post an Instructable that shows how to turn a virtual item into a tangible object." I believe this project qualifies, since I spent a significant amount of time modeling the circuit on my computer before going on to the build stage. This Instructable does cover how to model a circuit (final step) and it does require the etching of a Printed Circuit Board based on that computer model. If you like my project, please rate it and vote for me!

Yes, there are chips available that achieve MUCH better results with a simpler circuit, but they are essentially "black boxes" that use digital methods to convert a voltage to a frequency. This circuit is fully understandable with algebra and rudimentary calculus and op-amp knowledge. Since this project is for an "analog electronics" course, this fit the bill.

Here's a breakdown of roughly how long it took to complete each stage of the project:
  • 10 Hours: Initial design, including EagleCAD entry, board layout, and computer simulation.
  • 3 Hours: Part sourcing.
  • 5 Hours: Project box design, prep, painting, and labeling.
  • 1 Hour: Initial PCB component placement
  • 2 Hours: Connecting the PCB to the control panel.
  • 20 Hours: Troubleshooting and component revision. Seriously.
  • 1 Hour: Calibration.
  • 1 Hour: Characterization.
This doesn't include the time I spent thinking about it while engaged in some other activity. I have a lot of experience troubleshooting lab equipment so the amount of time it took me to get this thing working surprised me. All the revisions I made are included in this Instructable, so it should work right off the bat, but be prepared to work a little.

This is nothing you'd want to rely on if you need any kind of precision, it's just a cheap, quick and dirty source of time-varying signal. Another reason I wanted to make a function generator is just to have another piece of ghetto lab equipment worthy of my growing collection.

Step 1: Safety

This is a relatively complex electronics project that utilizes a lot of simple concepts and methods that all need to come together correctly. If you've never worked with electronics before, you should probably try some other project before delving into this one unless you're extremely ambitious. For those of you with a few years of electronics background, this is an exceedingly simple project.

This project utilizes Mains power of 120VAC, and is therefore EXTREMELY DANGEROUS for anyone that doesn't know what they're doing. Please have someone around that can administer CPR or call for medical help when you are experimenting with mains power.

There are other various risks associated with electronics, such as exposure to harsh chemicals (PCB etching and paint), lead (in solder) and hot tools (soldering irons).

This Instructable is provided for entertainment only and should not be used as a source of official information by anyone. Any and all damages incurred by the implementation of the information in this publication are the sole responsibility of the end user.
<p>I see that you use 2 quad-opamp packages, but use only 6 opamps. Something that's not in your instructable, but is somewhat important: You should properly terminate the unused opamps, or it will draw a lot of current, and the other opamps in the same package will become unstable. To terminate opamps, connect the non-inverting input to ground, and the inverting input to the output.</p><p>This will most probably make the troubleshooting, tweaking and calibrating a lot easier.</p>
<p>Thank you. I learned a lot from this instructable. I think this is one of the most instructive tutorials about op-amps.</p><p>I have a suggestion to add additional function to the function generator.</p><p>In the relaxation oscillator, change the resitors, add 2 diodes and connect pot1 differently. Now you can use pot1 to change the pusle with of the square wave, and use the triangle wave as a saw-tooth. Insert a potmeter in the non-inverting feedback loop to change the frequency.</p><p>I simulated this, so I don't know if it will work in practice.</p><p>Doing this will result in higher startup time and more drift in the sine wave, but that's not something a little tweaking can't fix.</p>
<p>Hi Laserjocky</p><p>Ok, I've got the generator working quite well thanks for your advice.</p><p>I've simulated it on java and LT-spice and got similar results so I think everything is ok.</p><p>I would like some advice on a few points,1)I need to pass a current of 20 amps through the transistors into the primary winding of a (12v)trafo {sinewave}</p><p>I've had a look at the data sheets of the TL084CN which can output 1.4-2.8ma,that drives the base of the transistors which in turn pass 250ma through a 35ohm resistor(Tip 31&amp;32 can pass3A).Correct me if I'm wrong.If I lower the resistance,more current passes through but it seems to be distorted on LT-spice,then you exceed the max output of the TL084CN.Are these more or less the limits of your generator?</p><p>Is there a way I can achieve this,i am working with Swagatam on his web page[homemadecircuitsandschematics} towards making an inverter</p><p>Regards Robin</p>
<p>You want to drive 20 amps? Adjusting resistor values isn't going to cut it. Never try to draw more than a few mA from these small op-amps or other chips in dual in-line packages (DIP). That's probably where your distortion is coming from. You need bigger transistors. TIP35C and TIP36C may be acceptable replacements for the TIP31 and TIP32, respectively, if you stick them on a massive heat sink. If you go much bigger you start having to pay close to $10 per transistor. Most inverters use high speed MOSFETs running on pulse-width-modulated square waves. You can get 50amp MOSFETs for about $5, but you really don't want to drive those with a sine wave. The problem with generating a sine wave at 20A with these transistors is that when the signal isn't completely on or off, the transistor will be dissipating a huge amount of power. 12V x 20A = 240W. These suckers are going to be HOT.</p><p>You also need to be careful about hooking the output of this directly to a transformer. Primary windings can have a few tenths of a Henry (unit) of inductance. If you try to drive AC through that with transistors alone you will probably destroy them immediately because of residual current in the winding trying to pass through transistors in their off state. At the very least you need a capacitor across the winding, but that presents its own problems. If you were using a fully offset square wave you could put a reverse biased diode across the winding and that would pretty much solve the problem, but that won't work for a sine wave with no offset.</p>
<p>Hi laserjocky</p><p>I made this function generator and it works.</p><p>The capacitor that goes to ground after IC2A,is it polar or non polar,text says non-polar diagram says polar?Experiencing a lot of noise at output of IC1B,Square wave at output of IC1A okay,am investigating.</p><p>Thanks,will keep you up-dated</p><p>Robin </p>
<p>Excellent! I'm glad to hear it's working for you. Yes, the 270pF capacitor should be non-polar. Use a ceramic capacitor there, one of the little brown disc ones. Anything close to 240p should work. That capacitor acts as a frequency cutoff to help smooth the sine wave at higher frequencies. It's not essential so anything close will work. But don't put in something as big as 2400p, or you might cut off too low of a frequency. <br><br>If pin 1 of IC1A is behaving well then pin 7 of IC1B should be ok. Make sure your connections on R3, R4 and TR2 are good. Sometimes trimpots (variable resistors) can have grit in them that makes the signal noisy. Try moving the knob a little. Also make sure you have the resistor values correct. The gain of IC1B should be g = R4/(R3+TR2). You want g ~ 1/10.</p>
<p>Hi Laserjocky</p><p>Wonderful design,Could you tell me what you connect across the internal gain select of the intergrator,I put a capacitor there as it must integrate?</p><p>Regards Rob </p>
<p>Yes, that's right. Further in the instructions I describe making a 2-deck rotary switch to change the capacitance across the INT GAIN SELECT pins and FREQ SELECT pins simultaneously. To get the full frequency range of this project to show up as a sine wave it's important to be able to change the capacitance of the integrator, since op-amp integrator gain is inversely proportional to both input frequency and capacitance, i.e. g = 1/(wRC).<br><br>In the schematic, R5 is the R considered in the gain term, C is implied by INT FREQ SELECT, and R6 is put in to eliminate non-ideal integration drift.</p>
<p>Hi Laserjocky</p><p>Wonderful design,Could you tell me what you connect across the internal gain select of the intergrator,I put a capacitor there as it must integrate?</p><p>Regards Rob </p>
great project ! awesome, i love it even more while you used the pc power supply casing for that project. that is cool and strong.
Thanks! Yeah these things are great. They'd be perfect for RF projects since they're basically a Faraday cage. I'm thinking of making a solid state tesla coil with one in the near future too. No more fried electronics.
<p>did you start the work on the solid state tesla coil, and is there a link to this work please thanks</p>
<p>I started working on it a long time ago. I managed to get a few small sparks from the top coil but nothing amazing. The project fell into disrepair after I got tired of blowing pairs of $5 MOSFETs every half hour. I think I had looked at https://www.instructables.com/id/Solid-State-Tesla-Coil/ for help in building it.</p>
Great Job! One question that I need clarified - on the 2 deck 6 position switch - not sure what you mean by &quot;notch the ring&quot;. Please explain further thanks <br>
I assume that your Eagle files were version 6 (opened the files with notepad++ and saw the leading XML declaration). I have a registered copy of eagle professional version 5 and have refrained from loading version 6 until I can cough up the license fee. I know that there is a freeware version but the danger for us users of version 5 is that (accidentally) opening a v5 file with eagle 6 will convert it to the V6 format and is non-reversible. Most of my files are too large to edit in freeware mode. So... will stick to you PDF files for now. <br><br>Last time I played with a function generator, I used the ICL8038 chip. Alas, that, the X2206 and the MAX038 are no longer available. That leaves only variations of what you designed. The new wave (pun intended) is frequency generation with DDS.
you can simply make a copy somewhere else and open the copy with V6, that way only that version is converted into v6... voil&aacute; problem solved
Let me know if you need a reprint of anything, I didn't take the version discrepancy into account.<br><br>Yeah, I've used a chip called an NTE864 that's similar to the one you listed. They're definitely easier to use if you just need a function generator. But I'm still trying to break the habit of wanting to understand everything :)
I am 73. I began fixing computers in 1960 - 64k memory, only paper tape input and output. Machine language programming.<br>My point is analog computers are the future! Digital computers will get faster and smaller but still must simulate analog situations, like traffic control. <br>You are on the right track! Stay with the basics and keep avoiding black boxes - they are dead-ends but are useful timesavers after you have mastered the basics.
awesome, man... i was looking for this kind of project for a while... one question: is posible to index or to change the freq selector to make it CV (voltage controller)?? could you help me ???
I'm not sure what you mean, you want something that changes the frequency based on a reference voltage instead of an RC rise time? I don't know off hand of an analog method for doing that, but there are digital-based chips called voltage controlled oscillators that do that kind of thing.
Great little project, although I'd guess you'd be getting cross over distortion without any bias on the two output transistors. If the generator is to be used as an audio gen' then perhaps you could use a TDA2030 chip or some lower power chip even, also have you solved the spiking problem, perghaps a 100nF cap across the supply lines as close to the TL084 as possible might do the trick.<br><br>Great again, all the best :)
Thanks shadow! That's true, I was expecting to see quite a bit of crossover at higher frequencies where the negative feedback begins to break down, but it actually does very well. The whole project functions almost flawlessly over the human audible range, and only gets really messy towards 100-200kHz. The spiking problem was greatly reduced but not eliminated by decreasing the order of magnitude of the offset potentiometer. The power transistors are kind of a hack so using a chip that's actually designed for audio output would probably be a good idea.

About This Instructable




Bio: I'm a graduate student in the Materials Science department of the University of California at Santa Barbara. I made these Instructables while I was ... More »
More by laserjocky:Digital Frequency Counter Learn Counter ICs Using an Arduino Analog Function Generator 
Add instructable to: