**I ****Introduction**

**1.1 ****What is LM324?**

**LM324** is a low-cost quad-operational amplifier.

The low-frequency signal generator designed with it as the core device has the advantages of simple circuit, stable waveform, economical and practical, and easy to use. It can output the sine wave, square wave and triangle wave signals commonly used in experimental testing. And the frequency and amplitude of the signal can be adjusted.

Figure 1. LM324 Quad-Operational Amplifiers

**1.2 What is Wave**** ****G****enerator****?**

The **wave generator** refers to an instrument that generates electrical test signals with the required parameters. The circuit form can be composed of op-amps and discrete components, or a single-chip integrated function generator. It is widely used in production practice and technology. Some standard products that are widely used at present, although they have complete functions and high-performance indicators, are more expensive and have many functions that are not available.

**1.3 Wave Generator Using LM324**

In this blog, quad-operational amplifiers with differential input LM324 are used as the core device, a sine wave is generated by an RC bridge oscillation circuit, then a square wave is generated by a zero-crossing comparator, and a triangular wave is generated by an integrating circuit.

Through Proteus software simulation and simulation experiment, the ideal waveform of 20Hz~20kHz is obtained, and the frequency and amplitude of the signal can be adjusted.

**Catalog**

3.1 Sine Wave Generating Circuit |

**II ****How to Generate and Transform Wave **

There are many schemes for waveform generation and transformation. Here, the **sine wave→square wave→triangle** **wave** scheme shown in Figure 2 is used. Among them, the sine wave is generated by the RC bridge oscillation circuit, which is characterized by stable amplitude and frequency and easy adjustment, and can generate a sine signal with a very low frequency; then a zero-crossing comparator is used to generate a square wave, and then an RC integration circuit is used to generate a triangular wave. This signal has the same frequency.

This circuit has a simple structure and can produce good sine and square wave signals, but it is difficult to generate a synchronized triangular wave signal through an integration circuit. The reason is that if the time constant of the integration circuit does not change, the amplitude of the output triangle wave changes at the same time as the frequency of the square wave signal changes. To keep the triangle wave output amplitude unchanged and good linearity, the integration time constant must be changed at the same time.

Figure 2. Wave Generation and Transformation

The frequency of the signal is determined by the RC frequency selection network of the sinusoidal oscillation circuit. Due to the large frequency range, the frequency selection network uses three sets of capacitors with different capacities to form three frequency bands, which are selected by the band switch, and then the coaxial potentiometer adjusts the oscillation frequency. Three kinds of waveforms can be selected through a gear switch, and then output independently through the amplitude adjustment potentiometer to achieve the purpose of signal selection and amplitude adjustment.

**III ****Design of ****U****nit ****C****ircuit**

**3.1 ****Sine ****W****ave ****G****enerating ****C****ircuit**

The **sine wave** generating circuit should not only generate the sine signal of the required output, but also the input signal of the following circuit. This part of the circuit uses a typical RC bridge sine wave oscillation circuit, as shown in Figure 3, it consists of two parts of the amplification link and frequency selection network. The operational amplifier is the core to form the amplification link. The network composed of resistor R_{1} and capacitor C_{1} in series, resistor R_{2} and capacitor C_{2} in parallel is the RC series-parallel frequency selection network. The frequency selection network is also a positive feedback circuit, providing zero phase shift and forming an in-phase amplifier. R _{3} and R _{4 }are deep negative feedbacks to obtain a good output waveform. If R_{1} = R_{2} = R, C_{1} = C_{2} = C, then the center frequency of the frequency selection network is f_{0} = 1/( 2π RC ). When the circuit works at this frequency, the feedback coefficient is the largest and is | F |_{max }= 1/3. According to the oscillation conditions, the voltage gain of the amplifier circuit should be at least 3A | (R_{4} + R_{3}) / R_{4}|. Therefore, in order to ensure the oscillation of the circuit, R _{3}> 2R_{ 4} is required.

Figure 3. RC Bridge Oscillation Circuit

In practical applications, in order to adjust the frequency and the gain of the amplifier, the circuit shown in Figure 4 can be used. Among them: R_{3} ~ R_{5} and diodes D_{1}, D_{2} form a negative feedback network and amplitude stabilization link. Adjusting RV_{3} can change the feedback coefficient of negative feedback, thereby adjusting the voltage gain of the amplifier circuit to meet the replication conditions of oscillation.

Figure 4. RC Oscillation Simulation Circuit

