Analog Sensor Conditi oning Circuits – An Ov erview
Author:Kumen Blake
Microchip Technology Inc.
INTRODUCTION
Target Audience
This application note is intended for hardware design
engineers that need to co nditio n the output of commo n
analog sensors.
Goals
• Review sensor applications (e.g., temperature)
• Review sensor types (e.g., voltage output)
• Show various conditioning circuits
• Give technical references
Description
Analog sensors produce a change in an electrical
property to indicate a change in its environment. This
change in electrical property needs to be conditioned
by an analog circuit before conversion to digital.
Further processing occurs in the digital domain but is
not addressed in this application note.
The applications mentioned are:
• Electrical
• Magnetic
• Temperature
• Humidity
• Force, Weight, Torque and Pressure
• Motion and Vibration
•Flow
• Fluid Level and Volume
• Light and Infrared (IR)
•Chemistry
For each type of electrical property, commonly used
conditioning circuits are shown. Each circuit has an
accompanying list of advantages and disadvantages,
and a list of sensor types appropriate for that circuit.
The electrical properties covered are:
•Voltage
• Current
• Resistance
• Capacitance
•Charge
In addition, circuit and firmware concerns common to
many embedded designs are briefly mentioned:
• Input Protection
• Sensor Failure Detection
•Filtering
• Analog-to-Digital (A-to-D) Conversion
• Correction of Results
References to documents that treat these subjects in
more depth have been included in the “References”
section.
SENSOR APPLICATIONS
This section reviews a few analog sensor applications.
For each application, a list of common sensor types is
given for convenience. A good resource for many of
these applications is OMEGA
handbooks [1, 2].
There are many more analog sensors than the ones
discussed in this application note. For example:
• Time/frequency counters [14]
• Distance ranging sensor [25]
• Current sensing transformer [6]
Emphasis is placed on the electrical behavior of the
various sensors. It is necessary to know this
information when selecting an appropriate sensor
conditioning circu it.
Electrical
These applications measure the state at some point in
an electrical circuit. They include monitoring the
condition of a crucial electrical circuit or power source.
These sensors are used to detect magnetic field
strength and/or direction. They are commonly used in
compasses and motor control [6].
TABLE 2:MAGNETIC APPLICATIONS
SensorElectrical Parameter
Hall effect [6]Voltage
Magneto-resistiveResistance
Temperature
The most common sensor application is temperature
measurement. Some common sensors are listed in
Table 3. Overviews of temperature sensors can be
found in the references [14, 15].
Light and IR are used t o detec t the pre sence of obje ct s
(e.g., people in a burglar alarm) and reduction in
visibility (smoke and turb idity detectors).
TABLE 9:LIGHT AND IR
APPLICATIONS
SensorElectrical Parameter
Photodiode [22, 23]Current
Chemistry
Table 10 gives a short list of sensors that detect
chemical conditions.
TABLE 10:CHEMISTRY APPLICATIONS
SensorElectrical Parameter
pH ElectrodeVoltage (with high output
impedance)
Solution ConductivityResistance
CO SensorVoltage or Charge
Turbidity (photodiode)Current
Colorimeter (photodiode) Current
Advantages
• High input impedance
• Low bias current (CMO S op amps)
• Positive gain
• Simplicity
Disadvantages
• Limited input voltage range
• Input stage distortion
• Amplifies common mo de nois e
Sensor Examples
• Thermocouple
• Thermo pile
• Piezo-ele ctric film
BUFFER FOR HIGH IMPEDANCE VOLTAGE
SOURCE
This circuit requires a FET input op amp (e.g., CMOS
input); see Figure 2. The FET input gives very high
input impedance and ve ry low in put bia s curre nt, esp ecially at room temperature (the ESD diodes conduct
more current at higher temperatures). The operational
amplifier (op amp) is used as a non-inverting amplifier.
BASIC SIGNAL CONDITIONING
CIRCUITS
This section is organized by the sensor’s electrical
property . For eac h sensor electri cal property liste d, one
or more conditioning circuits are shown. Advantages,
disadvantage s and sen sor examples are listed for each
circuit.
Voltage Sensors
The circuits in this se ction cond ition a vol tage p roduced
by a sensor.
NON-INVERTING GAIN AMPLIFIER
Figure 1 shows a non-inverting gain amplifier using an
op amp. It presents a hi gh impe dance to the sens or (at
) and produces a positive gain from V
V
SEN
V
DD
V
SEN
R
1
MCP6XXX
R
2
FIGURE 1:Non-inverting Gain Amplifier.
SEN
V
OUT
to V
OUT
V
DD
V
SEN
R
1
FET Input Op Amp
MCP6XXX
R
2
V
OUT
FIGURE 2:Non-inverting Gai n Amplifier
for High-Impedance Sensors with Voltage Output.
The pH electrode’s impedance is a function of temperature and can be quite large. Its output voltage is
proportional to absolute temperature.
INVERTING GAIN AMPLIFIER
Figure 3 shows an inverting gain amplifier using an op
amp. It presents an impedance of R
) and produces a negative gain from V
V
SEN
V
.
OUT
V
DD
to the sensor (at
1
SEN
to
MCP6XXX
V
OUT
V
SEN
R
1
R
2
FIGURE 3:Inverting Gain Amplifier.
Advantages
• Resistive isolation from the source
• Large input voltage range is possible
• Virtually no input stage distortion
• Simplicity
Disadvantages
• Resistive loading of the source
• Inverti ng gain
• Amplifies common mode noise
Advantages
• Resisti ve isolation from the source
• Large input voltage range is possible
• Rejects common mo de noi se ; it is good for
remote sensors
• Simplicity
Disadvantages
• Resistive loading of the source
• Input stage distortion
Sensor Examples
• Remote thermocouple
• Wheatstone bridge
INSTRUMENTATION AMPLIFIER
Figure 5 shows an instrument ation am plifi er circu it that
conditions a remote volt age s enso r. The input resistors
provide isolation and detection of sensor open-circuit
failure. It amplifies the input difference voltage
(V
SEN
V
V
+–V
SEN
SEN
–) and rejects common mode noise.
SEN
V
DD
V
R
1
R
+
–
R
R
1
DD
2
Instrumentation
Amplifier
V
2
REF
V
OUT
Sensor Examples
• Thermo pile
• High-side (VDD) voltage sensor
DIFFERENCE AMPLIFIER
Figure 4 shows a diffe renc e ampli fie r usin g an op am p.
It presents an impedance of R
sensor (V
difference voltage (V
V
SEN
SEN
+
+ and V
SEN
R
1
SEN
+–V
to each end of the
1
–) and amplifies the input
–).
SEN
R
2
V
DD
MCP6XXX
V
OUT
V
–
SEN
R
1
R
2
FIGURE 4:Difference Amp.
FIGURE 5:Instrumentation Amplifier.
Advantages
• Excellent rejection of common mode noise; it is
great for remote sensors
• Resisti ve isolation from the source
• Detection of sensor failure
Disadvantages
• Resistive loading of the source
•Cost
Sensor Examples
• Remote thermocouple
• Remote RTD (with a current source or voltage
divider to produce a voltage from the RTD)
V ARIABLE GAIN FOR WIDE DYNAMIC RANGE
AND NON-LINEAR SENSORS
Figure 6 shows a Programmable Gain Amplifie r (PGA)
used to condition multiple sensors. These PGAs (e.g.,
MCP6S22) allow the user to sel ect an input se nsor and
gain with the SPI™ bus. It can also help linearize
non-linear sensors (e.g., a thermistor; see [16]).
V
DD
MCP6SX2
V
V
SEN
CH0
CH1
DD
V
OUT
V
OUT
4
SPI™ Control
V
REF
V
To other
SS
sensor
FIGURE 6:Programmable Gain
Amplifer.
Advantages
• Multiple sensors (input MUX)
• CMOS input (high impedance and low bias
current)
• Digital control (SPI) of input and gain
• Linearization of non-linear sources
Disadvantages
• Input stage distortion
• Amplifies common mode noise
• Needs microcontroller unit (MCU) and firmware
Sensor Examples
• Thermistor (with voltag e div ider to convert
resistance to voltage)
• Thermo pile
• Piezo-electric film
Current Sensors
The circuits in this sectio n condit ion a cu rrent p roduced
by a sensor.
RESISTIVE DETECTOR
Figure 7 shows a resistor (R1) that converts the se nsor
current (I
difference amplifier that amplifies the voltage across
the resistor while rejecting common mode noise.
The sensors in this section produce a change in resistance. There are four basic strategies shown here for
converting this resistance into a measurable electrical
quantity:
• Resistance-to-voltage conversion
• Resistance-to-current conversion
• RC decay
• Oscillator frequency
RESISTANCE-TO-VOLTAGE CONVERSION
The first strategy for conditioning a resistive sensor is
to produce a voltage that is a function of the change in
resistance.
Voltage Divider
Figure 10 shows a voltage divider (R
converts the sensor resistance to a voltage. The op
amp buffers the voltage divider for further signal
processi ng. This approach ha s been used in AN867
and AN897 [21, 16].
V
DD
V
R
SEN
DD
MCP6XXX
R
1
FIGURE 10:Voltage Divider with
Op Amp.
Advantages
• Simplicity
• Ratiometric output (with an Analog-to-Digital
Converter (ADC) using V
voltage)
• Detection of open sensor (failure)
as its reference
DD
and R1) that
SEN
V
OUT
Voltage Divider and Variable Gain
Figure 11 shows a voltage divider (R
converts the sensor resistance to a voltage. The PGA
buffers the voltage divider for further signal processing
and can be set to different gains when the sensor is
non-linear.
V
DD
R
R
1
SEN
CH0
CH1
SPI™ Control
V
REF
V
DD
MCP6SXX
V
DD
V
SS
To other
sensor
V
SEN
OUT
and R1) that
V
OUT
4
FIGURE 11:Voltage Divider with PGA.
Advantages
• Linearization of non-linear sensors
• Ratiometric output (with an ADC using VDD as its
reference voltage)
• Multiplexing several sensors
• Detection of open sensor (failure)
Disadvantages
• Poor common mode noise rejection
• Needs a controller and firmware
• Voltage is a non-linear function of resistance
Sensor Example
•Thermistor
Wheatstone Bridge
Figure 12 shows a Wheatstone bridge that converts a
change in resist ance to a chang e in dif ferentia l volt age.
The op amp amplifies the difference voltage.
Disadvantages
• Poor common mode noise rejection
• Voltage is a non-linear function of resistance
V
DD
R
1
R
SEN
V
DD
MCP6XXX
Sensor Examples
•Thermistor
R
SEN
R
1
V
OUT
•RTD
• Magneto-resistive compass
R
2
FIGURE 12:Wheatstone Bridge – Single
Op Amp Circuit.
The second strategy for condi tionin g a resis tive se nsor
is to produce a current that is a function of the
resistance. F igure 15 show s the ba sic st rateg y, where
the “I-to-V Amplifier” can be a transimpedance amp
(Figure 8) or a logarithmic amp (Figure 9).
• Ratiometric output (with an ADC using VDD as its
reference voltage)
• Simplicity
Disadvantages
• Inverti ng gain
Sensor Example
•Thermistor
RC DECAY
The third strategy for conditioning a resistive sensor is
to produce a voltage with a RC decay (single pole
response to a step). The time it takes for the voltage to
decay to a threshold is a measure of the resistance.
Figure 16 show a circuit using a MC U circuit that sets a
ratiometric threshold (proportional to V
measured for both R
correct for V
PICmicro
, C1, and temperature errors. The
DD
®
MCU provides the switching and control
and R
1
separately in order to
SEN
). The time is
DD
needed. Application notes AN863, AN512 and AN929
[7, 11, 14] detail variations of this circuit.
PICmicro® MCU
R
SEN
P
2
R1
P
1
P
0
C
1
FIGURE 16:RC Decay.
Advantages
• Ratiometric correction of VDD, C1 and
temperature errors
The fourth strategy for conditioning a resistive sensor is
to measure a change in oscillation frequency;
Figure 17 shows one implementation. It is a state
variable oscillator using resistors, capacitors, op amps
and a comparator. Its operation and design are det ailed
in application notes AN866 and AN895 [4, 12].
C
4
R
V
DD
1
MCP6XXX
R
5
R
6
C
1
V
DD
C
5
MCP6XXX
V
R
DD
2
MCP6XXX
C
2
V
DD
R
VDD/2
R
3
7
R
V
DD
MCP65XX
R
V
DD
MCP6XXX
8
4
V
OUT
Capacitive Sensors
The sensors in this section produce a change in
capacitance. There are four basic strategies shown
here for converting this capacitance into a measurable
electrical quantity:
• RC decay
• Oscillator frequency
• Integration of current
• Wheatstone bridge
RC DECAY
The first strategy for con ditioning a capa citive sens or is
to produce a voltage with a RC decay (single pole
response to a step). The time it takes for the voltage to
decay to a threshold is a measure of the capacitance.
Figure 18 measures t his time, where the thr eshold is
proportional to V
coefficient to minimize temperature errors. The PICmicro® MCU provides the switching and control needed.
AN863, AN512 and AN929 [7, 11, 14] detail a similar
circuit.
PICmicro® MCU
. R1 has a low temperature
DD
R
1
P
1
P
0
C
SEN
FIGURE 17:State Variable Oscillato r.
Advantages
• Accuracy (with calibration)
• Good startup
• Easy processing using a PICmicro
®
MCU
Disadvantages
•Cost
•Design complexity
Sensor Examples
•RTD
• Hot-wire anemometer
FIGURE 18:RC Decay.
Advantages
• Ratiometric correction of VDD and temperature
errors
The second strategy for conditioning a capacitive
sewnsor is to measure a change in oscillation
frequency. The multi-vibrator (oscillator) in Figure 19
produces a change in oscillation frequency as a
function of capacitance. Its operation and design is
detailed in AN866 and AN895 [4, 12].
C
SEN
V
DD
R
2
R
3
R
V
DD
MCP65XX
R
1
V
OUT
4
FIGURE 19:Multi-vibrator (oscillator).
Advantages
•Cost
• Ratiometric operation
• Easy processing using a PICmicro
®
MCU
Disadvantages
• Reduced accuracy
Sensor Examples
• Capacitive humidity sensor
• Capacitive touch sensor
• Capacitive tank level sensor
SINGLE SLOPE INTEGRATING DETECTOR
The third strategy for conditioning a capacitive sensor
is to integrate a current and measure the elapsed time
to reach a voltage threshold. Figure20 shows a
single-slope integrating detector. Switch SW
controlled by the PICmicro
across C
at the start o f the integr atio n peri od. T he
SEN
®
MCU, zeros the voltage
voltage at the output of the op amp linearly increases
with time; the rate of increase is set by V
REF
and R1.
The comparator at the output, which can be on the
PICmicro MCU, trips at a time proportional to C
The fourth strategy for co nditioni ng a capa citive se nsor
is to convert its impedance, at a specific frequency, to
a voltage using a Wheatstone bridge. Figure 21
produces a change in differential voltage as a function
of change in capacitance. An AC voltage source must
drive the bridge; its frequency needs to be stable and
accurate. R
that is controlled to zero-out the differential voltage, or
it can be a regular resistor. R
the instrumentation amp correctly, and to keep the
node betwee n th e capac ito rs fr om d rift ing over t ime . It
needs to be much larger than C
the divider equation can be corrected for this
resistance, if necessary.
can be a di gital potentiome ter (digi-pot)
1
provides a means to bias
3
’s impedance (1/j ωC2);
2
V
AC
C
SEN
C
2
R
3
Instrumentation
R
1
Amplifier
R
2
V
REF
V
OUT
Charge Sensors
Figure 22 shows a simplified model of a “charge
sensor.” It is a capacitive source that produces AC
energy as a function of a change in the environment.
C
SEN
V
SEN
FIGURE 22:Simplified Charge Sensor
Model.
Figure 23 shows a charge amplifier (C1 and the op
amp) that co nverts the sensor e nergy (charge) to an
output voltage. R
input of the op amp, and creates a high-pass filter pol e
(keeps the inverting input of the op amp from drifting
over time). The change in charge of P
almost exclusively across C
accurate way to measure the charge produced by the
sensor.
Circuit and firmware concerns common to many
embedded designs are mentio ned here.
Input Protection
Sensor inputs need to be protected against Electrostatic Discharge (ESD), overvoltage and overcurrent
events; especially if they are remote from the
conditioning circuit. AN929 [14] covers these issues.
Sensor Failure Detection
Some of the circuits in this application note provide
means to detect sensor failure. Other examples are
given in AN929 [14].
Filtering
All of the circuits in this application note also need
output filters [3]. Analog filters are used to improve
ADC performance. When properly designed, they
prevent interference from aliasing (even to DC) and
can reduce the sample frequ ency requirement s (saving
power and MCU overhead). A simple RC filter is good
enough for many applications. More difficult analog filters need to be implemented with active RC filters.
®
Microchip Technology Inc.’s FilterLab
an innovative tool that simplifies analog active-filter
(using op amps) design. It is available at no cost from
our web site (www.microchip.com). The FilterLab
active-filter so ftware design tool provi des full s chematic
diagrams of the filter circuit with component values. It
also outputs the filter circuit in SPICE format.
Additional filtering can be performed digitally, if
necessary. A simple averaging of results is usually
good enough.
software [26] is
A-to-D Conversion
Many times, the conditi oned sensor output is converted
to digital format by an ADC. Many of the circuits in this
application note are ratiometric so that variations in
power supply are corrected at the ADC (e.g., Wheatstone bridges). Others circuits use an absolute
reference for the ADC.
Correction of Results
Sensor errors can be corrected by calibrating each
system. This can be accomplished in hardware (e.g.,
Digi-Pot) or firmware (e.g., calibration constants in
non-volatile memory).
Correction for other environmental parameters may
also be needed. For example, a capacitive humidity
sensor may need correction for temperature. This is
usually easiest to handle in firmware, but can also be
done in hardware.
Non-linear sensors need additional correction. They
may use polynomials or other mathematical functions
in the MCU, to produce a best estimate of the parameter of interest. It is also possib le to use a lin ear interp olation table in firmware; AN942 [27] gives one
implementation.
SUMMARY
This application note is intended to assist circuit
designers select a circuit topology for common sensor
types. Common sensor applications are listed and
described. Many basic signal-conditioning circuits are
shown. Sensor-conditioning circuitry, and firmware
common to many embedded designs, are briefly
mentioned. The “References” section points to other
resources that cover particular topics in detail.
[1] “The OMEGA® Made in the USA Handbook™,”
Vol.1, OMEGA Engineering, Inc., 2002.
®
[2] “The OMEGA
Vol.2, OMEGA Engineering, Inc., 2002.
[3] AN682, “Using Single Supply Operational
Amplifiers in Embedded Systems,” Bonnie Baker;
Microchip Technology Inc., DS00682, 2000.
[4] AN866, “Designing Operational Amplifier Oscil la tor
Circuits For Sensor Applications,” Jim Lepkowski;
Microchip Technology Inc., DS00866, 2003.
Current Sensors
[5] AN951, “Amplifying High-Impedance Sensors –
Photodiode Example, ” Kum en Bl ake a nd Steven Bible;
Microchip Technology Inc., DS00951, 2004.
[6] AN894, “Motor Control Sensor Feedback Circuits,”
Jim Lepkowski; Microchip Technology Inc., DS00894,
2003.
Resistor Sensors
[7] AN863, “A Comparator Based Slope ADC,” Joseph
Julicher; Microchip Technology Inc., DS00863, 2003.
[8] AN251, “Bridge Sensing with the MCP6S2X
PGAs,” Bonnie C. Baker; Microchip Technology Inc.,
DS00251, 2003.
[9] AN717, “Building a 10-bit Bridge Sensing Circuit
using the PIC16C6XX and MCP601 Operational
Amplifier ,” Bonnie C. Ba ker; Microch ip Technology Inc.,
DS00717, 1999.
[10] AN695, “Interfacing Pressure Sensors to
Microchip’s Analog Peripherals,” Bonnie Baker;
Microchip Technology Inc., DS00695, 2000.
[21] AN867, “Temperature Sensing With A
Programmable Gain Amplifier,” Bonnie C. Baker;
Microchip Technology Inc., DS00867, 2003.
®
MCUs,” Joseph Julicher; Microchip
Other Sensors
[22] AN865, “Sensing Ligh t with a Prog rammable G ain
Amplifier ,” Bonnie C. Ba ker; Microch ip Technology Inc.,
DS00865, 2003.
[23] AN692, “Using a Digit al Potentiometer to Optim ize
a Precision Single-Supply Photo Detection Circuit,”
Bonnie C. Baker; Micro chip Technology Inc., DS00692,
2004.
[24] TB044, “Sensing Air Flow with the PIC16C781,”
Note the following details of the code protection feature on Microchip devices:
•Microchip products meet the specification contained in their particular Microchip Data Sheet.
•Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
•Microchip is willing to work with the customer who is concerned about the integrity of their code.
•Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are com mitted to continuously improving the code protect ion f eatures of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digit al Mill ennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED,
WRITTEN OR ORAL, STATUTORY OR OTHERWISE,
RELATED TO THE INFORMATION, INCLUDING BUT NOT
LIMITED TO ITS CONDITION, QUALITY, PERFOR MANCE,
MERCHANTABILITY OR FITNESS FOR PURPOSE.
Microchip disclaims all liability arising from this information and
its use. Use of M icrochip’s prod ucts as critical components in
life support systems is not authorized except with express
written approval by Microchip. No licenses are conveyed,
implicitly or otherwise, under any Microchip intellectual property
rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, K
EELOQ, microID, MPLAB, PIC, PICmicro,
PICSTART, PRO MATE, PowerSmart, rfPIC, and
SmartShunt are registered trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB,
PICMASTER, SEEVAL, SmartSensor and The Embedded
Control Solutions Company are registered trademarks of
Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, dsPICDEM,
dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR,
FanSense, FlexROM, fuzzyLAB, In-Circuit Serial
Programming, ICSP, ICEPIC, Linear Active Thermistor,
MPASM, MPLIB, MPLINK, MPSIM, PI Ckit, PICDEM,
PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo,
PowerMate, PowerTool, rfLAB, rfPICDEM, Select Mode,
Smart Serial, SmartTel, Total Endurance and WiperLock are
trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
SQTP is a service mark of Microchip T echnology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
Microchip received ISO/TS-16949:2002 quality system certification for
its worldwide headquarters, design and wafer fabrication facilities in
Chandler and Tempe, Arizona and Mountain View, California in
October 2003. The Company’s quality system processes and
procedures are for its PICmicro
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.