ST AN2648 Application note

AN2648
Application note
Increasing the resolution of analog temperature sensors
Introduction
For a recent trade show, a demonstration board was required to display ST's new low-cost temperature sensor, the STLM20. The idea was to connect it to a basic microcontroller with on-board analog-to-digital converter (ADC) and display the temperature on seven-segment LEDs. Any user would be able to affect the temperature by applying his finger directly to the sensor and then watch the display change as a result.
The goal was to keep things simple and use the ADC converter on the micro thus avoiding the expense and engineering effort of using an external ADC.
Using the STLM20 temperature sensor with low-cost microcontrollers
The design flow used for the demonstration board can be applied in many applications. This document describes how any user can implement a temperature sensor design using the LM20 and a low-cost microcontroller with integral A-D converter.

Figure 1. STLM20 demonstration board

34mm / 1.34
280mm / ~11
200mm / ~8
144mm / 5.7
December 2007 Rev 1 1/15
www.st.com
STLM20 temperature-to-output transfer function AN2648

1 STLM20 temperature-to-output transfer function

Upon examining the temperature sensor's output characteristics, several issues become apparent. The STLM20 is a voltage output device with a 2
0
This is rather unwieldy math for a simple 8-bit micro, but a linear approximation is available which matches the curve very closely. As shown in Figure 2, the dashed blue line is a very good fit to the pink parabola of the 2
Equation 1
This is much more manageable for coding in assembly language without a math package. In this figure, the reader will note that the curve deviates only slightly from the line at the extreme ends. In the middle, they are almost indistinguishable.

Figure 2. STLM20 transfer function

nd
order transfer function:
226
nd
order equation above, and has the following equation:
0
2.5
+×°=
+××+××=
V8663.1TC)V/01169.0(V
V8639.1)T1015.1()T1088.3(V
2.3
2.1
, (V)
O
Output voltage, V
-60 -40 -20 0 20 40 60 80 100
1.9
1.7
1.5
1.3
1.1
0.9
0.7
0.5
2nd Order Linear
Temperature, T (˚C)
ai13986
2/15
AN2648 STLM20 temperature-to-output transfer function
The second issue arises with the output voltage range. The micro's ADC performs ratio­metric conversion on the input using V respectively. That means that when the input voltage equals V be 255 (FF the range V
), and when the input is ground, the output will be 0 (00
HEX
to ground is converted proportionally according to the following relationship:
CC
and ground as the upper and lower references,
CC
CCIN
, the 8-bit ADC's output will
CC
552)/VV((dec)output ADC
×=
). Any voltage in
HEX
For this application, the nominal VCC is 5 V, so this equation becomes:
51V552/5)V((dec)output ADC
×=×=
ININ
Referring to Figure 3, while the ADC can accept inputs over the full range 0 to 5 V, the temperature sensor output will vary over a much smaller range, between 0.87 and 2.33 volts across the temperature range –40° to +85°C.

Figure 3. STLM20 output voltage range

5
Available voltage range
(V)
O
Output voltage, V
-60 -40 -20 0 20 40 60 80 100
4.5
4
3.5
3
2.5
2
1.5
1
STLM20 output voltage
0.5
range
0
STLM20 full range, linear, ind temp
Temperature, T (˚C)
ai13987
This amounts to using only 1.46 V of the available 5 V range. Furthermore, in the intended demonstration board application, the necessary temperature range was approximately room temperature –15°/+25°, or 10° to 50°C.
For this target temperature range, the voltage range is 1.28 to 1.75 V, an interval of less than
0.5 V, less than one tenth the available 5 V range. This is depicted in Figure 4.
3/15
STLM20 temperature-to-output transfer function AN2648
/

Figure 4. Application temperature and voltage ranges

5
4.5
4
3.5
(V)
O
3
2.5
Temperature range of interest
2
Output voltage, V
1.5
Used voltage range of application
1
STLM20 full temperature range
0.5
Available voltage range
0
-60 -40 -20 0 20 40 60 80 100
Temperature, T (˚C)
In Equation 1, the slope is –11.69 mV per °C. For the 8-bit ADC, the step size is 5 V/255 steps or 0.019608 V/step. Comparing this to the slope, we get:
V/step 0.019608
11690.0
This means that, with the temperature sensor connected directly to the ADC, the resolution is only 1.68°C/step. The smallest temperature increment the ADC can resolve is
1.68°C. This is very coarse resolution.
4/15
ai13988
°=
°
CV
C/step1.677318
AN2648 STLM20 temperature-to-output transfer function
Given that the expected voltage range is less than 0.5 V, it should be possible to amplify the STLM20 output signal so that is uses more of the available voltage range. A 10x amplification should be possible without exceeding the available 5 V range. Furthermore, a positive slope is more intuitive to the user, so inverting it would be helpful, too. Hence, a gain of –10 should be used. Multiplying equation 1 by –10, we get the curve as shown at the bottom in Figure 5.

Figure 5. Application transfer function after gain, inversion and offset

5.5
3.5
1.5
-50 -30 -10 10 30 50 70 90
-0.5
-2.5
-4.5
-6.5
+17.5
x –10
Voltage (V)
-8.5
-10.5
-12.5
-14.5
< 5V
-16.5
-18.5
Temperature, T (˚C)
ai13989
The result has positive slope and spans from –17.5 to –12.8, an interval of about 4.7 V, much closer to the available 5 V range.
5/15
Loading...
+ 10 hidden pages