# What is a Square Wave Generator : Circuit Diagram & Advantages

Micheal Faraday (22^{nd} September 1971-25^{th} August 1867) is the father of the generator. The square wave generator is one type of generator used to generates the waveform in a square, the Schmitt trigger inverters like TTL are used to construct this generator. This generator is used in signal processing and in electronics. There are different types of generators in different sizes, in that square wave generator is one type. This article discusses an overview of the square wave generator which includes its definition, circuit diagram, and derivation of the time period and frequency.

### What is a Square Wave Generator?

The square wave generator is defined as an oscillator that gives the output without any input, without any input in the sense we should give input within zero seconds that means it must be an impulse input. This generator is used in digital signal processing and electronic applications. The square wave generator is also known as Astable Multivibrator or free-running and the frequency of the square wave generator is independent of the output voltage. The basic circuit diagram and working of the square wave generator are explained below.

### Square Wave Generator Circuit

To design the square wave generator, we need a capacitor, resistor, operational amplifier, and power supply. The capacitor and resistor are connected to the inverting terminal of the operational amplifier and the resistors R_{1 }and R_{2 }are connected to the non-inverting terminal of the operational amplifier. The circuit diagram of the square wave generator using an operational amplifier is shown below

If we force output to switch between the positive saturation voltage and the negative saturation voltage at the output of an operational amplifier we can achieve square wave as an output wave. Ideally without any input applied the output should be zero, it is expressed as

**V _{out} (output voltage) = 0 V when V_{in }(input voltage) = 0 V**

But practically we get some non-zero output that is expressed as

**V _{0ut }≠ 0**

The Resistors R_{1 }and R_{2 }form a voltage divider network. If the initial output voltage is non-zero we get voltage across V_{b. }Thus we get a positive input at the non-inverting terminal and the inverting terminal, then the output gets amplified by its gain and reaches the maximum output voltage thus we get the half of the square wave as shown in figure (a).

The capacitor starts charging when we have a non-zero input at the inverting terminal. It will charge continuously until its voltage become greater than V_{b}. As soon as V_{c} is greater than the V_{b} (V_{c}> V_{b}). The inverting input becomes greater than the non-inverting input and hence op-amp output switches to negative voltage and gets amplified till (–V_{out})_{max.} Thus will get the negative half of the square wave as shown in figure (b). This is the application of an op-amp as a square wave generator.

### Time Period and Frequency Derivation of Square Wave Generator

In the figure, Square Wave Generator Circuit V_{2 }is the voltage across the capacitor, and V_{1 }is the node voltage at the positive terminal. The current through op-amp is zero because of the ideal characteristics of an op-amp. Let us consider node equations from the circuit diagram.

**V _{1}– V_{0} / R_{2} + V_{1} / R_{1} = 0 **

**V _{1} [1/R_{2} + 1/ R_{1}] = V_{0} / R_{2}**

**V _{1} [R_{1}+ R_{2} / R_{1} R_{2}] = V_{0} / R_{2}**

**V _{1}(α) = V_{0 }………… eq (1)**

Let’s take

**α= R _{1}+ R_{2} / R_{1} = 1+ R_{2} / R_{1}>1**

therefore, **α>1 and V _{0}>1**

When **V _{0} = + V_{sat}**

**V _{1} = V_{0} / α= + V_{sat} / α= + V_{1}**

When **V _{0} = -V_{sat}**

**V _{1} = – V_{sat} / α= -V_{1}**

The voltage V_{1} have only two possibilities + V_{1 }and – V_{1}, so whenever V_{0} changes V_{1 }also changes. Now let’s see how V_{2 }is going to change. The voltage V_{2} will be the charging and discharging if we form a node equation here current through a capacitor is equal to the current.

**C d/dt (0- V _{2}) = V_{2} – V_{0} / R**

**-C d V _{2}/dt = V_{2} – V_{0} / R**

**d V _{2}/ V_{0} – V_{2} = dt / RC**

If we solve the above equation will get that

**∫ _{0}^{V2 }d (V_{2}/V_{0 }-V_{2 } ) = ∫_{0}^{t }dt/RC**

Initially, we have to assume the voltage across the capacitor is zero

**-log (V _{0} – V_{2}) = t / RC + K**

**log (V _{0} – V_{2}) = -t / RC + K**

**V _{0} – V_{2} = K e^{-t/RC} ………… eq (2)**

Substituting t=0, V_{2} = 0 in the above equation will get

