﻿ Op amp as a comparator, voltage follower, loudness & level indicator: Op amp Circuits

# Op-amp Tutorial 4 : voltage follower, loudness & level indicator, comparato

### Written By:

Ajish Alfred
Op amp as a Voltage follower
Voltage follower is a negative feedback op-amp amplifier circuit. It acts like emitter follower configuration of transistor based amplifiers. They provide unity gain to the applied input signals. Unity gain means the output voltage will be exactly equal in magnitude with the input voltage. Fig. 1: Circuit Diagram of OP-AMP based Voltage Follower

In the above figure a non-inverting voltage follower is shown. The input voltage V1 is applied on the non-inverting pin of the op-amp. Here the feedback resistance Rf is zero i.e. short circuit. The gain of the amplifier reduces from ideally infinity to unity.

If V1 is the input voltage at the inverting pin and V0 is the output voltage of the op-amp, then V0 is exactly equal to V1 in magnitude. Hence the gain is given by the following equation.

Gain=V0/V1= 1

Voltage follower is generally used for amplify the current of a signal keeping the voltage same incase of driving high output loads (low resistance circuits).

The things we have discussed in this section can be summarized as follows;

Inverting amplifier and non-inverting amplifier both are negative feedback op-amp circuits
Non-inverting amplifier the input signal is applied to non-inverting pin
Inverting amplifier the input signal is applied to the inverting pin
Voltage follower is a negative feedback op-amp circuit with unity gain

## Simple Microphone amplifier

Op amp as a Simple Microphone amplifier

We have already discussed about how negative feedback can be implemented for the purpose of designing practical op-amp based amplifiers. The concept of negative feedback, inverting and non-inverting configurations should be very clear before we proceed to this practical circuit.

The circuit is shown in the Figure: 44 is a simple op-amp inverting amplifier. In this circuit the feedback resistance Rf is represented by the resistance R4 and R1 is introduced into the circuit by the impedance of the capacitor C1.

The op-amp based microphone amplifier circuit is shown below. Fig. 2: Circuit Diagram of LM358 OPAMP IC based Microphone Amplifier

The output of the microphone will be in the range of very few millivolts. It should be amplified several times so as to make it useful for any practical use. In this circuit you can connect a microphone at one end and the amplified sound signals can be reproduces by connecting a loudspeaker at the other end.

LM358 op-amp IC is used in the above circuit also. The microphone is pulled up via a resistor. The sound signal is coupled out from the microphone using a capacitor and is applied to the inverting pin of the op-amp. A potential divider bias is given to the non-inverting pin. A feedback is also implemented using a resistor to the inverting pin. Hence the circuit forms a negative feedback inverting amplifier. The amplified signal is coupled out and fed to a loudspeaker.

The output coupling capacitor is used to couple out only the AC component, which is the actual signal. The output can be taken directly from the pin1 also without a coupling capacitor and can be used with other circuits. The output pin from the amplifier module is actually taken directly from the output of the LM358.

The image of the op-amp based microphone amplifier is shown below: Fig. 3: Image of LM358 OPAMP IC based Microphone Amplifier

As you can see from the above figure, I’ve made the circuit to a module, into which I can plug in a microphone and a loudspeaker. Also the module has pins, so that the entire module can be plugged in a breadboard or on to other larger circuits. There are three pins, VCC, GND and OUTPUT. The OUTPUT pin is taken from the pin1 of op-amp without including the coupling capacitor. It can also be taken via a resistor which can be plugged in an out from the IC base whenever it is desired, as you can see in the image.

If you observe the image of the microphone amplifier you can see a resistor sitting in the IC base together with the LM358. Such an arrangement is done so as to introduce any value of resistance whenever we need to connect the amplifier module to other circuits without an output coupling capacitor

Component specifications:
R1=18KE, 1/4W resistor
R2=R3=1KE, 1/4W resistor
R4=560KE, 1/4W resistor
C1=0.1uf disc capacitor
C2=100uf, 16V electrolytic capacitor
SP1=8E, loudspeaker
M1=microphone

