Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

FunctionGenerator 008b 

Often in synth-DIY trouble-shooting and/or circuit experimentation, a signal source with variable frequency and amplitude is just what you need to test a circuit’s behavior. If the signal source has a variety of wave-shapes, it will serve in more scenarios.

This article will present a 9V battery-powered function generator that outputs sine, square, and triangle waveforms. The frequency is adjustable from about 20 Hertz to about 11KHz and the output level can be varied from 0 to about 3V, peak to peak.

I kept the output level within this range as the circuit is essentially powered by a virtual +/-4.5V power supply and I wanted the unit to continue to function as long into the 9V battery’s depletion as possible. The circuit drains about 11mA when used with the LED shown in the schematic.

However, if you buy a power switch with an obvious passive indication of state, you can leave the LED off and the circuit will draw about 9mA. In either case, you can count on a good long life on a 9V alkaline battery.

The signal can be injected into the input of a VCF or VCA circuit under development or a mixer or an amplifier input you want to test. Since it’s battery powered you can leave one in your toolbox.

Here is the circuit.

REVISED battery function generator nov 2013 

A little housekeeping info first: In my schematics, a circle with letters in it is used to indicate both intra-page and extra-page connections. Consider all circles with the same letters connected together (even across pages in a multi-page schematic). If I showed all those points running back to the power supply, the schematic would be really hard to read. The circuit points labeled with Xn or other tokens (e.g. TRI, OUT, X1) connect from the circuit board to the panel components. You will see these names again when you look at the panel wiring diagram. I use the straight and curved line capacitor symbol for all capacitors. If a capacitor is polarized, I add a + (plus) symbol next to the straight line in the capacitor symbol (e.g. C1, C3).

Let’s look at how this circuit works. We’ll start with the simple battery power supply. We split the battery’s voltage in half with two 4.7K resistors: R1 and R3. The unit’s virtual ground will come from the junction of the two resistors. The best way to understand this is to see the supply as delivering plus 4.5V from the battery’s positive terminal, minus 4.5V from the battery’s negative terminal, and a virtual ground from the junction of resistors R1 and R3. The 220uF aluminum electrolytic capacitors C1 and C3 are used as charge reservoirs for the two halves of the supply. The points BP (battery positive) and BN (battery negative) indicate the power supply connections throughout the schematic. The two points also labeled BP and BN are PC board donut labels to which the battery’s power, after being switched via S1, is applied.

To LED or not to LED, that is the question. While LEDs suck power, so does forgetting to turn the unit off. The choice is yours. Use a switch that has a nice “on” state indication and remember to turn the power off—or use a LED’s cheerful glow to remind you that the unit is on and use a bit more current—but remember to turn it off.

So, if you use LED1, it simply illuminates due to being forward-biased when the unit’s power is turned on. Use a high efficiency LED because it’s not getting a lot of current, but you’ll see it for sure. If you want LED1 to be brighter (and the battery to die sooner) reduce the value of R2 to, say, 2K or maybe 1.5K.

We are using U1-A (¼ TL074 Quad Op Amp) as an integrator and U1-B (¼ TL074 Quad Op Amp) as a comparator. Together they make up the heart of the function generator’s oscillator. On power-up, the output of U1-B (our comparator) will always be either saturated high or saturated low. We’ll consider that it powered-up saturated low as we discuss its operation. On power-up, the output of the op amp used as our integrator (U1-A) will be at ground level, but will immediately start to ramp high under the influence of U1-B’s output. U1-B’s low output is fed back to its non-inverting input through series connected 62K resistors R5 and R6. Two 1N914 diodes are connected between the R5/R6 junction and ground. D1′s cathode is connected to the R5/R6 junction and D2′s anode is connected to the R5/R6 junction. The other ends of the diodes are connected to the circuit’s virtual ground (we’ll just say ground from now on).

What are diodes D1 and D2 doing? They are controlling the voltage at the R5/R6 junction so that as U1-B’s output changes from positive saturation to negative saturation, the voltage at the R5/R6 junction changes from a forward diode drop above ground (about +600mV) to a forward diode drop below ground (about -600mV).

