Electronic Design

# New Math Technique Increases Temperature Accuracy Over 20,000%

Thermistors are extremely nonlinear devices. Because of the limitations of the mathematical model used, the devices’ ultimate accuracy is hardly ever fully realized due to the extra computational burden required to calculate the temperature from an accurate resistance reading.

Fortunately, a minor modification to any thermistor equation will provide a worthwhile improvement in overall accuracy. This article shows how an improved mathematical model for thermistors can allow orders of magnitude greater temperature accuracy with no extra computation compared to the well-known Steinhart-Hart formula.

The Steinhart-Hart equation calculates the temperature as a truncated polynomial logarithmic series:

1/T = A + B × ln(R/RO)

where T = the temperature in °K; R = resistance in ohms; and A, B, and C = the Steinhart- Hart coefficients, which vary with the type and model of thermistor and the temperature range of interest. The addition of a square term \\[ln(R)2\\] provides a noticeable improvement.1

This equation models the temperatureresistance curve to a few millidegrees, but only over a narrow range. Most often, the equation is simplified to:

1/T = A + B\\[ln(R)\\]

to ease the computation for low-resolution thermometry and control applications.

However, this simplification can also increase the peak error to as much as +0.3°/-0.65°C over a -30° to 60°C range for a precision thermistor (PR222J2).

In degrees Celsius, the Steinhart-Hart (S-H) equation becomes:

T(°C) = 1/\\{A + B\\[ln(R)\\] + C\\[ln(R)\\]3\\}

- 273.15 (1)

A simplified version drops the cube:

T(°C) = 1/\\{A + B\\[ln(R)\\]

- 273.15 (2)

By substituting a variable for the Kelvin absolute temperature constant, the accuracy may be increased 239 times for a 230° range and over eight times (886%) for a 100° range:

T(°C) = 1/\\{A + B\\[ln(R)\\] + C\\[ln(R)2\\] + D\\[ln(R)3\\]\\} - E (3)

The simplified form of this higher-accuracy equation is:

T(°C) = 1/\\{A + B\\[ln(R)\\]\\} - E (4)

The coefficients A, B, C, D, and E were calculated offline using the Levenberg-Marquardt algorithm for both a reference-grade thermistor with 11 data points and for a wide-temperature-range precision thermistor with 230 data points. The table summarizes the rms errors (°C) of the four equations studied using these thermistors.

The table shows that there was little improvement for the thermistors with a wide temperature range when using the simplified equations (Eq. 2 and 4). These equations would be useful for many industrial and commercial products that don’t require extra computation.

The calculation times for Equations 1 and 3 are equal. Therefore, orders of magnitude greater accuracy can be obtained for “free.” Particularly noteworthy is the enormous improvement in accuracy for the wide-range thermistor with the new, high-accuracy equation (Eq. 3), while only a small improvement occurs for the simplified version of that equation (Eq. 4) compared to the corresponding simplified Steinhart-Hart equation (Eq. 2).

The improved mathematical model for thermistors allows them to replace platinum resistance sensors or gold-platinum thermocouples. The thermistors would cost less and offer much greater sensitivity, while providing comparable accuracy in the -80°C to 150°C range.

Furthermore, thermistor temperatures can be computed without actually calculating reciprocals, multiplications, or logarithms by using variations of the CORDIC algorithm that employ only additions, subtractions, and bit rotations. This simplifies the algorithm’s use with microcontrollers.2,3

The accompanying source code and executable (www.electronicdesign.com) calculates the rms errors in the table and verifies the lowest error (152 microdegrees) even for the Steinhart-Hart equation with the square term (245 microdegrees, not shown in the table).

The author would like to thank D.R. White (msl.irl.cri.nz) for his review of this article.

1. Steinhart-Hart Thermistor Equation: www.betatherm.com/stein.php

3. Microcontrollers & CORDIC Methods: www.ddj.com/184404244

See associated code