# Triangle waveform generator

This module generates a triangular waveform with variable frequency and adjustable minimum and maximum output voltage. It also generates a derived square waveform. The amplitude of the triangular waveform can be set with the two potentiometers V+ and V-. V+ can be set anywhere between +8.4 V and +12.8 V and V- can be set anywhere between -9 V and -12.8 V. Since both values also change the frequency, you should first set V+ to +10 V and V- to -10V. You can now set the frequency with FREQ potentiometer anywhere between about 1 Hz and 70 Hz.

## How it works

I created a Circuit Lab project that lets you explore the operation of this circuit.

OA1, C1 and R1 form an integrator which charges/discharges C1 with a constant current determined by R1 and the variable fraction of the voltage at the top of R5. The higher this current is, the smaller the time is to charge C1 and so the higher is the frequency of the oscillator. The current is constant because the current through C1 is the same as the current through R1 since the OP-AMP forces its negative input to stay at the same potential as its positive input. Since the positive input is connected to ground, the negative input also always stays at ground potential. This is called a virtual ground. The current through R1 is then simply given by Ucenter of R5 / R1. This current also flows through C1, because the inputs of an OP-AMP can be assumed to have infinite input resistance (no current flows into the inputs of an OP-AMP). How does OA1 hold its negative input at ground potential when voltage across C1 changes? It changes the potential at its output. If for example the voltage across C1 would make the negative input getting more positive, OA1 drives its output to become more negative, so in sum the negative input stays at 0 V.

OA2 is a comparator that compares the half (voltage divider R2, R3) of the voltage between UHiLow and UTriangle with 0 V. I the voltage difference between its positive and negative inputs is only a little bit positive, the output of OA2 runs to almost +15 V. Similarly if the input voltage difference is a little bit negative, the output of OA2 runs to almost -15 V. D1 and D2 allow us to set the point HiLow with R6 and R7 independently to some value below +15 V and above -15 V. These are the maximum voltages to which C1 can be charged and so they determine the amplitude of the triangular wave.

Let's assume C1 is discharged. Then every pin of OA1 is at 0 V. Then the positive input of OA2 is also at 0 V. But since there are always some asymmetries, there will be a small difference voltage between OA2s input pins. OA2 works in an open loop configuration so it amplifies this difference with it's extremely high gain. Let's assume the input difference is positive so OA2s output runs to +15 V. A fraction of this (+10 V) determined by R7 is now present at HighLow and OA2+ jumps to half of this, +5 V, forcing to stay OA2s ouput at +15 V. In the simulation diagram we are at t = 15 ms.

Now C1 is charged. OA1- would therefore become positive but OA1 compensates for this by driving its putput towards negative voltages. Because of this the voltage at OA2+ also drops. When C1 is charged to +10 V, OA1s output is at -10 V and OA2+ reaches ground. Soon as it goes below 0 V, OA2 immediately changes its output to become -15 V because the difference between OA2+ and OA2- is now negative. A fraction of this (-10 V) determined by R6 is now present at HighLow and OA2+ jumps to half of this, -5 V, again forcing OA2s output to stay at now -15 V. In the simulation diagram we are now at t = 22 ms.

Now C1 is discharged and recharged all the way up from +10 V to -10 V. To compensate for the change at OA1- OA1 drives its output from -10 V up to +10 V. As soon as it becomes +10 V, OA2- reaches 0 V, the input difference of OA2 becomes positive, OA2s output jumps to +15 V and the same process now repeats in the opposite direction. In the simulation diagram we are at t = 35 ms.

## Schematic and PCB

This is the original circuit as described in Dr. Vogels Home Brew Analog Computer .

## Project Files

The analog computer project files are hosted at GitHub:

Subdirectory:  TriangleGenerator

This page was last updated on 13. February 2016