We do this so that the voltage fed back to the integrator is the same magnitude in both directions. The reason we don’t just use the output of U1-B is because its positive and negative saturation voltages are not quite the same. Since the current fed to the integrator via the Fine and Coarse Frequency controls and R10 depends on the magnitude of the voltage coming from the comparator section, it is important that the voltage be the same in the positive and negative directions or else the integrator’s triangle wave-shape will suffer from poor side-to-side symmetry. Instead of looking triangular, the wave would appear skewed (more sawtooth or ramp wave looking).

The low initial level on the output of U1-B results in current flowing from the inverting input of the integrator U1-A pin 2 (via 62K resistor R10, 100K coarse frequency pot R9 and 100K fine frequency pot R4) toward the -600mV voltage level at the R5/R6/D1-k/D2-a junction.

In response, the output of the integrator (U1-A pin 1) ramps up until the current flowing into comparator U1-B’s non-inverting input via 180K resistor R7 overcomes the current flowing towards the -600mV level on the R5/R6/D1-k/D2-a junction via 62K resistor R5.

When the output of U1-A ramps high enough (about +1.7V), the output of comparator U1-B switches to positive saturation. Now the R5/R6/D1-k/D2-a junction level is at +600mV and current flows toward U1-A’s inverting input via R4, R9, and R10. The output of the integrator ramps low until its voltage is low enough (about -1.7V) to pull enough current through R7 to overcome the current flowing through R5 from the +600mV level at the R5/R6/D1-k/D2-a junction. At that time, the output of the comparator shoots rapidly to negative saturation and the process continues resulting in triangle-wave oscillation at the output of integrator U1-A and square wave oscillation at the output of comparator U1-B.

The 100K Coarse Frequency potentiometer R9 is used as an adjustable voltage divider to control the level of the voltage, which causes current to flow into or out of R10 and subsequently into or out of the inverting input of the integrator. When R9′s wiper is adjusted in the direction of R4, the input of the integrator sees more voltage (thus current) and the frequency goes higher. When R9′s wiper is adjusted toward R13, the input of the integrator sees less voltage (thus current) and the frequency is lower. Resistor R13 (3K) sets the limit for how low the voltage can be adjusted and still cause the integrator to ramp properly when potentiometer R9 is adjusted all the way down.

The 100K Fine Frequency control (R4) simply allows more or less current to flow between the output of the integrator section and the inverting input of the comparator as it is adjusted. It is optional and can be eliminated if you don’t need fine frequency control. If R4 is not used, simply connect point X1 to the top of potentiometer R9′s resistive element.

Switch S2 is used to connect a larger capacitor (C2 .0022uF) in parallel with C4 (100pF) in order to change the range of the oscillator from high (S2 open) to low (S2 closed). When a larger capacitor is used in an integrator, the ramp rate becomes lower. When S2 is open, the function generator’s frequency range is about 400 Hz to 10KHz. When S2 is closed and C2 is in parallel with C4, the frequency range is lowered to about 16Hz to 590Hz Thus the function generator has a nice wide range of frequency adjustment.

We see a nice triangular wave-shape at the output of U1-A (circuit point TRI) that oscillates about the unit’s virtual ground with an amplitude of about 3V, peak to peak. We take the square wave appearing on the output of U1-B and reduce its amplitude to about 4V peak to peak while maintaining a low impedance source by using U1-C to apply fractional inverting gain (circuit point SQR). The 22pF ceramic capacitor across resistor R15 is there to reduce a slight rising edge ringing that appears on the output of U1-C without it.

To simplify the circuit and lower current consumption a bit, you can eliminate the sine wave functionality if desired. Simply eliminate the LM13700 and associated components and change the output wave selection switching to only select between square or triangle waves. You’ll use one less SPDT switch as well.

However, I find the sine wave useful for trouble-shooting, which is why I included it. To change the triangle wave into a sine approximation, we overdrive the non-inverting input of U2-A LM13700 Dual Transconductance Op Amp to take advantage of the non-linear distortion it provides. This distortion tends to curve the top and bottom of the triangle waveform inward, giving it a sinusoidal appearance. The triangle waveform is fed from the output of U1-A to the non-inverting input of U2-A (pin 3) via 100K trim pot R16. Trim pot R16 is used to adjust the amplitude of the signal appearing at U2-A’s non-inverting input.

We are purposely over-driving the input so R16 adjusts the amount of distortion the signal undergoes. Too little and the signal looks triangular; too much, and the signal looks too flat on the top and bottom.

