AN1517

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Freescale Semiconductor AN1517

Application Note Rev 4, 11/2006

Pressure Switch Design with


Semiconductor Pressure Sensors
by: Eric Jacobsen and Jeff Baum
Sensor Design and Applications Group, Phoenix, AZ

INTRODUCTION BASIC SENSOR OPERATION


The Pressure Switch concept is simple, as are the additions The MPX2000 Series sensors are temperature
to conventional signal conditioning circuitry required to compensated and calibrated (i.e., offset and full-scale span
provide a pressure threshold (or thresholds) at which the are precision trimmed) pressure transducers. These sensors
output switches logic state. This logic-level output may be are available in full-scale pressure ranges from 10kPa
input to a microcontroller, drive an LED, control an electronic (1.5 psi) to 200 kPa (30 psi). Although the specifications (see
switch, etc. The user-programmed threshold (or reference Table 1) in the data sheets apply only to a 10 V supply voltage,
voltage) determines the pressure at which the output state will the output of these devices is ratiometric with the supply
switch. An additional feature of this minimal component voltage. For example, at the absolute maximum supply
design is an optional user-defined hysteresis setting that will voltage rating, 16 V, the sensor will produce a differential
eliminate multiple output transitions when the pressure sensor output voltage of 64 mV at the rated full-scale pressure of the
voltage is comparable to the threshold voltage. given sensor. One exception to this is that the full-scale span
This paper presents the characteristics and design criteria of the MPX2010 (10 kPa sensor) will be only 40 mV due to the
for each of the major subsystems of the pressure switch device's slightly lower sensitivity. Since the maximum supply
design: the pressure sensor, the signal conditioning (gain) voltage produces the most output voltage, it is evident that
stage, and the comparator output stage. Additionally, an entire even the best case scenario will require some signal
section will be devoted to comparator circuit topologies which conditioning to obtain a usable voltage level. For this specific
employ comparator ICs and/or operational amplifiers. A design, an MPX2100 and 5.0 V supply is used to provide a
window comparator design (high and low thresholds) is also maximum sensor output of 20 mV. The sensor output is then
included. This section will discuss the characteristics and signal conditioned to obtain a four volt signal swing (span).
design criteria for each comparator circuit, while evaluating
them in overall performance (i.e., switching speed, logic-level
voltages, etc.).

Table 1. MPX2100 Electrical Characteristics for VS = 10 V, TA = 25°C


Characteristics Symbol Minimum Typical Maximum Unit
Pressure Range POP 0 — 100 kPa
Supply Voltage VS — 10 16 VDC
Full Scale Span VFSS 38.5 40 41.5 mV
Zero Pressure Offset VOFF — 0.05 0.1 mV
Sensitivity S — 0.4 — mV/kPa
Linearity — — 0.05 — %FSS
Temperature Effect on Span — — 0.5 — %FSS
Temperature Effect on Offset — — 0.2 — %FSS

© Freescale Semiconductor, Inc., 2006. All rights reserved.


THE SIGNAL CONDITIONING For this specific design, the gain is set to 201 by setting
R6=20 kΩ and R5 = 100 Ω. Using these values and setting
The amplifier circuitry, shown in Figure 1, is composed of
R6=R3 and R4=R5 gives the desired gain without loading the
two op-amps. This interface circuit has a much lower
reference voltage divider formed by R1 and Roff. The offset
component count than conventional quad op amp
voltage is set via this voltage divider by choosing the value of
instrumentation amplifiers. The two op amp design offers the
Roff. This enables the user to adjust the offset for each
high input impedance, low output impedance, and high gain
application's requirements.
desired for a transducer interface, while performing a
differential to single-ended conversion. The gain is set by the
following equation:

R6
GAIN = 1 +
R5
where R6 = R3 and R4 = R5

Comparator Stage

R7
10.0 kΩ

VTH

Amplifier Stage
R4 R11
R6
100 Ω 4.75 kΩ
20 kΩ
R1
12.1 kΩ CN1
U1 R5
100 Ω U1 R10 Vout
R3 24.3 kΩ
GND
20 kΩ + +5 V
+ +
U1 V4
Roff LM324D Q1
MMBT3904LT1

