Here a **function generator** using **LM324 op-amp** is designed and tested. Function generator also commonly called waveform generator is an electronics circuit that produces different types of signals such as square wave, triangle wave, sine wave. **LM324** has four individual op-amps and we can use one of them to generate square wave, use second one as an integrator to integrate the square wave to produce triangle wave and use third one as an integrator to integrate the triangle wave to produce sine wave.

The **circuit diagram** of the **function generator** using **LM324 operational amplifier** is shown below.

The potentiometer R1 of 1MOhm and the capacitor C1 controls the frequency of the square wave. The variable resistor R1 can be varied to generate wide range of frequencies. The whole function generator uses single supply voltage. Between the sections we have used 10uF coupling capacitors. The two integrator after the square wave generator uses voltage divider biasing to output signal with amplitude swing above and below around 2.5V. The biasing voltage and frequency depends practically on the type of LM324 op-amp used because there are various version of it. The potentiometer R1 should be varied to determine the frequency of the square wave and thus the sine and triangle wave. Also the slew rate of the op-amp being used should be taken into consideration.

The following shows **LM324 based waveform generator** on **breadboard**.

Note that in the above function generator build on the breadboard we have used fixed resistor of 470KOhm for R1. This gives us measured frequency of 1.2KHz for testing purpose.

We can test the circuit using Matlab/Simulink based PC oscilloscope and spectrum analyzer. How this works was previously explained in How to use Matlab Simulink as Oscilloscope and in the tutorial How to design a Practical LM358 Op-Amp Inverting Amplifier Matlab/Simulink PC oscilloscope and function generator are used to test designed amplifier in real time.

Thus the following shows the sine wave output from the third op-amp of LM324.

The following shows triangle wave from the second op-amp of LM324.

The square wave signal generated by the first op-amp is shown below.

In all of the cases the spectrum analyzer shows measured frequency of 1.2KHz as shown below.

The following video demonstrates the testing of the waveform generator using simulink oscilloscope and spectrum analyzer.

This waveform generator created is based on the following related tutorials:

- Square wave generator using LM358

- LM358 Op-Amp Integrator Test with Matlab Simulink Oscilloscope