  2 July 2009
Author: Giorgos Lazaridis
Triangle Wave Generator

This is a very simple and yet useful circuit for generating triangle wave. It can be used for many applications where a medium+ preciseness triangle waveform is required. It can also generate non-symmetrical waveforms making it also useful in audio applications

Another feature that this circuit can provide is that it generates square pulses as well. Although this is not the reason that this circuit is designed and there are much better ways to generate rectangular pulses, you can use them from this circuit as they are in phase with the triangle wave.

Let's see it in action first!

The circuit

Following is the circuit diagram: It is designed to operate under 5 Volts, but different voltages can be applied as well, taking in account the maximum operation voltage of the OP-AMPS.

The two op-amps currently used are the known 741 chips. Different OP-Amps can be used as well, and also dual chips for simplicity. The right OP-Amp will operate as an integrator and the left as a comparator. When power is given to the circuit, the comparator drives it's output HIGH. This signal is driven to the integrator through the resistor R. The capacitor C then starts to charge gradually with RC time constant. While the capacitor is charging, the output of the integrator is also taken to it's low state with the same rate. When the positive input of the comparator, through the voltage divider that the 47K and 100K resistors perform, is driven low enough, then it changes state, and the integrator starts operating vice-versa.

It is easily understood that the frequency of oscillation will only have to do with the RC standard. That is true. A half cycle period is exactly the result of the R x C. A full cycle is twice this amount. Therefore, the frequency is:

 FOSC = 1 2 x R x C

In our test circuit, the R resistor is 22K and the C capacitor is 100nF. The oscillation frequency would be:

 FOSC = 1 2 x 22x103 x 100x10-9

And that would make 227,27Hz approximately. In real life, the frequency measured was about 218Hz. This is a rather small (tiny) difference between the theoretical and the practical value, considering that the resistors have 5% accuracy and so does the capacitor as well.

Elimination the DC voltage from the output

If you watch the output signal in a oscilloscope, then you will notice that the triangle waveform is above of the zero voltage. The offset is caused by DC voltage. In order to eliminate this voltage shift, you should add a capacitor in series to the circuit. The value of the capacitor should be chosen accordint tot he oscillation frequency of the circuit. For low frequencies, 1-100 Hz, a 4.7uF to 10uF would work just fine. Above you should consider using smaller capacitors. A wrong capacitor selection would cause signal distortion and sometimes will add significant resistance to the output. The following circuit demonstrates the previous circuit with a series capacitor. And the results of this circuit are as follows: As you can see, the waveform right after the capacitor is slightly above the zero voltage, where the waveform before the capacitor is several voltages above, due to the DC voltage shift. Now the output is easier to be used.

Further amplification

Due to the nature of triangle waveforms and their applications, most of the times the signal should be as high as possible, reaching up to the supply's voltage. For that and to be our circuit presentation complete, we have add a signal amplifier using a 2N2222 transistor. The transistor is connected right after the DC cutoff capacitor (naturally) and is fixed-biased with common-emitter connection: Let's take a look now to the oscilloscope for the results. I chose to show 3 channels simultaneously, all at the same ground level and all with the same amplitude division, so that the differences are clear: The difference is clear now. The yellow waveform is the output of the integrator. As you can see, the lowest point of the triangle is at about 2.4V above zero, and the highest is at 4volts (1.6V p-p). The green waveform comes right after the DC cutoff capacitor. Almost with the same amplitude (1.4V p-p), this waveform's lowest point is touching the zero line. Finally, the blue waveform. This is the output of the transistor. It starts from zero to 5 volts (5V p-p). Notice also that this waveform is inverted in comparison to the others and that is because the transistor amplifier is an inverting amplifier.

Now that you know the outputs, you can choose the circuit of your will! How to get one channel of your old PC speakers jack and use it as a probe

You may have already notice this tricky trimmer on the bottom left corner of the circuit. This is the symmetry adjustment. It is most possible the the circuit will not oscillate by the time you power it on!!! That would be normal. You need to adjust the symmetry at first.

If you have an oscilloscope, the symmetry can be fine adjusted with a straight-forward method. Just put your probe on the integrator or the transistor output and turn the trimmer, until you get a nice triangular waveform. You may also like to have a saw-tooth like waveform, right edge or left edge. This can be adjusted by the trimmer. For large changes, you should consider changing the 47K resistor, otherwise the circuit shall not oscillate. You should connect the speaker channel right after the DC cutoff capacitor

For those who does not own an oscilloscope, i have some good news. A pair of PC speakers would be your probe for the moment. Connect one channel of the speaker right after the capacitor and the ground of the speakers connect it to zero. DO NOT CONNECT THEM AFTER THE TRANSISTOR OR BEFORE THE CAPACITOR! I could not predict the results. Then, turn them on with the volume at 1/6. Start rotating the trimmer. According to the oscillation frequency that you have chosen, you will hear an audio signal like a "beep" or "booooooo" or something similar. Continue rotating the potentiometer. The signal will become louder and louder. After a while, the signal will start loosing intensity and become weaker. The position where the signal had the loudest sound, is the one that the triangular waveform has the most equal-sided form.

A last trick The rectangular pulses are NOT inverted in comparison to the triangular waveform taken from the transistor inverting amplifier

It has been already mentioned that this circuit can generate rectangular pulses as well. This is not the reason of creation though. There are better oscillators for this reason. Nevertheless, if you need square pulses in phase with the triangular waveform, the circuit can provide these to you.

The rectangular pulses are taken directly from the output of the comparator OP-Amp. That would be the left one in our circuit. The pulses have almost the same amplitude as the power supply. They have just a little bit voltage shift that most of the times does not cause any troubles. If there is a problem, a DC cutoff capacitor will solve it.

You should keep in mind that the rectangular pulses are inverted in comparison to the triangular waveform. This mean that when the triangular waveform is at it's most high level, the rectangular pulse is reaching zero and vice-versa. But if you compare them to the triangular waveform taken from the transistor amplifier, then you will notice that they are NOT inverted, and that is because the transistor performs an inverting amplifier.

Relative pages
• Basic transistor circuits
• The transistor theory of operation
• The voltage divider theory
• Op-Amp IC Pinouts
• Dr.Calculus: Op-Amp inverting amplifier calculator
• Dr.Calculus: Op-Amp non-inverting amplifier calculator
• Dr.Calculus: Standard resistor values calculator
• Dr.Calculus: Voltage divider calculator

 Name  Email (shall not be published)  Website Notify me of new posts via emailWrite your comments below:BEFORE you post a comment:You are welcome to comment for corrections and suggestions on this page. But if you have questions please use the forum instead to post it. Thank you.  HOT in heaven!  NEW in heaven! New Theory: AC electric motor working principle