RH
RTH 121 kΩ
10 kΩ
3 4
X1
MPX2100DP
2
1

Pressure Sensor
Figure 1. Pressure Switch Schematic

THE COMPARISON STAGE • A method for providing an appropriate amount of


hysteresis should be available. Hysteresis prevents
The comparison stage is the “heart” of the pressure switch
multiple transitions from occurring when slow varying
design. This stage converts the analog voltage output to a
signal inputs oscillate about the threshold. The hysteresis
digital output, as dictated by the comparator's threshold. The
can be set by applying positive feedback. The amount of
comparison stage has a few design issues which must be
hysteresis is determined by the value of the feedback
addressed:
resistor, RH (refer to equations in the following section).
• The threshold for which the output switches must be
programmable. The threshold is easily set by dividing the • It is ideal for the comparator's logic level output to swing
supply voltage with resistors R7 and RTH. In Figure 1, the from one supply rail to the other. In practice, this is not
threshold is set at 2.5 V for R7 = RTH = 10 kΩ. possible. Thus, the goal is to swing as high and low as
possible for a given set of supplies. This offers the greatest

AN1517
Sensors
2 Freescale Semiconductor
difference between logic states and will avoid having a LM311 USED IN A COMPARATOR CIRCUIT
microcontroller read the switch level as being in an
The LM311 chip is designed specifically for use as a
indeterminate state.
comparator and thus has short delay times, high slew rate,
• In order to be compatible with CMOS circuitry and to avoid and an open collector output. A pull-up resistor at the output is
microcontroller timing delay errors, the comparator must all that is needed to obtain a rail-to-rail output. Additionally, the
switch sufficiently fast. LM311 is a reverse logic circuit; that is, for an input lower than
• By using two comparators, a window comparator may be the reference voltage, the output is high. Likewise, when the
implemented. The window comparator may be used to input voltage is higher than the reference voltage, the output
monitor when the applied pressure is within a set range. is low. Figure 2 shows a schematic of the LM311 stage with
By adjusting the input thresholds, the window width can be threshold setting resistor divider, hysteresis resistor, and the
customized for a given application. As with the single open-collector pull-up resistor. Table 2 shows the
threshold design, positive feedback can be used to comparator's performance. Based on its performance, this
provide hysteresis for both switching points. The window circuit can be used in many types of applications, including
comparator and the other comparator circuits will be interface to microprocessors.
explained in the following section. The amount of hysteresis can be calculated by the following
equations:
EXAMPLE COMPARATOR CIRCUITS R2
V REF = ---------------------- V CC
Several comparator circuits were built and evaluated. R1 + R2
Comparator stages using the LM311 comparator, LM358 Op-
Amp (with and without an output transistor stage), and LM339 neglecting the effect of RH
were examined. Each comparator was evaluated on output
R1R2 + R2R H
voltage levels (dynamic range), transition speed, and the VREFH = ---------------------------------------------------------------- V CC
relative component count required for the complete pressure R1R2 + R1R H + R2R H
switch design. This comparison is tabulated in Table 2.
R2R H
VREFL = ---------------------------------------------------------------- V CC
VCC R1R2 + R1R H + R2R H

HYSTERESIS = V REF – V REFL


R1 U1 RPU
LM311
when the normal state is below VREF or
VIN VOUT
HYSTERESIS = V REFH – V REF

when the normal state is above VREF.

RH
R2

Figure 2. LM311 Comparator Circuit Schematic

Table 2. Comparator Circuits Performance Characteristics


Characteristics LM311 LM358 LM358 w/Trans. Unit
Switching Speeds — — — —
Rise Time 1.40 5.58 2.20 µs
Fall Time 0.04 6.28 1.30 µs
Output Levels — — — —
VOH 4.91 3.64 5.00 V
VOL 61.1 38.0 66.0 mV
Circuit Logic Type NEGATIVE NEGATIVE POSITIVE —

The initial calculation for VREF will be slightly in error due to


neglecting the effect of RH. To establish a precise value for

