Here is demonstration of how to convert square wave to triangular wave using LM324 op-amp. To convert square wave to triangle wave using op-amp we have to integrate the square wave over the time period of the input square wave period. LM324 op-amp has four op-amp build into it and we can use one of them to generate a square and another to create an integrator.

In previous tutorials LM324 op-amp Integrator testing with matlab simulink oscilloscope we have explained how to create an integrator circuit using LM324 operational amplifier. And we have also shown in the tutorial Square wave generator using LM358 how to create square wave. Since LM358 and LM324 are the same op-amp only differing in number of op-amps inside their IC and power dissipation we can use the same circuit for LM324 for square wave generation as with LM358. So we will use the same LM324 op-amp to generate square wave using one of the four op-amp and second op-amp to build an integrator.

The following picture shows how the LM324 op-amp is used to create square wave to triangle circuit on a breadboard.

The circuit diagram of the above realized square to triangle wave converter using op-amp is shown below.

In the above circuit wiring diagram, the first section op-amp generates a square wave of 1.2KHz. The frequency of the square wave is configured using the resistor R1 and capacitor C1. Here R1 = 470KOhm and the higher the resistance R1 the lower will be the frequency of the square wave, provided the capacitor C1 remains 0.001uF. To create variable frequency one can just replace the R1 resistor with a potentiometer. Potentiometer such as 1MOhm gives higher frequency range from Hz to KHz. With 100KOhm POT the lower frequency is around 3KHz and upwards. The second op-amp is used to integrate the square wave coming from the output of the first op-amp. Between the square wave generator and integrator op-amp a 10KOhm potentiometer is used which limits the amplitude going into the integrator circuit. The op-amp integrator circuit is voltage divider biased since we are using single supply voltage. This was explained in the previous tutorial LM358 Op-Amp Integrator Circuit Analysis with single and dual power supply. The underlying theory of How to Design LM358 Op-Amp Practical Integrator was also previously explained and how to calculate the capacitor value and feedback resistor value for particular gain and frequency.

Once the circuit is build we can test with Matlab/Simulink oscilloscope and spectrum analyzer. Before doing that we have to connect the input and output signal to the PC line in/mircophone port. The following picture shows how the above circuit is connected to PC.

Now we can test the square wave to triangle wave converter circuit with Matlab/Simulink. For details how the PC oscilloscope and spectrum analyzer works see How to use Matlab Simulink as Oscilloscope.

The following video demonstrates testing of the constructed circuit with Matlab/Simulink software.

The time scope displays the input square wave and output triangle wave as shown below.

The spectrum analyzer display the frequency and magnitude of the square wave and triangle as shown below.

So in this example illustration we explained and showed how to make square to triangle wave converter using LM324 operational amplifier.