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

200mm / ~8

144mm / 5.7

34mm / 1.34

280mm / ~11

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 2nd order transfer function:

V0 = (3.88×106 × T2 ) + (1.15×102 × T) + 1.8639 V

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 2nd order equation above, and has the following equation:

Equation 1

V0 = (0.01169V/°C)× T + 1.8663V

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

 

 

 

2.5

 

 

 

 

 

 

 

 

2.3

 

 

 

 

 

 

 

 

2.1

 

 

 

 

 

(V)

 

 

1.9

 

2nd Order

 

 

 

,

 

 

 

 

 

 

 

 

 

 

 

 

 

O

 

 

 

 

 

 

 

 

 

 

 

Linear

 

 

 

V

 

 

1.7

 

 

 

 

 

 

 

 

 

 

 

voltage,

 

 

 

 

 

 

 

 

 

1.5

 

 

 

 

 

 

 

 

 

 

 

 

 

Output

 

 

1.3

 

 

 

 

 

 

 

1.1

 

 

 

 

 

 

 

 

0.9

 

 

 

 

 

 

 

 

0.7

 

 

 

 

 

 

 

 

0.5

 

 

 

 

 

-60

-40

-20

0

20

40

60

80

100

 

 

 

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 ratiometric conversion on the input using VCC and ground as the upper and lower references, respectively. That means that when the input voltage equals VCC, the 8-bit ADC's output will

be 255 (FFHEX), and when the input is ground, the output will be 0 (00HEX). Any voltage in the range VCC to ground is converted proportionally according to the following relationship:

ADC output (dec) = (VIN /VCC )× 255

For this application, the nominal VCC is 5 V, so this equation becomes:

ADC output (dec) = (VIN /5)× 255 = VIN × 51

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

Output voltage, VO (V)

Available voltage range

-60

 

 

5

 

 

 

 

 

 

 

4.5

 

 

 

 

 

 

 

4

 

 

 

 

 

 

 

3.5

 

 

 

 

 

 

 

3

 

 

 

 

 

 

 

2.5

 

 

 

 

 

 

 

2

 

 

STLM20 full range,

 

 

 

 

 

linear, ind temp

 

 

 

 

 

 

 

 

 

1.5

 

 

 

 

 

 

 

1

STLM20

 

 

 

 

 

 

0.5

output voltage

 

 

 

 

range

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

-40

-20

0

20

40

60

80

100

 

 

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

 

 

 

 

 

(V)

 

 

3.5

 

 

 

 

 

 

 

 

 

 

 

 

 

O

 

 

3

 

 

 

 

 

V

 

 

 

 

 

 

 

voltage,

 

 

2.5

 

 

 

 

 

 

 

 

 

Temperature range of interest

 

Output

 

 

 

 

 

 

 

2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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)

 

 

 

ai13988

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:

0.019608 V/step

= −1.677318 °C/step

0.01169 V/ °C

 

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

ST AN2648 Application note

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

Voltage (V)

 

 

 

5.5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3.5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1.5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-50

-30

-0.5

10

30

50

70

 

90

-10

 

 

 

 

 

-2.5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-4.5

 

 

 

 

 

 

+17.5

 

 

 

 

 

 

 

x –10

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-6.5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-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