# Software linearization techniques for thermistors

Jan. 12, 1998
Interfacing an NTC thermistor to a computerized data-acquisition system requires a resistance-to-voltage (or current) converter (bridge, voltage divider, etc.). It’s also necessary to incorporate software routines to convert the ADC units of the...

Interfacing an NTC thermistor to a computerized data-acquisition system requires a resistance-to-voltage (or current) converter (bridge, voltage divider, etc.). It’s also necessary to incorporate software routines to convert the ADC units of the dataacquisition system back into resistance values. Once the temperature readings are converted back into thermistor resistance values, the algorithm given here can be used to generate temperature readings.

Steinhart and Hart developed an equation that can be used to linearize the resistance output of a thermistor:

where T is temperature (in Kelvin); R is resistance (in Ω); and A, B, and C are curve-fitting coefficients. To apply the Steinhart-Hart equation, it first is necessary to determine the numeric values of the curve-fitting coefficients (A, B, C). These coefficients can be determined by setting up three simultaneous linear equations using temperature and resistance values from three temperature points (T1, T2, T3). These data points can be generated using temperature calibration equipment or extracted from data tables furnished by the manufacturer of the thermistor.

The Steinhart-Hart equation will generate temperature values with a ±0.02°C accuracy if the temperature data points span magnitudes of less than or equal to 100°C (¦T3 − T1¦ ≤ 100°C) and the data points are centered on the normal range of thermistor (T2 ≈ midpoint of temperature range). Once the curve-fitting coefficients are determined, this equation can be used to convert thermistor resistance values into equivalent temperature values.

To demonstrate the techniques necessary to linearize a thermistor using the Steinhart-Hart equation, a linearization algorithm was developed for a thermistor (YSI #44001), which operates in a temperature range of −50°C (223.15K) to 100°C (373.15K). The first step in developing the Steinhart-Hart linearization algorithm is the calculation of the curve-fitting coefficients. This is accomplished by selecting three temperature values that fall within the operation range of the thermistor (−50°C to +100°C). A third value of 25°C is selected because it’s the midpoint of temperature range.

Using these temperature values and the associated resistance magnitudes, three linear equations are constructed with three unknowns: 2045 Ω @ −50°C; 100 Ω @ 25°C; and 15 Ω @ 100°C. Substituting these resistance and temperature values into three linear equations gets the following results: A = 1.75 × 10≄3; B = 339.9 × 10−6; = 308.9 × 10−9. Substituting the coefficients into the Steinhart-Hart equation results in:

where T is the temperature in Kelvin (K), R is the resistance in ohms (Ω), and TC is the temperature in Celsius (°C) (see the figure). The software listing is an example of a C++ function that will linearize a thermistor. It requires the user to calculate the coefficients (A, B, and C). If one has access to a matrix library, a second function could be designed to calculate the coefficients based on the three resistance/temperature entries.