## Triangular wave generator using opamp

This is an interesting project for newbies. This article is about creating a triangular wave generator using opamp IC. There are many methods for generating triangular waves but here we focus on the method using opamps. This circuit is based on the fact that a square wave on integration gives a triangular wave.

**What are Triangular waves?**

Triangular waves are a periodic, non-sinusoidal waveform with a triangular shape. People often get confused between the triangle and sawtooth waves. The most important feature of a triangular wave is that it has equal rise and fall times while a sawtooth wave has un-equal rise and fall times.

To generate triangular waves we need an input wave. In this project, we are using square waves for input. Like triangular waves, square waves have equal rise and fall times so they are more convenient to be converted to a triangular waveform.

The main parts of this project are 1. A square wave generator 2. An integrator which converts square waves to triangular waves.

The circuit uses an opamp based square wave generator for producing the square wave and an opamp based integrator for integrating the square wave. The circuit diagram is shown in the figure below.

### Circuit diagram

The square wave generator section and the integrator section of the circuit are explained in detail below.

#### Square wave generator

The square wave generator is based on a uA741 opamp (IC1). Resistor R1 and capacitor C1 determines the frequency of the square wave. Resistor R2 and R3 forms a voltage divider setup which feedbacks a fixed fraction of the output to the non-inverting input of the IC.

Initially, when power is not applied the voltage across the capacitor C1 is 0. When the power supply is switched ON, the C1 starts charging through the resistor R1 and the output of the opamp will be high (+Vcc). A fraction of this high voltage is fed back to the non- inverting pin by the resistor network R2, R3. When the voltage across the charging capacitor is increased to a point the voltage at the inverting pin is higher than the non-inverting pin, the output of the opamp swings to negative saturation (-Vcc). The capacitor quickly discharges through R1 and starts charging in the negative direction again through R1. Now a fraction of the negative high output (-Vcc) is fed back to the non-inverting pin by the feedback network R2, R3. When the voltage across the capacitor has become so negative that the voltage at the inverting pin is less than the voltage at the non-inverting pin, the output of the opamp swings back to the positive saturation. Now the capacitor discharges trough R1 and starts charging in positive direction. This cycle is repeated over time and the result is a square wave swinging between +Vcc and -Vcc at the output of the opamp.

If the values of R2 and R3 are made equal, then the frequency of the square wave can be expressed using the following equation:

**F****=1 / (2.1976 R1C1)**

#### Integrator

Next part of the triangular wave generator is the opamp integrator. Instead of using a simple passive RC integrator, an active integrator based on opamp is used here. The opamp IC used in this stage is also uA741 (IC2). Resistor R5 in conjunction with R4 sets the gain of the integrator and resistor R5 in conjunction with C2 sets the bandwidth. The square wave signal is applied to the inverting input of the opamp through the input resistor R4. The opamp integrator part of the circuit is shown in the figure below.

Let’s assume the positive side of the square wave is first applied to the integrator. By virtue capacitor C2 offers very low resistance to this sudden shoot in the input and C2 behaves something like a short circuit. The feedback resistor R5 connected in parallel to C2 can be put aside because R5 has almost zero resistance at the moment. A serious amount of current flows through the input resistor R4 and the capacitor C2 bypasses all these current. As a result the inverting input terminal (tagged A) of the opamp behaves like a virtual ground because all the current flowing into it is drained by the capacitor C2. The gain of the entire circuit (Xc2/R4) will be very low and the entire voltage gain of the circuit will be close to the zero.

After this initial “kick” the capacitor starts charging and it creates an opposition to the input current flowing through the input resistor R4. The negative feedback compels the opamp to produce a voltage at its out so that it maintains the virtual ground at the inverting input. Since the capacitor is charging its impedance Xc keeps increasing and the gain Xc2/R4 also keeps increasing. This results in a ramp at the output of the opamp that increases in a rate proportional to the RC time constant (T=R4C2) and this ramp increases in amplitude until the capacitor is fully charged.

When the input to the integrator (square wave) falls to the negative peak the capacitor quickly discharges through the input resistor R4 and starts charging in the opposite polarity. Now the conditions are reversed and the output of the opamp will be a ramp that is going to the negative side at a rate proportional to the R4R2 time constant. This cycle is repeated and the result will be a triangular waveform at the output of the opamp integrator.

**Testing the triangular wave generator.**

Testing videos, practical circuit diagram, and photographs will be added soon.

**Applications:**

The applications of triangular wave include sampling circuits, thyristor firing circuits, frequency generator circuits, tone generator circuits etc.

## 11 Comments

its good to have this kind of tutorials on your website.i liked your posts.but you have to include some other videos. thank you!

@abel – Thanks for the suggestion. We have a Youtube channel – https://www.youtube.com/user/circuitstoday Please subscribe. We are working on to add more high quality videos.

Respected sir

We have one battery charger circuit with current control,voltage control circuit using LM324 ,555,tip127 components.In this all com pain circuit of saw tooth, triangulate,pulse generation circuit.

We are drawn the avail circuit but we can’t identified the particular type of outputs.

Hence kindly support us how can i sent to you the copy of drawing and i need the explanation of the circuit .

Thanking you

plz tell me why the apmlitude of squre & triangular wave are not equal plz define the theory of sat. region

why the output of integrator will be triangular wave only when R4 C2 > T/ 2 and why R4 C2 should be equal to T?

also what is the shape of the output waveform when R4 C2 not equal to or less than T/2 or T

and also why is it necessary to use resistance R5 = 10 R4?

I am getting dc bias in the triangular output..i am not getting how to eliminate that..please someone help me out..

blocking cap should do the trick

thanks a lot

but this curcuit donot run in ps_pice

it need noise maker

can you order that make noiser

i need it for my project

please answre it i return back

iran

hi,

i want to design a Negative edge zero sawtooth wave for my circuit.from negative – zero – positive.

Thanks!! But what is the equation that discribes the square-wave generator? The circuit is exactly what I need for my joob, so thanks again!!

Att, Jean Carlos Graf

Brazil