AN1517
Sensors
Freescale Semiconductor 3
VREF (including RH in the circuit), recompute R1 taking into extends from rail to rail and has a sufficiently high switching
account that VREF depends on R1, R2, and RH. It turns out that speed. The LM358 will perform well in applications where the
when the normal state is below VREF, RH is in parallel with R1: switching speed and logic-state levels are not critical (LED
output, etc.). The design of the LM358 comparator is
R2 accomplished by using the same equations and procedure
V REF = ------------------------------------- V CC
R1 || R H + R2 presented for the LM311. This circuit is also reverse logic.

(Which is identical to the equation for VREFH) VCC


Alternately, when the normal state is above VREF, RH is in
parallel with R2:
R2 || R H R1 U1
V REF = ------------------------------------- V CC LM358
R1 + R2 || R H VOUT
VIN

(Which is identical to the equation for VREFL) +


These two additional equations for VREF can be used to
calculate a more precise value for VREF.
The user should be aware that VREF, VREFH and VREFL are
chosen for each application, depending on the desired
switching point and hysteresis values. Also, the user must RH
specify which range (either above or below the reference
R2
voltage) is the desired normal state (see Figure 3). Referring
to Figure 3, if the normal state is below the reference voltage
then VREFL (VREFH is only used to calculate a more precise
value for VREF as explained above) is below VREF by the Figure 4. LM358 Comparator Circuit Schematic
desired amount of hysteresis (use VREFL to calculate RH).
Alternately, if the normal state is above the reference voltage, LM358 OP AMP WITH A TRANSISTOR OUTPUT
then VREFH (VREFL is only used to calculate a more precise STAGE USED IN A COMPARATOR CIRCUIT
value for VREF) is above VREF by the desired amount of The LM358 with a transistor output stage is shown in
hysteresis (use VREFH to calculate RH). Figure 5. This circuit has similar performance to the LM311
comparator: its output reaches the upper rail and its switching
speed is comparable to the LM311's. This enhanced
VREF (VREFUW)
performance does, however, require an additional transistor
Hysteresis and base resistor. Referring to Figure 1, note that this
VREFL comparator topology was chosen for the pressure switch
design. The LM324 is a quad op amp that has equivalent
amplifier characteristics to the LM358.

VCC
Normal State

U1 RPU
R1 Vout
LM358
Vin RB Q1
VREFH MMBT3904LT1

Hysteresis
VREF (VREFLW)
RH
Figure 3. Setting the Reference Voltages
R2
LM358 OP AMP USED IN A COMPARATOR CIRCUIT
Figure 4 shows the schematic for the LM358 op amp
comparator stage, and Table 2 shows its performance. Since
the LM358 is an operational amplifier, it does not have the fast Figure 5. LM358 with a Transistor Output Stage
slew-rate of a comparator IC nor the open collector output. Comparator Circuit Schematic
Comparing the LM358 and the LM311 (Table 2), the LM311 is
better for logic/switching applications since its output nearly

AN1517
Sensors
4 Freescale Semiconductor
Like the other two circuits, this comparator circuit can be combination of R2 and R3 (named R23 for identification) to
designed with the same equations and procedure. The values obtain the desired value for VREFUW, neglecting the effect of
for RB and RPU are chosen to give a 5:1 ratio in Q1's collector RHU:
current to its base current, in order to insure that Q1 is well- R23
saturated (VOUT can pull down very close to ground when Q1 V REFUW = ------------------------- V CC
R1 + R23
is on). Once the 5:1 ratio is chosen, the actual resistance
values determine the desired switching speed for turning Q1 The amount of hysteresis can be calculated by the following
on and off. Also, RPU limits the collector current to be within equation:
the maximum specification for the given transistor (see
example values in Figure 1). Unlike the other two circuits, this R23R HU
V REFUW = -------------------------------------------------------------------------------- V CC
circuit is positive logic due to the additional inversion created R1R23 + R1R HU + R23R HU
at the output transistor stage.
Notice the upper window reference voltage, VREFUW, is
LM339 USED IN A WINDOW
now equal to its VREFL value, since at this moment, the input
COMPARATOR CIRCUIT voltage is above the normal state.
Using two voltage references to detect when the input is
within a certain range is another possibility for the pressure HYSTERESIS = V REFUW – V REFL
switch design. The window comparator's schematic is shown
in Figure 6. The LM339 is a quad comparator IC (it has open where VREFL is chosen to give the desired amount of
collector outputs), and its performance will be similar to that of hysteresis for the application.
the LM311. The initial calculation for VREFUW will be slightly in error due
to neglecting the effect of RHU. To establish a precise value for
VCC
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
1 1 is calculated with the following equation:
R1 RPU
2 U1 2 R23
V REFUW = --------------------------------------------- V CC
LM339 R1 || R HU + R23
4
2
5 for the lower window threshold choose the value for VREFLW.
VREFUW

