You are on page 1of 7

To Study Comparator

Ikjot Dhawan, 13
Btech ECE A
Lovely Professional University

ABSTRACT: Introduction of a comparator and its When else Equality of input values is very
working with its applications are given in this term difficult to achieve in practice. The speed at which
paper.The two type of comparators as Inverting and the change in output results from a change in input
non invering are discussed in this term paper.This term (often to 100ns, but can be as slow as a few tens of
paper tells Op-amp implementation of voltage
micro second.[2]
comparator and several voltage comparator ICs such as
LM339. In this term paper hysteresis loss is also
discussed . Different comparator applications as Zero 3. SEVERAL VOLTAGE COMPARATR ICs:
crossing detector,Window detector,Time maker
generator, Phase meter , Schmitt Trigger are discussed A dedicated voltage comparator chip, such
in this term paper. as the LM339, is designed to interface directly to
digital logic (for example TTL or CMOS). The
1. COMPARATOR output is a binary state, and it is often used to
interface real world signals to digital circuitry (see
A comparator is a circuit which compares a analog to digital converter). If one of the voltages is
signal voltage applied at one input of an op amp with fixed, for example because a DC adjustment is
a known reference voltage at the other input. It is possible in a device earlier in the signal path, a
basically an open loop op amp with output + Vsat. It comparator is just a cascade of amplifiers.
may be seen that the change in the output state takes When the voltages are nearly equal, the
place with an increment in input Vi of only 2 mv. output voltage will not fall into one of the logic
There are basically two types: levels, thus analog signals will enter the digital
 Non-inverting comparator domain with unpredictable results. To make this
 Inverting comparator. range as small as possible the cascade is long and
A dedicated voltage comparator will generally high gain, that is bipolar transistors instead of field
be faster than a general-purpose op-amp pressed into effect transistors are used, except sometimes for the
service as a comparator. A dedicated voltage first stage. For high speed the input impedance of the
comparator may also contain additional features such stages is made low.
as an accurate, internal voltage reference, an This already reduces the saturation of the
adjustable hysteresis and a clock gated input.[1] slow, large P-N junction of the bipolar transistors,
which would otherwise lead to long recovery times.
2. Op-amp implementation of voltage Fast that is small Schottky diodes as in binary logic
comparator: are applied to improve matters even further. Also like
in binary logic the speed is not as high as if the
A standard op-amp operating without negative amplifiers would be used for analog signals. Slew
feedback can be used as a comparator. When the non- rate has no meaning for these devices.
inverting input (V+) is at a higher voltage than the For the application in flash ADCs after each
inverting input (V-), the high gain of the op-amp amplifier the signal can be fanned out over 8 ports
causes it to output the most positive voltage it can. matched to the voltage and current gain and resistors
When the non-inverting input (V+) drops below the are used as level-shifters.
inverting input (V-), the op-amp outputs the most The LM339 accomplishes this with an open
negative voltage it can. Since the output voltage is collector output. When the inverting input is at a
limited by the supply voltage, for an op-amp that uses higher voltage than the non inverting input, the
a balanced, split supply, (powered by ± VS) this output of the comparator is connected to the negative
action can be written: power supply. When the non inverting input is higher
than the inverting input, the output is floating (has a
Vout=V.sgn(V+-V-) very high impedance to ground).

Where signs(x) is the sign function. 4. OP AMP COMPARATOR:


Generally, the positive and negative supplies VS will
not match absolute value: The circuit diagram of the Op Amp Comparator
is given below:
You connect V- to ground (0V), then apply
Vin to V+. (Since there's no current through R1, VIN
essentially appears at V+.) What happens at the
output? In theory, when Vin > V- = 0V, the output
goes to a POSITIVE Output State. And, not
surprising, when Vin < V- = 0V, the output goes to a
NEGATIVE Output State. Zener diodes D1 and D2
set the positive and negative output levels: VP = Vf D1
+ VZ D2 and VN = Vf D2 + VZ D1.

5.1. Current inside:

VIN applies a 10V peak sinewave to the


input. The output swings to the POSITIVE and
Fig 1. Operational amplifier circuit. NEGATIVE States of +5 V and -5 V, respectively.
The challenge sounds simple enough - take a 60 Run a simulation of Operational amplifier circuit.Plot
Hz (or 50 Hz) sinewave from the AC power line and the input V(2) and output V(6). It appears the
convert it to a square wave. This signal will serve as comparator performs well as a zero-crossing detector
a clock to drive counters for a 24 hour time clock. So and all is right with the world.
you hook up an op amp as a comparator to do the job. However, the real world throws in a few "goodies"
But your surprised to see the clock running too fast! for free - mostly noise where you need it the least. So
With oscilloscope in hand you discover the AC line is let's add some noise by changing the VNOISE statement
noisy! And to your horror, you see glitches to read 1VPEAK instead of 0VPEAK. VNOISE adds a 1V
(additional edges) at the comparator's output, causing @ 2.5 kHz sinewave ontop of our pristine 60 Hz.
the counters to advance too quickly. What you need Rerun the simulation and let's look at our output now.
is a better comparator, immune to the noise swinging Unfortunately, our fine square wave is rife chatter - it
convert it to a square wave. This signal will serve as no longer provides one rising edge per 60 Hz cycle.
a clock to drive counters for a 24 hour time clock. So
you hook up an op amp as a comparator to do the job. 6. COMPARATOR WITH HYSTERESIS:
But your surprised to see the clock running too fast!
With oscilloscope in hand you discover the AC line is How do we overcome the problems of the basic
noisy! And to your horror, you see glitches comparator? Just add some positive feedback to the
(additional edges) at the comparator's output, causing circuit.
the counters to advance too quickly. What you need
is a better comparator, immune to the noise swinging
above and below the comparator's threshold.

5. SIMPLE COMPARATOR

The elementary comparator looks similar to


circuit below.

Fig 3. Comparator with Feedback.

Notice, how V+ is developed - its now a


combination of the both the input VIN and the output
Fig 2. Simple Clamp circuit. state Vo. This basically means that there are two
thresholds: one when for a POSITIVE Output State 6.2. Hands on design:
and another for the NEGATIVE Output State.(For
now, assume VREF = 0) Return VNOISE back to 0VPEAK. Choose
What are these two thresholds? Some simple different values for R1 and R2. and rerun the SPICE
math uncovers the answer. First, we need to find the file. Does the comparator switch where you expect?
voltage at V+. You can change the voltage levels of VP and VN by
changing the zener diode's reverse voltage parameter
V+ = VIN ∙ R2/(R1 + R2) + Vo ∙ R1/(R1 + R2) BV. Also, no one says that VP and VN must be equal
Next, recall that the op amp's switching and opposite. Now add some noise onto the circuit.
threshold occurs at V+ = V- = 0. So the question What's the largest noise the circuit can tolerate before
becomes, what value of VIN causes V+ = 0V. To unwanted edges appear?
accomplish this, we solve the above equation for VIN
when V+ = 0. The only tricky part lies in the fact that 7. VOLTAGE COMPARATOR INFORMATION AND
one of the variables, Vo, can be in one of two states: CIRCUITS:
POSITIVE Output State Vo = VP NEGATIVE
Output State Vo = VN This page provides basic information about
So we solve the above equation first with Vo = VP voltage comparator integrated circuits and is to act as
and then Vo = VN. We get two thresholds for VIN: reference material for other circuits. The circuits
Vth+ = - VN ∙ R1 / R2 shown are based on the LM339 Quad Voltage
Vth- = - VP ∙ R1 / R2 Comparator chip or the LM393 Dual Voltage
In a nutshell, this is how the comparator operates. Comparator chip. These devices are functionally
To get to the POSITIVE Output State identical. The LM311 Voltage Comparator can be
Assume Vo = VN. used for these applications as well and also has a
The input must rise above the threshold: number of unique features.
VIN > Vth+
To get to the NEGATIVE Output State
Assume Vo = VP.
The input must fall below the threshold:
VIN < Vth-
Having two thresholds based on both the input VIN
and the current output state is called hysteresis. As an
example, suppose
VP = +5V, VN = -5V,
R1 = 1k and R2 = 5k. You get two thresholds
Vth+ = - (-5V) ∙ 1k / 5k = +1V
Vth- = - 5V ∙ 1k / 5k = -1V

6.1. Current Insight :

Now, let's see the two thresholds in action. Add


R2 into the picture by removing the comment Fig 4. Internal Circuitry For 1/4 Of An LM339
character "*" before the R2 statement. Also return
VNOISE to 0VPEAK.
Run a new simulation of Operational amplifier
circuitand plot the input V(2) and output V(6). Check
it out! The output switches at VIN = 1 V on the way
up, but, switches state at VIN = -1 V on the way
down. So why go through all this trouble of creating
two thresholds?
Here's why. Just add some noise back onto our
60 Hz by changing the VNOISE amplitude parameter to
1VPEAK. Where has all the chatter gone? By choosing
thresholds separated by a voltage larger than the
noise, the comparator's output produces a nice clean
squarewave. Fig 5. Pin Diagram For An LM339
Print the diagram in the centre of a sheet of input is lower than the voltage at the
paper and then draw a circuit using the ICs pin MINUS input.
locations.
2. Current WILL NOT flow through the open
collector when the voltage at the PLUS
input is higher than the voltage at the
MINUS input.

Fig 6. Pin Diagram For An LM393

8. COMPARATOR OPERATION:

The following drawing show the two Fig 7. Comparator Rule Sheet
simplest configurations for voltage comparators. The
diagrams below the circuits give the output results in 9.2. Input Vs. Output Results
a graphical form.
For these circuits the REFERENCE voltage
is fixed at one-half of the supply voltage while the Voltage comparators are not perfect devices
INPUT voltage is variable from zero to the supply and in some instances may suffer from the effects of
voltage. In theory the REFERENCE and INPUT a parameter known as the Input Offset Voltage. This
voltages can be anywhere between zero and the problem normally occurs when the Input voltage
supply voltage but there are practical limitations on changes very slowly. The Input Offset Voltage for
the actual range depending on the particular device many comparators is only a few millivolts and in
used.[3] most circuits it can be ignored.The net result of the
Input Offset Voltage is that the output transistor does
9. BASIC COMPARATOR OPERATION: not fully turn on or off when the input voltage is
9.1. Input Vs. Output Results close to the reference voltage.
1. Current WILL flow through the open
collector when the voltage at the PLUS
The following diagram attempts to illustrate the transitions at the output when changing state.
effect of the input offset voltage with a slowly Sometimes, in a discrete design, there is a need to
changing input voltage. This effect increases as the add an external resistor between the comparator's
output transistor current increases so keeping the output and the positive input, creating a weak
value of RL high will help reduce the problem. positive feedback loop. When the output makes a
transition, the positive feedback slightly changes the
positive input so as to reinforce the output change.

A mechanical analog of this effect can be found in


many electrical switches. As you move the handle
just past the center point, a spring in the switch will
try to pull the handle all the way over, ensuring that
the switch ends up in a definite ON or OFF state.[3]

Fig 9. Effect of input offset voltage

9.3. Effect of input offset voltage and hysterisis:


Fig 10. The hysterisis graph
The effects of the input offset voltage can be
countered by adding hysterysis to the circuit. This 11. INPUT HYSTERYSIS:
causes the reference voltage to change when the
comparators output goes high or low. The diagram above shows a hysteresis 'loop' that
describes how a comparator functions. The horizontal
The effect is that as the input voltage slowly 'X' axis is the input, and represents the difference of
changes the reference voltage will quickly change in the two input voltages. The vertical "Y" axis
the opposite direction. This gives the comparator a represents the comparator's output state.
"snap" action. See the following paragraphs for more
information. If the comparator is initially 'OFF', the MINUS
input voltage has to become slightly above the PLUS
10. AN EXPLANATION OF INPUT HYSTERYSIS input voltage before the comparator output turns
VOLTAGE: 'ON'. This is represented by moving right along the
bottom part of the loop.
Hysteresis is the difference between the input
signal levels at which a comparator turns off and Once the comparator is 'ON', the MINUS input
turns on. A small amount of hysteresis can be useful voltage needs to drop slightly below the PLUS input
in a comparator circuit because it reduces the circuit's voltage
sensitivity to noise, and helps reduce multiple
5. Schmitt Trigger.

12.1. Zero crossing detector :

A zero crossing detector literally detects the


transition of a signal waveform from positive and
negative, ideally providing a narrow pulse that
coincides exactly with the zero voltage condition. At
first glance, this would appear to be an easy enough
task, but in fact it is quite complex, especially where
high frequencies are involved. In this instance, even
1kHz starts to present a real challenge if extreme
accuracy is needed.

12.1.1. Basic Low Frequency Circuit

Figure shows the zero crossing detector as used


for the dimmer ramp generator in Project 62. This
circuit has been around (almost) forever, and it does
work reasonably well. Although it has almost zero
phase inaccuracy, that is largely because the pulse is
so broad that any inaccuracy is completely swamped.
The comparator function is handled by transistor Q1 -
very basic, but adequate for the job.

Fig 11. Adding hysterisis to comparator


Figure 1 - Basic 50/60Hz Zero Crossing Detector
12. APPLICATIONS OF COMPARATOR:
The circuit is also sensitive to level, and for
Some important applications of comparator are: acceptable performance the AC waveform needs to
be of reasonably high amplitude. 12-15V AC is
typical. If the voltage is too low, the pulse width will
1. Zero crossing detector. increase. The arrangement shown actually gives
2. Window detector better performance than the version shown in Project
3. Time maker generator 62 and elsewhere on the Net. In case you were
4. Phase meter. wondering, R1 is there to ensure that the voltage falls
to zero - stray capacitance is sufficient to stop the
circuit from working without it.

13. CONCLUSION:

There are many problems that we


understand while we do deep study in the
comparator. In comparator with hysteresis there will
be a problem that is how do we overcome the
problems of the basic comparator. It can be improved
by just add some positive feedback to the circuit .

Main problem is in application ZCD. The


pulse width of circuit (at 50Hz) is typically around
600us (0.6ms) which sounds fast enough. The
problem is that at 50Hz each half cycle takes only
10ms (8.33ms at 60Hz), so the pulse width is over
5% of the total period. This is why most dimmers can
only claim a range of 10%-90% - the zero crossing
pulse lasts too long to allow more range.

14. REFERENCE:

i. www.google.co.in/search?client=firefoxa&rl
s=org.mozilla%3AenUS%3Aofficial&channel
=s&hl=en&q=COMPARATOR&meta=btnG=G
oogle+Search

ii. http://en.wikipedia.org/wiki/Comparator.

iii. http://home.cogeco.ca/~rpaisley4/Compar
ators.html

iv. http://www.maximic.com/appnotes10.cfm/a
c_pk/3#79

You might also like