Interfacing the AD22100 Temperature Sensor to a Low Cost
The AD22100 is a new monolithic silicon temperature
sensor with several unique attributes. These attributes
make it easier to interface the AD22100 to microcontrollers than other temperature sensor ICs. Available in
both TO-92 and SOIC packages, the AD22100 features
single-supply operation, the ability to measure negative
temperatures without requiring a negative power supply, and a voltage output that is ratiometric to its power
supply, rather than to an absolute voltage.
Other IC temperature sensors rely on the physics of certain silicon circuit topologies to measure temperature. In
particular, the AD590, and its successors, make use of
the temperature coefficient of the differential voltage
between two silicon junctions (operating at different
current densities) to produce an output that is proportional to absolute temperature. This kind of circuit, often
called a PTAT circuit, is the basis of all IC temperature
sensors prior to the AD22100.
•
Single-Chip Microcontroller
APPLICATION NOTE
NORWOOD, MASSACHUSETTS 02062-9106
by Norm Bernstein
measure temperatures in the device’s operating range.
More importantly, the output is ratiometric to the power
supply, which eliminates the requirement for a precision
calibrated reference voltage in the measurement chain.
A simplified schematic of the AD22100 is shown in Figure 1. The temperature sensing resistor is excited by a
stable current source; since the temperature coefficient
of the sensing resistor is linear, the output is therefore a
voltage that is linear with respect to temperature.
V+
Ι
R
T
•
617/329-4700
V
OUT
The PTAT circuit, however, suffers from several liabilities. Since the circuit “pivots” at absolute zero, it is necessary to suppress an offset term of 273 °C in order to
make measurements at 0 °C. More importantly, PTAT
circuits are calibrated in
output voltages or currents that require a precision
measurement with respect to a calibrated reference.
The AD22100 does not use a PTAT circuit as the basis of
its measurement technique. Instead, the AD22100 uses
the temperature coefficient of a carefully deposited thin
film resistance, much like an RTD (Resistance Temperature Detector), as the measuring element. By using this
technique, the output of the circuit can be arranged such
that there is no need to suppress a large offset term to
absolute
units, and produce
Figure 1. Simplified Schematic
The other resistors in the circuit serve to establish a
particular output offset at a specified temperature and
power supply voltage (+1.375 V at 0 °C with V+ = 5 V),
and provide for a specified gain versus temperature at
the output (22.5 mV per °C). Most importantly, the circuit
configuration provides for ratiometricity; as the power
supply voltage changes, the output will remain at the
same ratio to the power supply voltage (assuming temperature is constant). This important attribute will be utilized in the interface example described in this
applications note.
Interfacing the AD22100 to a Microcontroller
Since the output of an AD22100 is a voltage between
0 V and 5 V, an easy interface can be achieved by using a
microcontroller with a built in A/D circuit. There are a
number of such microcontrollers available on the market today, often with 8- or 10-bit resolution.
However, this approach, while certainly simple, is not
without liabilities. Microcontrollers with built-in A/D
capability are more expensive than the more ordinary
varieties. They usually do not allow for true ratiometric
operation (although a few provide for an external reference input, allowing at least limited ratiometric operation). Since they are usually based upon successive
approximation architectures, they don’t provide integration or normal mode rejection. Most importantly, 8 or 10
bits of A/D resolution is insufficient if the application
requires 0.1 °C resolution at the output.
The A/D architecture described in this application note is
well suited for extracting the best possible performance
from the AD22100. Based largely on firmware within the
microcontroller, this A/D offers the following attributes:
• true integrating A/D, fully ratiometric
• 14-bit resolution, produces 0.1°C resolution after
scaling and calibration
• requires only 2 microcontroller I/O pins, and does
not consume any counter-timer or interrupt
resources
• uses digital calibration
V
IN
V
FB
C1
COMP
+V
Q1
R1
Q2
IN
MICRO-
CONTROLLER
OUT
Figure 2. Simplified A/D Schematic
In addition to modulating the pulse train density according to the comparator output signal, the microcontroller
also keeps track of the density of the pulse train, as well
as the total time duration of the conversion cycle, via the
use of counter registers. The ratio of the pulse train density to the total conversion time is proportional to the
input voltage.
The A/D Conversion Firmware Loop
The A/D conversion process is controlled by a carefully
designed firmware loop. The loop is described in the
flowchart of Figure 3 below.
START
TOTAL –COUNT, OUTPUT–COUNT
INITIALIZE
REGISTERS
• extremely low cost
Furthermore, this A/D architecture can be adapted to a
wide variety of microcontroller types, including the very
low cost OTP (One Time Programmable) types. For the
purposes of this application note, we will illustrate the
circuit as implemented on an 80C51 Microcontroller
(available from Intel Corporation as well as others).
The A/D Circuit
The A/D circuit employed for this application note is an
integrating type that utilizes a very small kernel of code
(44 bytes) to control the conversion process. A
simplified schematic is shown in Figure 2. The input
signal is continuously compared to a feedback voltage
signal, which is generated by the microcontroller. The
microcontroller creates this feedback signal by generating a pulse train at the output pin whose density is proportional to the input signal. This pulse train is buffered
by Q1 and Q2, and filtered by R1 and C1 to produce a
linear voltage (the feedback voltage mentioned above).
Whenever the microcontroller senses that the feedback
voltage is less than the signal voltage, it increases the
density of the output pulse train. In this fashion, the
pulse train density is proportional to the input signal.
NO
CLEAR
DAC BIT
TOTAL–COUNT =
TOTAL–COUNT+1
(DELAY TO
EQUALIZE BRANCH
LENGTHS)
NO
IS SIGNAL
VOLTAGE >
FEEDBACK
VOLTAGE?
TERMINAL
COUNT
REACHED?
STOP
YES
SET
DAC BIT
TOTAL–COUNT =
TOTAL–COUNT+1
OUTPUT–COUNT =
OUTPUT–COUNT+1
YES
Figure 3. A/D Conversion Loop Flowchart
Referring to the flowchart in Figure 3, the conversion is
started by initializing the registers storing the total count
(used to count the total number of loop iterations) and
the registers storing the output count, to zero. Each time
–2–
the loop is entered, the comparator output is tested: if it
indicates that the signal voltage is less than the feedback
voltage, the output bit (called the “DAC” bit, since it is
essentially a one-bit DAC) is set so that the feedback voltage will rise. If the comparator signal indicates that the
signal voltage is greater than the feedback voltage, the
DAC bit is cleared so that the feedback voltage will fall.
Whenever the DAC bit is set, the output count register is
incremented. Regardless of whether the DAC bit is set or
CONVERT:
MOVDPH,#0;the DPTR will be used to keep track
MOVDPL,#0;of the total loop count, so clear it
CLRA;the ACC and B regs will store the raw
MOV B,A;data, so clear them as well
;
;
;CVLOOP is the inner conversion loop, where the measurement actually
; takes place. In this example, we will loop 16384 times, for a 14 bit
; raw data result. The minimum loop time is 13 cycles, or 13 µs when
; running a 12 MHz clock, resulting in a conversion time of 212.992
; milliseconds.
;
CVLOOP:
JNBCVCMP,CVLOOP_UP;test the comparator.. if it2 cyc
CVLOOP_DOWN:
SETBCVFB;going down, so set the bit...1 cyc
NOP ;1 cyc
NOP;NOP’s equalize the time delays 1 cyc
INCDPTR;increment the total loop count2 cyc
SJMPCVLOOP_TEST;now test for terminal count2 cyc
;
CVLOOP_UP:
CLRCVFB;going up, so clear the bit..1 cyc
ADDA,#1;increment the raw data1 cyc
XCHA,B;overflow to the B register1 cyc
ADDCA,#0;1 cyc
XCA,B;and restore them1 cyc
INCDPTR;increment the total loop count2 cyc
;
CVLOOP_TEST:
MOVBITTEST,DPH;grab the upper byte of the dptr2 cyc
JNBBITTEST.6,CVLOOP;repeat until we overflow 14 bits2 cyc
;
; The conversion is done; let’s leave the state of the feedback
; bit consistent to simplify the precharge process
;
CLRCVFB
;
; At this point, the B|A register pair has the raw data, scaled to
; 12 bits, and it is ratiometric to the power supply.
;
MOVRAWDAT,B;store the result in RAWDAT
MOVRAWDAT+1,A
cleared, the total count is incremented, thereby keeping
track of the number of iterations of the loop. The conversion cycle is complete when the loop has executed the
desired number of iterations; in our example, the loop is
iterated 16,384 times to achieve a 14-bit result.
The loop is carefully constructed so that, regardless of
the result of the comparator test, it takes a fixed amount
of time to execute. Figure 4 is a listing of the actual code
;is low, we need to go up
Figure 4. The Inner Conversion Loop Firmware
–3–
for the conversion loop, as used in the example project.
The loop takes just 13 microseconds to execute (a
12 MHz crystal is used in this example, which results in
1 microsecond instruction cycles). If the terminal count
criteria is set for 16,384 iterations, then the output count
will be equivalent to a 14-bit conversion. Using these
parameters, the total conversion cycle is 212.992 milliseconds, which is more than fast enough for the vast
majority of temperature measurement applications.
The choice of comparator can also affect circuit performance. In this architecture, the inputs of the comparator
are operated in common mode over nearly the entire
power supply range of the part. The limited CMRR
(Common-Mode Rejection Ratio) of the comparator
therefore affects the A/D converter linearity. In this example, the integral linearity error measured approximately 0.03%; a comparator with better CMRR would
reduce this error considerably.
+5V
AD22100
SENSOR
0.22µF
(MYLAR)
LM393P
2
3
+9V
330k
8
4,5,6
1
100
14
2
74HC04
3,5,7,9,
11,13
10k
1µF/35V
+
1
1
8
P1.0
87C51
P1.7
Figure 5. Schematic
With this type of converter architecture, it is easy to adjust the parameters to trade off resolution for conversion speed. This can be done by changing the loop
termination criteria. In our example, the loop terminates
when there is an overflow out of 14 bits on the total
count register, but we could easily modify this for any
binary resolution.
Breadboard Circuit Description
The actual schematic of the breadboard constructed for
this application note is shown in Figure 5. In place of the
discrete FETs shown in the simplified schematic, we
chose to use a 74HC04 Hex Inverter, which is quite
inexpensive, is widely available, and works well in this
application. The comparator used was an LM393 dual
comparator (only one half was used), which is also quite
inexpensive and widely available. Unfortunately, the
LM393 requires a positive supply at least +1.5 volts
higher than the highest input signal, forcing the use of a
+9 volt power supply. It is possible to substitute a CMOS
comparator with rail-to-rail input swing capability,
thereby allowing the entire circuit to operate off +5 volts,
but at a slightly greater expense. If the LM393 is chosen,
the +9 volt supply could possibly be “stolen” from other
portions of the actual application circuit, such as the
charge pumps commonly used in TTL-to-RS232 converter chips.
The low-pass filter for the feedback circuit has a pole at
approximately 2 Hz. This setting was chosen so that the
ripple of the feedback voltage would be less than 1 LSB
at the comparator input. This filter limits the bandwidth
of the converter, and requires time to settle before the
conversion cycle starts. Because of this, a “precharge”
function is required (see “Precharging the Feedback
Voltage”).
The power supply for the DAC buffer (the 74HC04) and
the AD22100 is separately decoupled from the
microcontroller power supply via the 100 Ω series resistor and 1 µF shunt capacitor. This is done to minimize
noise generated from the microcontroller clock and I/O
functions.
Precharging the Feedback Voltage
This A/D converter design has a disadvantage in that the
conversion only works properly if the feedback voltage
is at (or at least very near) the input voltage at the start
of the conversion cycle. When the conversion process is
first started, this may not be the case.
There are a number of solutions to this problem, including the use of a hardware switch between the comparator inputs. The switch could be closed briefly to
“precharge” the filter capacitor before the conversion
cycle starts. This particular solution can’t be used with
an AD22100 sensor, because the sensor output structure
is configured as a current source with a weak pull-down
resistor; “precharging” to a lower voltage would be
very slow.
Another solution (and the one that was used in the
breadboard for this applications article) is the use of a
short “precharge” software loop which balances the
comparator inputs just before starting the conversion
cycle.
In an actual application, the precharge loop is necessary
if the conversion rate is continuous.
–4–
Loading...
+ 8 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.