**K = V _{0} …………………………… eq (3)**

Where **e ^{0} = 1**

Substitute eq (3) in eq (2) will get

**V _{0} – V_{2} = K e^{-t/RC}**

** V _{2} = V_{0} – V_{0} e^{-t/RC}**

**V _{2} = V_{0} [1-e^{-t/RC}]**

Applying initial conditions to the above equation

**Stage 1: Let V _{2} = 0, V_{0 }= +V_{sat}**

_{ }In stage-1 the voltage V_{2} is charging up to + V_{1}

**Stage 2: Let V _{2} = 0, V_{0 }= -V_{sat}**

In stage-2 the voltage V_{2} is discharging up to -V_{1}

**[ log (V0 + V1 / V0 – V1)] = 1/RC [T/2]**

**[ log (αV _{1 }+V_{2 }/ αV_{1 }– V_{1 })] = 1/RC [T/2]………………eq(4)**

Substitute eq (1) in eq (4) will get

**log [V _{1} (α + 1 ) / V_{1} (α – 1)] = [T/2 RC]**

**log[((R _{1}+R_{2}/ R_{1})^{ }+1)/( (R_{1}+R_{2}/ R_{1})^{ }-1)] = T/2 RC**

**log[R _{1}+R_{2} + R_{1}/ R_{1}^{+} R_{2}– R_{1}] = T/2 RC**

**log[2R _{1}+R_{2} / R_{2}] = T/2 RC**

**T = 2 RC log[2R _{1}+R_{2} / R_{2}]……… eq (5)**

**f = 1 / T**

** = 1/ 2 RC log[2R _{1}+R_{2} / R_{2}**]

**……… eq (6)**

An equation (5) and (6) are the time period and frequency of square wave generator

### Function Generator Circuit

The function generator is a type of instrument which is used to generate the different type of waveforms like sinusoidal waveforms, triangular waveforms, rectangular waveforms, sawtooth waveforms, square waveforms and these different type of waveforms have different frequencies and they can have generated with the help of the instrument called function generator. The frequencies of these waveforms may be adjusted from a fraction of Hertz to several hundred kiloHertz and this generator have the capability to generate the different waveforms at the same time in different applications. The circuit diagram of the function generator using LM1458 is shown below

An operational amplifier LM1458 is a dual purpose operational amplifier and the bias network and power supply lines of these dual operational amplifiers are common. The four integrated circuits in the function generator circuit are IC 1a, IC 1b, IC 2a, and IC 2b. The integrated circuit IC 1a is wired as an astable multivibrator, integrated circuit IC 1b wired as integrator, and IC 2a is also wired as an integrator.

The top 10 best function generators in 2020 are GM Instek SFG-1013 DOS, Function Generator DIY KIT by JYE Tech FG085, ATTEN ATF20B DDS, Rigol DGI02220 MHz Function Generator with the second channel, Eisco Labs Function Generator- 1KHz to 100 kHz, B & K Precision 4011A Function Generator, JYETech 08503 – Portable Digital Function Generator, Tektronix AFG1062 Arbitrary Function Generator, Keithley 3390 Arbitrary Function Generator, and Rigol DG1062Z Function/ Arbitrary Waveform Generator.

### Advantages

The advantages of the square wave generator are

- Simple
- Easy to maintenance
- Cheap

### FAQ’s

**1). What are square waves?**

The square waves are square-shaped grids that form on the ocean surface and these waves are also known as cross waves or cross-sea waves.

**2). What are the types of signal generators?**

The types of signal generators are Frequency Generator, Arbitrary Waveform Generator, Microwave, and RF Function Generators, Pitch Generator, and Digital Pattern Generators.

**3). What are the different types of multivibrator circuits?**

There are three types of multivibrator circuits they are Monostable Multivibrator Circuit, Astable Multivibrator Circuit, and Bistable Multivibrator Circuit.

**4). What is the function generator?**

The function generator is equipment or device used to generate the electrical waveforms over a wide range of frequencies. The waveforms generated by the function generator are a triangular wave, square wave, sinewave, and sawtooth wave.

**5). Why square waves are dangerous?**

The square waves can be mind-blowing and fascinating to look but actually, they are dangerous for swimmers and boats. When two sets of wave systems collide with each other it results in form or wave patterns that look like squares across the ocean.

In this article the square wave generator advantages, circuit diagrams of square wave generator, and function generator are discussed. Here is a question for you, which is the best square wave generator?