3–310
Motorola Sensor Device Data
For More Information On This Product,
Go to: www.freescale.com
LM339 Used in a Window Comparator Circuit
Using two voltage references to detect when the input is
within a certain range is another possibility for the pressure
switch design. The window comparator’s schematic is shown
in Figure 6. The LM339 is a quad comparator IC (it has open
collector outputs), and its performance will be similar to that of
the LM311.
Figure 6. LM339 Window Comparator Circuit Schematic
+
+
Vin
Vout
U1
LM339
VCC
RPU
R1
RHU
R2
2
R4
R3
2
RHL
VREFLW
R5
VREFUW
1
2
1
2
2
1
2
1
1
1
2
2
1
4
5
6
7
1
2
1
U1
Obtaining the correct amount of hysteresis and the input
reference voltages is slightly different than with the other
circuits. The following equations are used to calculate the
hysteresis and reference voltages. Referring to Figure 3,
VREFUW s he upper window eference voltage and VREFLW
is the lower window reference voltage. Remember that
reference voltage and threshold voltage are interchangeable
terms.
For the upper window threshold:
Choose the value for VREFUW and R1 (e.g., 10 k
). Then,
by voltage division, calculate the total resistance of the
combination of R2 and R3 (named R23 for identification) to
obtain the desired value for VREFUW, neglecting the effect of
RHU:
VREFUW
R23
R1
R23VCC
The amount of hysteresis can be calculated by the following
equation:
VREFL
R23RHU
R1RHU
R1R23
R23RHU
VCC
Notice that the upper window reference voltage, VREFUW,
is now equal to its VREFL value, since at this moment, the
input voltage is above the normal state.
HYSTERESIS
VREFUW
VREFL,
where VREFL is chosen to give the desired amount of
hysteresis for the application.
The initial calculation for VREFUW will be slightly in error
due to neglecting the effect of RHU. To establish a precise
value for VREFUW (including RHU in the circuit), recompute
R1 taking into account that VREFUW depends on R2 and R3
and the parallel combination of R1 and RHU. This more
precise value is calculated with the following equation:
VREFUW
R23
RHU
R1
R23
VCC
for the lower window threshold choose the value for VREFLW.
Set VREFLW
R3
R1
RHU
R2
R3
VCC,
where R2 + R3 = R23 from above calculation.
To calculate the hysteresis resistor:
The input to the lower comparator is one half Vin (since
R4 = R5) when in the normal state. When VREFLW is above
one half of Vin (i.e., the input voltage has fallen below the win-
dow), RHL parallels R4, thus loading down Vin. The resulting
input to the comparator can be referred to as VINL (a lower in-
put voltage). To summarize, when the input is within the win-
dow, the output is high and only R4 is connected to ground
from the comparator’s positive terminal. This establishes one
half of Vin to be compared with VREFLW. When the input volt-
age is below VREFLW, the output is low, and RHL is effectively
in parallel with R4. By voltage division, less of the input voltage
will fall across the parallel combination of R4 and RHL, de-
manding that a higher input voltage at Vin be required to make
the noninverting input exceed VREFLW.
Therefore the following equations are established:
HYSTERESIS
VREFLW
VINL
Choose R4 = R5 to simplify the design.
RHL
R4R5 VREFLW
VINL
VCC
(R4
R5) VINL
VREFLW
IMPORTANT NOTE:
As explained above, because the input voltage is divided in
half by R4 and R5, all calculations are done relative to the one
half value of Vin. Therefore, for a hysteresis of 200 mV (relative
to Vin), the above equations must use one half this hysteresis
value (100 mV). Also, if a VREFLW value of 2.0 V is desired
(relative to Vin), then 1.0 V for its value should be used in the
above equations. The value for VINL should be scaled by one
half also.
The window comparator design can also be designed using
operational amplifiers and the same equations as for the
LM339 comparator circuit. For the best performance,
however, a transistor output stage should be included in the
design.
F
Freescale Semiconductor, Inc.
n
.