Link here

Efficient Thermistor Temperature Computation

Convert NTC thermistor resistance to temperature

This page discusses some of the practical aspects of converting a thermistor reading to temperature in a digital thermometer or microcontroller based instrument. As shown in the circuit schematics of Measuring Thermistors, you can connect a thermistor to an analog to digital converter to convert its resistance into a number of counts. Those counts may be used directly in a equation based on rational polynomial curve fits to efficiently compute the thermistor temperature

 

Example 1: Using a Yellow Springs thermistor

You can most efficiently compute temperature directly from A/D counts. In this example we'll show how to use the Yellow Springs Type YSI 400 NTC thermistor1), and compute the temperature directly from A/D counts with moderate accuracy. This particular thermistor has a calibration point resistance of Ro = 2252 Ω at To = 25°C.

Computing the temperature can be done in a straight-forward but computationally inefficient way, or the calculation can be optimized.

The straight-forward way is to first calculate the thermistor resistance from the A/D counts using the equations shown on the page Measuring Thermistors, then to calculate the temperature in °C using the fancy polynomial equation with the logarithms shown on the page Temperature Resistance Equation. These calculations are involved, using many multiplies, divides, and a logarithm, which itself may involve a dozen operations.

To improve efficiency you could use a lookup table or piecewise linear approximations. An even better way of doing the computation arises from recognizing that the curvature inherent in the RTH vs Counts equation counter-balances the curvature of the T vs RTH equation, suggesting that a nearly linear approximation or a simple polynomial may work better than using the two equations in tandem. By generating data from the two equations, then curvefitting it, we can produce a simple fit as shown in the following graph. The equation is,

in which T is in °C and C are the A/D counts, ranging from 0 to 65535. For this curve fit we assumed a series reference resistance of 2 KΩ. This equation reduces the operations count to just three multiplies and three additions. The parameters of Eqn. 1 are:

m0 = 109.2
m1 = -0.0044615
m2 = 8.5888E-08 , and,
m3 = -7.8541E-13
 

Example 2: Using a precision US Sensors Curve J thermistor

Let's consider another example, this time using a precision, replaceable thermistor available from US Sensor. We'll use a standard 10KΩ NTC thermistor that follows US Sensor's Curve J. You can find the thermistor's specifications and a table for its temperature response in the US Sensor catalog.

The thermistor is connected as shown in the schematic above, that is, in series with a 10KΩ reference resistor. Because the thermistor's resistance is 10KΩ at its reference temperature of 25°C the thermistor voltage at that temperature should be exactly half of the full scale reference voltage.

To measure the temperature an A/D reading is taken, and the thermistor voltage ratio (a number between 0.0 and 1.0) is computed from the number of counts, C, as,

If you are using the Analog I/O Wildcard's 16-bit A/D, then 2n=216=65536. If you are using the 24/7 Data Acquisition Wildcard in unipolar mode with a gain of one, its 24-bit A/D produces a 32-bit count – actually a 24-bit resolution result left-justified within a 32-bit number. So you would use 2n=232=4292967296.

Because the voltage is at half scale at the thermistor reference temperature, we can simplify subsequent computations by using an offset voltage ratio as,

Then, when T=To=25°C, x=0. To compute the temperature from the offset voltage ratio we can use a polynomial fit of the form,

Using this five-parameter fifth-order polynomial requires five floating point multiplications and five additions. There is a better way to fit thermistor curves, that provides greater accuracy with the same number of computations. That is to use what's called a rational polynomial function, an equation of the form,

In general, for the same number of determined parameters and arithmetical operations, equations of this form fit continuous functions more accurately than do simple polynomials. The following table provides optimized coefficients for the two models, and their resulting average absolute errors at each temperature, for US Sensor Curve J thermistors over the 0 to 75°C temperature range.

Coefficients and Errors for 5-Parameter Models
Coefficient Polynomial Model Rational Function Model
To 25 25
c1 -99.894 -99.296
c2 26.832 24.624
c3 -94.896 147.26
c4 80.833 0.0195
c5 -992.87 2.8454
Average
Error
0.027°C 0.0049°C

Using the rational polynomial function results in a maximum error of only 0.01°C and an average error of less than half of that (0.0049°C).

Data for the sensor and these curve fits is provided by this Excel workbook.

 

Example 3: Using a Murata SMD thermistor

Very small surface mount PTC 2) and NTC thermistor components are now readily available. In this example we model the temperature of a Murata SMD thermistor, part number NCP18XH103F03RB, available from Digikey. It has a resistance tolerance of ±1% and a beta of 3380±1%.

The thermistor is placed in series with a 10kΩ reference resistor, chosen because it is the same value as the thermistor's resistance at 25°C. The A/D counts, C, are measured and the parameter, x, is computed as,

Using a rational polynomial function of the form,

data from the Murata datasheet is used to find optimum parameters for two temperature ranges, -40 - +125°C and 0 – 75°C, with the following results:

Coefficients and Errors for a 5-Parameter Model
Coefficient -40 →  +125°C 0 →  +75°C
To 25 25
c1 -108.21 -107.27
c2 24.118 44.12
c3 216.38 217.31
c4 0.03895 -0.12915
c5 -3.1804 -3.3586
Average
Error
0.087°C 0.0081°C

Data for the sensor and these curve fits is provided by this Excel workbook.



See also → Efficient Thermistor Temperature Computation

 
Notes:
NTC – negative temperature coefficient thermistor
positive temperature coefficient
This page is about: Converting Thermistor Resistance to Temperature Using YSI, US Sensors Curve J, and Murata Thermistors – Efficiently calibrate and calculate temperature from thermistor resistance and A/D readings in digital thermometers or microcontroller based instruments by minimizing the number of calculations and using polynomial and rational polynomial curve fits. For example, using YSI, US Sensors Curve J thermistors, and Murata NTC thermistors.
 
 
Navigation