2 1
R3
1 RHU VOUT SetV REFLW = -------------------------------------------------------- V CC
R1 || R HU + R2 + R3
R2
2
U1
6 where R2 + R3 = R23 from above calculation.
VREFLW 1
2 1 7
To calculate the hysteresis resistor:
R5
The input to the lower comparator is one half VIN (since
2 1
R4 =R5) when in the normal state. When VREFLW is above
1 1 RHL
R4 one half of VIN (i.e., the input voltage has fallen below the
R3
2 2 window), RHL parallels R4, thus loading down VIN. The
resulting input to the comparator can be referred to as VINL (a
lower input voltage). To summarize, when the input is within
Figure 6. LM339 Window Comparator Circuit Schematic the window, the output is high and only R4 is connected to
Obtaining the correct amount of hysteresis and the input ground from the comparator's positive terminal. This
reference voltages is slightly different than with the other establishes one half of VIN to be compared with VREFLW.
circuits. The following equations are used to calculate the When the input voltage is below VREFLW, the output is low, and
hysteresis and reference voltages. Referring to Figure 3, RHL is effectively in parallel with R4. By voltage division, less
VREFUW is the upper window reference voltage and VREFLW is of the input voltage at VIN is required to make the noninverting
the lower window reference voltage. Remember that input exceed VRELW.
reference voltage and threshold voltage are interchangeable Therefore, the following equations are established:
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

AN1517
Sensors
Freescale Semiconductor 5
HYSTERESIS = V REFLW – V INL If hysteresis is desired, refer to the LM311 Used in a
Comparator section to determine RH.
Choose R4 = R5 to simplify the design. 2. To test this design, connect a +5 volt supply between pins
3 and 4 of the connector CN1.
R4R5 ( V REFLW – V INL – V CC )
R HL = ---------------------------------------------------------------------------------------V CC 3. Connect a volt meter to pins 1 and 4 of CN1 to measure
( R4 + R5 ) ( V INL – V REFLW ) the output voltage and amplified sensor voltage,
respectively.
NOTE:
As explained above, because the input voltage is divided in 4. Connect an additional volt meter to the VTH probe point to
half by R4 and R5, all calculations are done relative to the one verify the threshold voltage.
half value of Vin. Therefore, for a hysteresis of 200 mV 5. Turn on the supply voltage.
(relative to Vin), the above equations must use one half this
6. With no pressure applied, check to see that Voff is correct
hysteresis value (100 mV). Also, if a VREFLW value of 2.0 V is
by measuring the voltage at the output of the gain stage
desired (relative to Vin), then 1.0 V for its value should be used
(the volt meter connected to Pin 4 of CN1). If desired, Voff
in the above equations. The value for VINL should be scaled
can be fine tuned by using a potentiometer for Roff.
by one half also.
The window comparator design can also be designed using 7. Check to see that the volt meter monitoring VTH displays
operational amplifiers and the same equations as for the the desired voltage for the output to change states. Use a
LM339 comparator circuit. For the best performance, potentiometer for RTH to fine tune VTH, if desired.
however, a transistor output stage should be included in the 8. Apply pressure to the sensor. Monitor the sensor's output
design. via the volt meter connected to pin 4 of CN1. The output
will switch from low to high when this pressure sensor
TEST/CALIBRATION PROCEDURE voltage reaches or exceeds the threshold voltage.
1. Before testing the circuit, the user-defined values for RTH, 9. If hysteresis is used, with the output high (pressure
RH and Roff should be calculated for the desired sensor voltage greater than the threshold voltage), check
application. to see if VTH has dropped by the amount of hysteresis
The sensor offset voltage is set by desired.
A potentiometer can be used for RH to fine tune the amount of
V OFF
V OFF = -------------------------------V CC hysteresis.
R1 + R OFF
CONCLUSION
Then, the amplified sensor voltage corresponding to a The pressure switch design uses a comparator to create a
given pressure is calculated by: logic level output by comparing the pressure sensor output
VSENSOR = 201 × 0.0002 × APPLIED PRESSURE + VOFF, voltage and a user-defined reference voltage. The flexibility of
this minimal component, high performance design makes it
where 201 is the gain, 0.0002 is in units of V/kPa and compatible with many different applications. The design
APPLIED PRESSURE is in kPa. presented here uses an op amp with a transistor output stage,
The threshold voltage, VTH, at which the output changes yielding excellent logic-level outputs and output transition
state is calculated by determining Vsensor at the pressure that speeds for many applications. Finally, several other
causes this change of state: comparison stage designs, including a window comparator,
are evaluated and compared for overall performance.
RTH
VTH = VSENSOR (@ pressure threshold) = VCC
R7 + RTH