Component significance:
R1: The value of this resistor should not be too high, so that we can have enough voltage variations coupled to the amplifier and not too low so that we have enough current flowing into the amplifier.

R2 & R3: These resistors should have equal value so that we can fix the operating point at its centre. This simply means we can have complete amplified signal output for both positive and negative halves for a signal having equal positive and negative halves using this setup.

R4: The value of R4 determines the gain of the circuit. When we increase the R4 gain increases and when we decrease the R4 gain decreases.

C1 & C2: The C1 and C2 are coupling capacitors use to couple only the AC waveforms from the input microphone and to the output loudspeaker respectively. Their values are calculated based on the frequency range of input signals (in this case human voice; ~3.5 KHz)

## Op amp comparators

Op amp comparators: Op amp as a comparator
Apart from amplification, the op-amps are widely used for comparing two signals and produce an output accordingly. The working concept of op-amp is similar to what we have already discussed in the section about Level detectors in 7.2). Comparator is nothing but a level detector, where we can preset a reference voltage on one pin and the voltage to be compared at the other pin. The output produced depends on the pin in which you are applying the voltage to be compared.

The input voltage should be applied to non-inverting pin for a comparator to produce high output whenever the input voltage is equal or greater than the reference voltage, or to the inverting pin otherwise. Fig. 4: Circuit Diagram of OPAMP based Voltage Comparator

The above circuit is an op-amp comparator in which the inverting pin is kept at a reference voltage and the varying input signal is fed to the non-inverting input pin. Whenever the voltage at the non-inverting pin goes above the voltage at the inverting pin, the output will be positive and otherwise negative.

Here +2V is given to the inverting input of the op-amp, so as long as the Vin which is given to the non-inverting pin remains at low voltage than the +2V, the output will be negative (almost equal to -10V). Whenever the Vin becomes equal to +2V, the output goes positive (almost equal to +10V).

It should be keep in mind that even the very minute increment of Vin more than the Vref will trigger the output to positive and very minute decrement of Vin less than Vref will trigger a negative output.

Assume that a sine wave is applied at the Vin and it is having a DC content of exactly +2V, the input and output waveform of such a circuit condition is shown below. Fig. 5: Signal Diagram of OPAMP based Voltage Comparator

Video

## Op-amp based comparators Contd

There are commercial op-amp ICs available which are specially made for comparator operations, in which even when the equal input voltages can trigger a positive output. There are ICs which has more than one comparator modules in a single pack. LM339 is such an IC which is widely used in electronic devices.

LM339 is a 14 pin IC, which consist of four op-amps inside the single IC pack. It also can work with single power supply like LM358. The pin-outs for the LM339 IC is shown in the following figure. Fig. 6: Pin Diagram of LM339 OP-AMP IC

Those who would like to experiment with LM339 IC should notice that the output of the LM339 is open drain, means the output pin comes from the collector of a transistor. The output transistor will be activated only when it is connected to a VCC through your device. Fig. 7: Image showing Circuit Connection of LM339 with a Device

In the above figure, the block mentioned as “DEVICE” could be anythig like LED, motor or even a simple resistor.
That’s all about the basics of comparator and comparator ICs, now lets try out some really intersting circuits  in the following section which make use of the knowledge we have gained so far.

## Voltage level indicator

Op amp as a Voltage level indicator
A voltage level indicator is a very useful circuit to be used with veriety of sensors with analog output. There are 8 LEDs in a raw which indicates 8 voltage level in ascending order. The right end LED represents the minimum voltage and the left end LED represents maximum voltage. As the voltage increases the LEDs start glowing from right end to left end.

I choose LM339 IC for designing a voltage level indicator, the features of which we have discussed in the previous section. It consists of four op-amps comparators. The IC has 14 pins among which two of them are VCC and GND, and rests of them are inverting and non-inverting pins and their respective output pins of the four op-amps.

Two LM339 ICs are used in cascde and the entire non-inverting pins of both the LM339 are shorted and connected to a common input point. A potential divider network of resistors is used to give voltage to the inverting pins of the op-amps in an ascending order. Whenever the potential at the common input point increases more than the potential at the inverting pin of a particular op-amp, its output goes high and the LED connected to that output pin glows.