You’ll be able to see (and hear) when it’s just right. The 100K trim pot R24 is used to apply an adjustable bias current to the non-inverting input via 200K resistor R19. Thus trimmer R24 is used to adjust the top to bottom symmetry of the sine wave-shape. The 100K trim pot R17 is used to apply the bias signal to the transconductance op amp U2-A and thus controls the amplitude of the sine wave-shape. We use the darlington buffer amp provided on the LM13700 chip to buffer the output.

Resistors R22 (220K) and R23 (680K) bias the output of U2-A so that the sine wave oscillates about the unit’s virtual ground. Resistor R18 (10K) converts the current from U2-A pin 8 to voltage. The SIN circuit point comes from U2-A pin 8. The other half of U2 (U2-B) is not used in this circuit.

The SQR, TRI, and SIN circuit points are switched via S3 (SPDT switch) and S2 (SPDT switch) and dropped across R11 (100K potentiometer) that is used as an adjustable voltage divider. The portion of the selected waveform picked off of R11′s wiper is applied to the inverting input of U1-D via 10K resistor R12. U1-D’s 12K feedback resistor gives it a gain of 1.2, which gives each waveform a bit of amplification. This scheme delivers the level adjusted selected waveform from the low impedance output of U1-D.

Capacitors C6 through C9 are .1uF ceramic caps that should be placed close to the power pins of both ICs (U1 and U2) during circuit construction.

Here is the component part list. All caps should be rated 16V or higher. I list a RadioShack case and perf board that should accommodate the project nicely.

Battery Powered Sine, Square, and Triangle Wave Function Generator Project Parts List

You can easily build this circuit on a small experimenter board or etch a PC board. In the coming months, look for this project on the MFOS website. We will be offering a professionally manufactured PC board for this project as well as a parts kit.

Qty. Description Value Designators
1 LM13700N Dual Transconductance Op Amp LM13700N U2
1 TL074CN Quad Op Amp TL074CN U1
2 1N914 Sw. Diode 1N914 D1, D2
1 General Purpose LED LED LED1
3 Linear Taper Potentiometer 100K R4, R9, R11
4 Resistor 1/4 Watt 5% 10K R12, R15, R18, R20
1 Resistor 1/4 Watt 5% 12K R8
1 Resistor 1/4 Watt 5% 180K R7
1 Resistor 1/4 Watt 5% 1K R21
1 Resistor 1/4 Watt 5% 200K R19
1 Resistor 1/4 Watt 5% 20K R14
1 Resistor 1/4 Watt 5% 220K R22
2 Resistor 1/4 Watt 5% 3K R2, R13
2 Resistor 1/4 Watt 5% 4.7K R1, R3
3 Resistor 1/4 Watt 5% 62K R5, R6, R10
1 Resistor 1/4 Watt 5% 680K R23
3 Trim Pot (Bourns 3296W or equivalent) 100K R16, R17, R24
1 Capacitor Ceramic .002uF C2
4 Capacitor Ceramic .1uF C6, C7, C8, C9
1 Capacitor Ceramic 100pF C4
1 Capacitor Ceramic 22pF C5
2 Capacitor Electrolytic 220uF C1, C3
2 SPDT Switch SPDT S3, S4
2 Switch SPST SPST S1, S2
2 Banana Jack Banana Jack J1, J2
1 Battery 9V Battery B1
1 Radio Shack Project Enclosure (6x4x2″) Cat#: 270-1806  
1 Radio Shack PC Board with 780 Holes Cat#: 276-168  
1 Radio Shack 9V Snap Connectors Cat#: 270-324  
1 25′ Roll of 22 AWG Stranded Wire 25 Feet  
3 Potentiometer Knobs Knobs for Potentiometers  

Well, there you have it, a simple but useful 9V battery powered function generator that will come in handy time after time. This would make a great gift for any of your electronics enthusiast friends. In the next installment, I will provide the construction details, including PC layouts and front panel wiring ideas.

In the meantime: keep imagining, keep inventing, stay ingenious!

Ray Wilson is the author of Make: Analog Synthesizers and the madman behind the very popular Music from Outer Space website.


Related

0 Responses to Make a 9V Battery Powered Function Generator

Related Supplies at Maker Shed

Follow

Get every new post delivered to your Inbox.

Join 26,569 other followers