In view of the large span of the signal frequency from 20Hz to 20kHz, two groups of three capacitors each with a capacity of 10 times different and two coaxial potentiometers are used for adjustment. Choose different capacitors as the coarse adjustment of the oscillation frequency f_{0}, and use the coaxial potentiometer to achieve the fine adjustment of f_{0}. The resistance values corresponding to different capacitances and oscillation frequencies f_{0} are shown in Table 1.

Table 1. Correspondence between Oscillation Frequency f_{0} and Resistance & Capacitance

It can be seen from Table 1 that each combination of capacitance and resistance can adjust a certain range of frequencies, and these three ranges have intersections, so the frequency can be continuously adjusted. If you want to generate a 200 Hz to 2 kHz signal, you can set the capacitor to 33 nF, and then adjust RV_{1} and RV_{2} to make the resistance in series with R_{1} and R_{2} change between 24 kΩ and 2.4 kΩ.

**3.2 ****Square ****W****ave ****G****enerating ****C****ircuit**

The **square wave** generating circuit is relatively simple. The inverting input of the operational amplifier LM324 is grounded. The non-inverting input is connected to the output of the sine wave generating circuit to form a zero-crossing comparator, as shown in Figure 5.

Figure 5. Square Wave Generating Circuit

When the input sinusoidal signal sin changes between positive and negative half cycles, the output is a square wave signal squ with a fixed amplitude and in phase with the sine wave.

**3.3 ****Triangle ****W****ave ****G****enerating ****C****ircuit**

The** triangular wave** generating circuit adopts the RC integrating circuit shown in Figure 6, which is composed of the operational amplifier U_{1: C}, C _{3}/C _{3}′/C _{3}″, R_{7} and RV_{4}_{.}

Figure 6. Triangle Wave Generating Circuit

The square wave signal squ is connected to the inverting input terminal of the amplifier through R_{7} and RV_{4}, and the output signal is the triangular wave trii generated by the integral transformation of the RC circuit composed of R_{7}, RV_{4} and C_{3} / C_{3} ′ / C_{3} ″. C_{3}, C_{3} ′, C_{3} ″ are selected by the band switch (this switch should be synchronized with the band switch of the selected frequency network) to change the integral time constant of the circuit in different frequency bands. Potentiometer RV_{4} can adjust the amplitude of the output signal. In order to obtain a triangular wave with good linearity, resistor R_{8} is used for negative feedback limiting, and when selecting the component parameters, the time constant of the integrating circuit τ = RC should be greater than half the period of the square wave signal (the width of the square wave). If the signal frequency is 100 Hz, the width of the square wave is 0.005 s. If C = 1 μF, then R> 5 kΩ.

**IV ****Circuit Simulation and Test**

Draw each part of the circuit shown in Figure 4 to Figure 6 in Proteus. The three parts of the circuit are connected according to the relationship shown in Figure 2. Then connect the output of each part of the circuit to the virtual oscilloscope and then start the simulation. You can observe simulation waveform in Figure 7. In the simulation process, there are several issues that need to be noted: According to theoretical calculations, the sine wave generation circuit can start to vibrate when the amplifier gain is greater than 3, but sometimes the phenomenon of no vibration occurs in the actual simulation process.

Disturbance is added to solve it, as shown in Figure 4, -9V power supply, see the literature for details. To change the frequency band, the three groups of capacitors C_{1} / C_{1} ′ / C_{1} ″, C_{2} / C_{2} ′ / C_{2} ″, C_{3} / C_{3} ′ / C_{3} ″ must be changed at the same time, otherwise there will be no vibration or The waveform is distorted. Potentiometers RV_{1} and RV_{2} should be adjusted to the same resistance. Adjust RV_{3} to make the output sine wave amplitude reach the maximum undistorted state. RV_{4} can adjust the amplitude of the output triangle wave. Through experimental testing of the circuit, in Three ideal waveforms can be observed on the oscilloscope. It should be noted that: switches SW_{1}, SW_{2}, and SW_{3} should use a 3-position switch with more than 3 groups. RV_{1}, RV_{2} use coaxial potentiometers for adjustment. The output signal can be output in parallel at the same time, or it can be output separately through a potentiometer (to make the signal amplitude adjustable) through a selection switch. In addition, the power supply does not need to be disturbed during actual testing.

Figure 7. Simulation Waveform Obtained in Proteus

After reading this blog, do you have a better understanding of LM324? If you have any thoughts about LM324, please don't hesitate to let us know in the comments section!

## 0 comment