The circuit diagram of the voltage level indicator is shown in the following figure. Fig. 8: Circuit Diagram of OPAMP based Voltage Level Indicator

From the above circuit, resistors R9 to R16 together with the variable resistor R17 form a potential divider network. The potential across the resistors can be adjusted by varying R17. If we assume all the nine resistors including the R17 have the same value, then the voltage across each resistor will be 5/9 volts. Hence the voltage at the inverting input of op-amp U2_4 will be 5/9V, op-amp U2_3 will have 5/9V+5/9V.i.e (5/9)*2, op-amp U2_2 will have (5/9)*3 and so on. Finally the inverting pin of op-amp U1_1 will have a potential (5/9)*8. Note that this condition is true only when the variable resistor is adjusted so that it has a resistance value same as the resistors R9 to R16. If we adjust the variable so that the resistance increases, then the voltage across the individual resistors decreases equally. If the variable resistor is adjusted so that its resistance decreases, then the voltage across individual resistors increases equally.

The working of the circuit can be explained with the help of an example. Assume that all the all the nine resistors including the R17 have the same value, and then the voltage across each resistor will be 5/9 volts. Suppose an input voltage greater than (5/9)*3 is applied. As we mentioned before, this voltage is greater than the voltages at the inverting pin of U2_3, U2_2 and U2_1 and hence they produce high output and the corresponding three LEDs glow. Again suppose the input voltage is greater than (5/9)*8. Now the entire non-inverting pins are at a higher potential than the inverting pins of the two LM339. Hence at that input voltage all the op-amp produce high output and the entire LEDs glow.

Component specifications:
R1 to R16=1KE, 1/4W resistor
R17=100KE potentiometer
D1 to D8=LED 3mm
U1=U2=LM339

Component significance:
R1 to R8: These resistors controls the brightness of the LEDs. Resistors having a value above 220 ohms are safe to use with the LEDs.

R9 to R16: These resistors set the voltage at the inverting pin of each comparator. All these resistors should have equal value so that the output changes for equal increase in input voltage each time.

R17: This variable resistor set the sensitivity of the voltage level indicator circit. When you increase the resistance, the voltage appearing at the inverting pins reduces equally and as a result output changes occurs rapidly and the input range which the circuit can detect reduces. If you decrease the resistance, the voltage appearing at the inverting pins increases equally and as a result output changes occurs slowly and the input range which the circuit can detect increases.

The circuit in the Figure: 57 is built into two separate modules and then joined together. It is always recommended for the ease of assembling, debugging and hardware reuse. Hardware reuse means we can use the same module, say display module with some other circuit larger circuit.

One of the module has only LEDs and their current controling resistors, and we can call this module as display module. I’ve made it into a module so that it can be used with other larger circuits. The other module have the LM339 ICs and the resistor network.
The image of the two modules are shown in the following image. Fig. 9: Image of Display Module and Comparator Modules

You can see all the eight LEDs, eight resistors and nine pin-outs in the display module. One of the pin is used for common positive supply and the rest of them can be connected to the output pins of op-amps. This module can be plugged into a breadboard and then connect to the comparator module or directly to the comparator module, as the comparator module is built in such a way that it has connectors to house the display module.

Video

## Voltage level indicator Contd...

In the comparator module there are two LM339 IC, eight resistors, a variable resistor and a connector to house the display module. This module also has pin-outs including VCC, GND and INPUT so that the entire module can be plugged into a breadboard or other larger circuits.
The two modules canbe connected together to form the voltage level indicator as shown in the following image. Fig. 10: Image of OPAMP based Voltage level indicator

We can test the module by applying some external volatge from other devices if we have any, or simply apply a voltage using a variable resistor an observe the variations in the output with respect to the variations in the input voltage. Such an arrangement is shown in the following figure. Fig. 11: Circuit Diagram of OPAMP based Voltage Level Detector

