
Using
Comparators
to
Detect
and
Measure
Discover how to use op -amps
to
monitor real -world
conditions
OUTPUT
3
OUTPUT
4
GND
INPUT
4+
INPUT
4-
INPUT 3
INPUT
3-
14
13 11
10
13
OUTPUT
2 OUTPUT
1 V+ INPUT
1-
INPUT
1+ INPUT 2-
INPUT
1
Fig.
1 -The LM339
contains
four independent
comparators
and
can operate
from
single
or
dual -voltage
power supplies.
By Jan Axelson
Comparator circuit
chips offer the experimenter some
of the easiest op -amp circuits
with which
to experi-
ment. Unlike other op -amps,
whose
outputs
vary
line-
arly
with
their inputs, the outputs of comparators
switch
between
just
two
voltage
levels, depending on the relative
voltages at their inputs. You could compare a comparator
to a toggle switch.
When
the toggle, or
lever, is raised slowly
(in a linear fashion) it
will
suddenly snap to the on position -
there's no in- between! Likewise, as the toggle is lowered,
the
inner
switch mechanism flips to the off
position. The
comparison
stops here, because
comparator
circuits are much
more
flexible
than
ordinary
toggle
switches.
The one -of- two -state characteristic makes comparators
ideal
for
voltage
monitoring in test or alarm circuits. Any condi-
tion, such as temperature or light, that
can be sensed as a
voltage
can be monitored
with
a comparator. Besides using
comparators in simple
voltage-
detecting circuits, you can
use a pair of comparators to detect
whether
an input falls
within a range of
voltages;
or use a series of comparators to
control a bar -graph display, for a good -looking and more
precise indication of signal levels.
The circuits that follow are interesting and typical exam-
ples of
comparators
in
action,
and
can
be
used
to guide
you
in choosing and using comparators to fit your own circuit -
crafting needs.
Whats
Special
About
Comparators?
Although
some op -amps are specifically
designated corn -
parators, in many cases a general- purpose
op-amp can also
serve
the same purpose. The dominant limitation
is that op-
amps often include phase and frequency compensation for
better closed
-loop stability. Since comparator circuits oper-
ate open -loop (without negative feedback),
they don't need
this compensation and respond faster without it.
Most of the examples in this article use the low
-cost
and
readily available LM339,
which
contains four independent
comparators on one chip. Figure 1 shows the LM339 chip's
pin out. Conveniently, the chip can be powered from a single
62
supply
of from 2- to 36 -volts DC or from
dual supplies
(± 1- to
±
18 -volts DC).
Supply
-current
requirements are
less than one milliampere,
low enough to allow
battery -
powered operation.
Comparator
Basics
Figure
2
shows a basic comparator circuit using the LM339.
The voltage
to be sensed (Vii) is
connected to the
+ input
(pin 5), and the reference, or trip- point, voltage
(Vref) is at
the input
(pin
4). The
comparator's operation is straightfor-
ward: When
Vin
is greater than Vre1, Voui (at
pin 2) goes high,
and
when
Vin
is less than
Vref, Vou1 goes
low. Figure
3
illus-
trates the comparator's response (VWd
to a changing input
(Vii)
compared to a fixed
voltage
(Vref).
+9voc
v
Fig. 2 -In this basic comparator circuit. Vout
goes
high when V,0 is greater than
Vrel
. On the other
hand. the output
voltage
(Vout)
goes low
when V,,,
is less than
Vret
. The reference
voltage
determines
the comparator's toggle point.
For inverting operation
(that
is
having the
VWi
high and
then go low
when the
Ví
goes
from low to high)
Vref
and
Vin
are swapped at the comparator's pin connections
in Fig.
2. The reference connects to the
+ input,
and
Vin
connects
to the input.
Now
VW1
of the comparator
will
go
high
when
Vin
is
less than
Vref.
A light- emitting
diode (LED) provides a simple indicator
of a comparator's
output state. The circuits
in Fig. 4 show
several ways of interfacing an LED to a comparator's
output.
Komentarze do niniejszej Instrukcji