Op-Amp Comparator Circuit
Op-Amp Comparator Circuit
Op-Amp Comparator Circuit
The comparator is an electronic decision making circuit that makes use of an operational
amplifiers very high gain in its open-loop state, that is, there is no feedback resistor.
The Op-amp comparator compares one analogue voltage level with another analogue
voltage level, or some preset reference voltage, VREF and produces an output signal based
on this voltage comparison. In other words, the op-amp voltage comparator compares the
magnitudes of two voltage inputs and determines which is the largest of the two.
We have seen in previous tutorials that the operational amplifier can be used with negative
feedback to control the magnitude of its output signal in the linear region performing a
variety of different functions. We have also seen that the standard operational amplifier is
characterised by its open-loop gain AO and that its output voltage is given by the
expression: VOUT = AO(V+ – V-) where V+ and V- correspond to the voltages at the non-
inverting and the inverting terminals respectively.
Voltage comparators on the other hand, either use positive feedback or no feedback at all
(open-loop mode) to switch its output between two saturated states, because in the open-
loop mode the amplifiers voltage gain is basically equal to AVO. Then due to this high open
loop gain, the output from the comparator swings either fully to its positive supply
rail, +Vcc or fully to its negative supply rail, -Vcc on the application of varying input signal
which passes some preset threshold value.
The open-loop op-amp comparator is an analogue circuit that operates in its non-linear
region as changes in the two analogue inputs, V+ and V- causes it to behave like a
digital bistable device as triggering causes it to have two possible output states, +Vcc or -
Vcc. Then we can say that the voltage comparator is essentially a 1-bit analogue to digital
converter, as the input signal is analogue but the output behaves digitally.
With reference to the op-amp comparator circuit above, lets first assume that VIN is less
than the DC voltage level at VREF, ( VIN < VREF ). As the non-inverting (positive) input of the
comparator is less than the inverting (negative) input, the output will be LOW and at the
negative supply voltage, -Vcc resulting in a negative saturation of the output.
If we now increase the input voltage, VIN so that its value is greater than the reference
voltage VREF on the inverting input, the output voltage rapidly switches HIGH towards the
positive supply voltage, +Vcc resulting in a positive saturation of the output. If we reduce
again the input voltage VIN, so that it is slightly less than the reference voltage, the op-amp’s
output switches back to its negative saturation voltage acting as a threshold detector.
Then we can see that the op-amp voltage comparator is a device whose output is
dependant on the value of the input voltage, VIN with respect to some DC voltage level as
the output is HIGH when the voltage on the non-inverting input is greater than the voltage
on the inverting input, and LOW when the non-inverting input is less than the inverting
input voltage. This condition is true regardless of whether the input signal is connected to
the inverting or the non-inverting input of the comparator.
We can also see that the value of the output voltage is completely dependent on the op-
amps power supply voltage. In theory due to the op-amps high open-loop gain the
magnitude of its output voltage could be infinite in both directions, (±∞). However
practically, and for obvious reasons it is limited by the op-amps supply rails
giving VOUT = +Vcc or VOUT = -Vcc.
We said before that the basic op-amp comparator produces a positive or negative voltage
output by comparing its input voltage against some preset DC reference voltage. Generally,
a resistive voltage divider is used to set the input reference voltage of a comparator, but a
battery source, zener diode or potentiometer for a variable reference voltage can all be
used as shown.
In the inverting configuration, which is the opposite of the positive configuration above, the
reference voltage is connected to the non-inverting input of the operational amplifier while
the input signal is connected to the inverting input. Then when VIN is less than VREF the op-
amp comparators output will saturate towards the positive supply rail, Vcc.
Likewise the reverse is true, when VIN is greater than VREF, the op-amp comparators output
will change state and saturate towards the negative supply rail, 0v.
Then depending upon which op-amp inputs we use for the signal and the reference voltage,
we can produce an inverting or non-inverting output. We can take this idea of detecting
either a negative or positive going signal one step further by combining the two op-amp
comparator circuits above to produce a window comparator circuit.
Window Comparator
A Window Comparator is basically the inverting and the non-inverting comparators
above combined into a single comparator stage. The window comparator detects input
voltage levels that are within a specific band or window of voltages, instead of indicating
whether a voltage is greater or less than some preset or fixed voltage reference point.
This time, instead of having just one reference voltage value, a window comparator will
have two reference voltages implemented by a pair of voltage comparators. One which
triggers an op-amp comparator on detection of some upper voltage
threshold, VREF(UPPER) and one which triggers an op-amp comparator on detection of a lower
voltage threshold level, VREF(LOWER). Then the voltage levels between these two upper and
lower reference voltages is called the “window”, hence its name.
Using our idea above of a voltage divider network, if we now use three equal value resistors
so that R1 = R2 = R3 = R we can create a very simple window comparator circuit as shown.
Also as the resistive values are all equal, the voltage drops across each resistor will also be
equal at one-third the supply voltage, 1/3Vcc. So for ease in this simple window
comparator example, we can set the upper reference voltage to 2/3Vcc and the lower
reference voltage to 1/3Vcc.
Consider the window comparator circuit below.
The inital switching condition of the circuit is the open-collector output of op-amp A1 “OFF”
with the open-collector output of op-amp A2, “ON” (sinking current) so VOUT is equal to 0V.
When VIN is below the lower voltage level, VREF(LOWER) which equates to 1/3Vcc, VOUT will be
LOW. When VIN exceeds this 1/3Vcc lower voltage level, the first op-amp comparator
detects this and switches its open-collector output HIGH. This means that both op-amps
have their outputs HIGH at the same time. No current flows through the pull-up
resistor RL so VOUT is equal to Vcc.
As VIN continues to increase it passes the upper voltage level, VREF(UPPER) at 2/3Vcc. At this
point the second op-amp comparator detects this and switches its output LOW and
VOUT becomes equal to 0V.
Then the difference between VREF(UPPER) and VREF(LOWER) (which is 2/3Vccc – 1/3Vcc in this
example) creates the switching window for the positive going signal.
Lets now assume that VIN is at its maximum value and equal to Vcc. As VIN decreases it
passes the upper voltage level VREF(UPPER) of the second op-amp comparator which switches
the output HIGH. As VIN continues to decrease it passes the lower voltage
level, VREF(LOWER) of the first op-amp comparator once again switching the output LOW.
Then the difference between VREF(UPPER) and VREF(LOWER) creates the window for the negative
going signal. So we can see that as VIN passes above or passes below the upper and lower
reference levels set by the two op-amp comparators, the output signal VOUT will be HIGH or
LOW.
In this simple example we have set the upper trip level at 2/3Vcc and the lower trip level at
1/3Vcc (because we used three equal value resistors), but can be any values we choose by
adjusting the input thresholds. As a result, the window width can be customized for a given
application.
If we used a dual power supply and set the upper and lower trip levels to say ±10 volts
and VIN was a sinusoidal waveform, then we could use this window comparator circuit as a
zero crossing detector of the sine wave which would produce an output, HIGH or LOW
every time the sine wave crossed the zero volts line from positive to negative or negative to
positive.
We can take this idea of detecting voltage levels further by connecting a number of
different op-amp comparators together with them all using a common input signal, but
with each comparator using a different reference voltage set by our now familiar voltage
divider network across the supply. Consider the voltage level detector circuit below.
For the inverting comparator circuit above, VIN is applied to the inverting input of the op-
amp. Resistors R1 and R2 form a voltage divider network across the comparator providing
the positive feedback with part of the output voltage appearing at the non-inverting input.
The amount of feedback is determined by the resistive ratio of the two resistors used and
which is given as:
We can also produce a non-inverting op-amp comparator circuit with built in hysteresis by
changing the input and reference terminals as shown:
Feedback Fraction:
Then the reference voltage VREF, switches between +1V and -1V as the output saturates
from one level to the other. Hopefully we can see from this simple example that the width
of this hysteresis, 2 volts in total, can be made larger or smaller simply by adjusting the
voltage divider ratio of the feedback resistors R1 and R2.
Here, the open collector output from the voltage comparator is connected to a voltage
source via a single pull-up resistor (and an LED for indication) which pulls the single
output high to the power supply. When the output switch is HIGH it creates a high
impedance path, therefore no current flows as VOUT = Vcc.
When the comparator changes state and the output switch is LOW, it creates a low
impedance path to ground and current flows through the pull-up resistor (and LED)
causing a voltage drop across itself with the output being pulled to the lower supply level,
ground in this case.
Then we can see that there is very little difference between the schematic symbol of an op-
amp comparator and a voltage comparator or their internal circuits. The main difference is
in the output stage with the open collector or drain configuration is useful for driving
relays, lamps, etc. By driving a transistor from the output allows for a greater switching
current capacity than that of the comparators output alone.
The zero crossing detector circuit is an important application of the op-amp comparator
circuit. It can also be called as the sine to square wave converter. Anyone of the inverting
or non-inverting comparators can be used as a zero-crossing detector. The only change to
be brought in is the reference voltage with which the input voltage is to be compared, must
be made zero (Vref = 0V). An input sine wave is given as Vin. These are shown in the circuit
diagram and input and output waveforms of an inverting comparator with a 0V reference
voltage.
Zero-Crossing Detector Using UA741 op-amp IC
As shown in the waveform, for a reference voltage 0V, when the input sine wave passes
through zero and goes in positive direction, the output voltage Vout is driven into negative
saturation. Similarly, when the input voltage passes through zero and goes in the negative
direction, the output voltage is driven to positive saturation. The diodes D1 and D2 are also
called clamp diodes. They are used to protect the op-amp from damage due to increase in
input voltage. They clamp the differential input voltages to either +0.7V or -0.7V.
In certain applications, the input voltage may be a low frequency waveform. This means
that the waveform only changes slowly. This causes a delay in time for the input voltage to
cross the zero-level. This causes further delay for the output voltage to switch between the
upper and lower saturation levels. At the same time, the input noises in the op-amp may
cause the output voltage to switch between the saturation levels. Thus zero crossing are
detected for noise voltages in addition to the input voltage. These difficulties can be
removed by using a regenerative feedback circuit with a positive feedback that causes
the output voltage to change faster thereby eliminating the possibility of any false zero
crossing due to noise voltages at the op-amp input.
Zero-Crossing Detector Using 741IC -Waveforms
A zero crossing detector is the simplest circuit configurations of op-amp switching circuits.
In this configuration, the input signal is applied to one of the input terminals while the
other input is connected to ground. This circuit needs no feedback connection.
If the input signal source is connected to the non-inverting input terminal of the op-amp
and the inverting input terminal is grounded, the circuit is called a Non-inverting zero
crossing detector. The circuit diagram is shown in the figure below.
Non-Inverting Zero Crossing Detector
When the input signal is above ground level, the output of the circuit is saturated at its
positive extreme. When the input goes below ground level, the output voltage of the circuit
immediately switches to its negative saturation level. Every time when the input signal
crosses the zero voltage level, the output switches between one saturation level and the
other. Since the output of the above circuit goes into positive saturation when the applied
input voltage is positive, the circuit is categorized as a non-inverting zero crossing detector.
The input and output waveforms of a typical non-inverting zero crossing detector is shown
in the above figure. Regardless of the shape of the input wave, the output is always a
rectangular wave.
If the input signal is applied to the inverting input terminal of the op-amp, and the non-
inverting input terminal is connected to ground, the circuit is called an inverting zero
crossing detector. The circuit is shown in the figure below.
Inverting Zero Crossing Detector
When the input is above ground level, the output is saturated at the negative extreme
voltage. When the input voltage goes below ground level, the output immediately switches
to positive saturation voltage. Since the output is saturated at negative voltage when the
input is positive, this circuit is called as an inverting zero crossing detector. The input and
output waveforms of an inverting zero crossing detector is shown in the figure above.
A Zero Crossing detector circuit with a feedback connection, usually positive, constitutes
the Schmitt trigger. The Schmitt trigger circuit has definite predefined upper and lower
input voltage levels that trigger the output to switch from one saturation level to the other.
The circuit of a typical Schmitt trigger is as shown in the figure above. The input voltage,
Vin, is applied to the inverting input terminal and a part of the output voltage is connected
as feedback to the non-inverting input terminal, through a potential divider network. The
input voltage Vin triggers the output voltage Vout to change from one saturation level to the
other, every time when the input voltage exceeds a certain predefined voltage levels. These
voltage levels are called as upper threshold voltage (VUT) and lower threshold voltage (VLT).
The upper and lower trigger points (threshold voltages) can be mathematically obtained by
using the relation,
Above equations indicate that by appropriately choosing the values of resistor R1 & R2, the
upper and lower threshold levels can be adjusted and controlled accurately.