The variable resistance R1 value can be anything above 1K ohm. As we vary the resistance we are varying the voltage input to the voltage level indicator module. The module senses this voltage and the output LEDs glow accordingly.
The image for such a voltage level indicator set up is shown in the following figure. Fig. 12: Image of of OPAMP based Voltage Level Detector

## Loudness indicator

Op amp as a Loudness indicator
The loudness indicator found in large sound amplifier boxes used to catch my attention. It is very nice to watch the LEDs glow according to the loudness of one who speak through the microphone. Let’s see how we can build our own simplest loudness indicator.

The interesting part is that the loudness indicator can be realized by connecting together the modules we have already made. This can be explained with the help of the following block diagram. Fig. 13: Block Diagram of Loudness Indicator

As shown in the above figure, the sound amplifier module amplifies the sound signals from the microphone, fed them to the comparator module, which then drive the LEDs according to the amplitude of the signal input. Since loudness increases the strength or the amplitude of the signal input to the comparator module increases. Hence the louder the voice, the more LEDs in the display module glows.

Before we proceed with the connection, we need to do some adjustments in the microphone amplifier module. The loudspeaker should be removed and the output should be taken directly from the output pin through a high valued resistor. We have alredy made arrangemnt for introducing a resistor and the output pin from the module actually taken directly from the output of the LM358.
The modified circuit is shown in the following figure Fig. 14: Circuit Diagram of Modified OPAMP based Microphone Amplifier

Component specification  are same as in the case of the previous circuit, except there is an additional resistor R5 with a resistance value of 270K ohms.

The image of the actual connection done in the breadboard as per the block diagram in Figure: 53 is shown below. Fig. 15: Image of OPAMP based of Loudness Indicator
The images of all the module which I’ve built is shown in the following image. I recommend the reader to try out the circuit first in breadboard and once it is working, built the same into a module which we can plug into a breadboard later or may be into another larger circuit. Fig. 16: Image showing various OPAMP Circuits Designed
Video

## Operations on input voltages

Operations on input voltages
Op-amp stands for Operational Amplifier, and it got such a name since it is capable of doing certain operations on the input voltages applied, apart from merely amplifying them. An op-amp is capable of adding, subtracting input voltages along with amplifying the result. Such kind of op-amp circuits are generally called as Summing amplifiers.

Summing amplifier
An op-amp amplifier can be configured in such a way the sum of the voltages applied at the input can be obtained at the output with an amplification. The voltages applied at the non-inverting input pin are added together and the voltages applied at the non-inverting input pin are subtracted. Fig. 17: Circuit Diagram of OPAMP based Voltage Adder

The above circuit is an op-amp based voltage adder. Let us assume that the input resistance have the same values i.e. R1=R2=R3=R. Let the voltages applied at the inverting input pin are V1, V2 and V3. In such a case the output voltage can be calculated from the following equation.
Vout=-(Rf/R)(V1+V2+V3)

Now let’s consider a complete voltage summing amplifier having capability of both voltage addition and subtraction. Input voltages are applied on both the inverting and non-inverting inputs. Fig. 18: Circuit Diagram of OPAMP based Voltage Adder and Subtractor

In the above circuit V1, V2 and V3 are the voltages applied at the inverting input and V4, V5 and V6 are the voltages applied at the non-inverting input. We assume all the resistors except Rf are the same. i.e. R1=R2=R3=R4=R5=R6=R7=R. In such a circuit the output voltage can be obtained by the following equation.

Vout=-(Rf/R)(V1+V2+V3-V4-V5-V6)

Summing amplifier has so many practical applications. On such application is signal mixing in amplifiers. They are also used in analog signal processing and were widely used in early analog computers.
What I have been trying to convey through this article is given as follows;

Op-amp is an elcetronic circuit, made of basic electronic components. This circuit is capable of doing certain operations on the input signals along with amplifying them.

So far we have seen some basic circuits using op-amp and I suggest the reader to go through the topics thoroughly. Practise as many circuits as possible. With each circuit you make you learn a new thing about the op-amp and your knowledge becomes more solid. Op-amp is an interesting electronic device and trust me you will enjoy making circuits with it!