AN1517
Sensors
6 Freescale Semiconductor
NOTES

AN1517
Sensors
Freescale Semiconductor 7
How to Reach Us:
Home Page:
www.freescale.com

Web Support:
http://www.freescale.com/support
USA/Europe or Locations Not Listed:
Freescale Semiconductor, Inc.
Technical Information Center, EL516
2100 East Elliot Road
Tempe, Arizona 85284
+1-800-521-6274 or +1-480-768-2130
www.freescale.com/support

Europe, Middle East, and Africa:


Information in this document is provided solely to enable system and software
Freescale Halbleiter Deutschland GmbH
Technical Information Center implementers to use Freescale Semiconductor products. There are no express or
Schatzbogen 7 implied copyright licenses granted hereunder to design or fabricate any integrated
81829 Muenchen, Germany circuits or integrated circuits based on the information in this document.
+44 1296 380 456 (English)
+46 8 52200080 (English)
+49 89 92103 559 (German) Freescale Semiconductor reserves the right to make changes without further notice to
+33 1 69 35 48 48 (French) any products herein. Freescale Semiconductor makes no warranty, representation or
www.freescale.com/support guarantee regarding the suitability of its products for any particular purpose, nor does
Freescale Semiconductor assume any liability arising out of the application or use of any
Japan: product or circuit, and specifically disclaims any and all liability, including without
Freescale Semiconductor Japan Ltd. limitation consequential or incidental damages. “Typical” parameters that may be
Headquarters provided in Freescale Semiconductor data sheets and/or specifications can and do vary
ARCO Tower 15F in different applications and actual performance may vary over time. All operating
1-8-1, Shimo-Meguro, Meguro-ku, parameters, including “Typicals”, must be validated for each customer application by
Tokyo 153-0064
Japan customer’s technical experts. Freescale Semiconductor does not convey any license
0120 191014 or +81 3 5437 9125 under its patent rights nor the rights of others. Freescale Semiconductor products are
[email protected] not designed, intended, or authorized for use as components in systems intended for
surgical implant into the body, or other applications intended to support or sustain life,
Asia/Pacific: or for any other application in which the failure of the Freescale Semiconductor product
Freescale Semiconductor Hong Kong Ltd. could create a situation where personal injury or death may occur. Should Buyer
Technical Information Center purchase or use Freescale Semiconductor products for any such unintended or
2 Dai King Street unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and
Tai Po Industrial Estate its officers, employees, subsidiaries, affiliates, and distributors harmless against all
Tai Po, N.T., Hong Kong
+800 2666 8080 claims, costs, damages, and expenses, and reasonable attorney fees arising out of,
[email protected] directly or indirectly, any claim of personal injury or death associated with such
unintended or unauthorized use, even if such claim alleges that Freescale
For Literature Requests Only: Semiconductor was negligent regarding the design or manufacture of the part.
Freescale Semiconductor Literature Distribution Center
P.O. Box 5405
Denver, Colorado 80217 Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc.
1-800-441-2447 or 303-675-2140 All other product or service names are the property of their respective owners.
Fax: 303-675-2150 © Freescale Semiconductor, Inc. 2006. All rights reserved.
[email protected]

AN1517
Rev. 4
11/2006

You might also like