# Square wave generator using LM358

Here a LM358 op-amp square wave generator is build on a breadboard and tested using matlab/simulink PC oscilloscope. Op-amp square wave generators are also often referred to as astable multivibrator. One of the useful application among others in constructing function generators which also requires integrator circuit.

The following picture shows circuit schematic of LM358 op-amp square wave generator using Multisim electronics design software.

We are using single power supply of +5V. The op-amp square wave generator is like inverting amplifier with the input voltage at the inverting terminal 2 replaced with a capacitor. The capacitor C1 and R1 along with the biasing network at the non-inverting input 3 determines the frequency of the square wave generator. The resistors R2,R3 and R4 determine the biasing point of the op-amp which also has effect on the frequency of the square wave at the output terminal 1. There are various types of LM358 op-amp and here we are using LM358P. As we will see the type of LM358 op-amp used or in general any op-amp also effects the frequency of the output square wave. In most op-amp based square wave generator the resistor R2 is usually not found. Here we have used to bias the op-amp at the mid-point between the +ve supply which is +5V and ground. Therefore the voltage at the inverting and non-inverting terminal is around 2.5V(with perfect resistors and ideal op-amp). Also the output signal which is square wave swings between the 2.5V dc component.

The following picture shows LM358 based square wave generator following the above circuit diagram.

Notice that a 10uF capacitor was placed at the output of the generator to block signals with frequencies below 10Hz and allow other frequencies signal to pass through. This was explained with calculation in the tutorial How to Design LM358 Op-Amp Practical Integrator. Then with the output coupling capacitor in place the update circuit diagram is shown below.

Using Matlab/Simulink oscilloscope we can test the designed square wave generator output. How the Simulink PC based oscilloscope works was previously explained in Build LM324 inverting amplifier and test with Matlab/Simulink Oscilloscope.

Below picture shows the aquisition of square wave by Simulink PC oscilloscope generated by the LM358 operational amplifier.

The following picture shows the square wave displayed by the time scope in real time.

The following picture shows the frequency spectrum displayed by the spectrum analyzer.

The above spectrum analyzer shows frequency of the square wave as 5.26KHz.