EN

Reading NTC sensors

From the thermistor to the ADC number and from the number to the temperature

Calculator

Thermistor
kΩ
K
Circuit and ADC
kΩ
V
°C
°C
mW/°C

ADC input voltage versus temperature

The divider and the ADC reference are assumed to come from the same voltage (ratiometric measurement). The dissipation constant of a small bead NTC is usually between 1 and 3 mW/°C in still air; check the datasheet of the exact model.

What an NTC is

An NTC (negative temperature coefficient) thermistor is a resistor made of semiconducting oxides whose value drops sharply as temperature rises: a 10 kΩ NTC at 25 °C has about 33 kΩ at 0 °C and less than 1 kΩ at 100 °C. It is cheap, small and very sensitive, which is why it is found in batteries, chargers, 3D printers, appliances, motors and power supplies. Its drawback is that it is not linear and its real accuracy depends on the tolerance of R25 and B. For more accuracy or wide ranges, Pt100 probes or thermocouples are used.

Beta and Steinhart-Hart equations

The most common way to describe an NTC is the Beta equation, with two figures from the manufacturer: R25 and the B constant (for example B25/85 = 3950 K):

\[ R(T) = R_{25}\, e^{\,B\left(\frac{1}{T} - \frac{1}{298.15}\right)} \]
\[ \frac{1}{T} = \frac{1}{298.15} + \frac{1}{B}\ln\frac{R}{R_{25}} \]

With T in kelvin. It is exact at the two temperatures where B was defined and drifts somewhat outside them, around ±0.5 °C over a 100 °C range. The Steinhart-Hart equation uses three coefficients and brings the error down to hundredths of a degree; the coefficients are calculated by measuring the resistance at three temperatures or taken from the datasheet:

\[ \frac{1}{T} = A + B\,\ln R + C\,(\ln R)^3 \]

The voltage divider

The ADC measures voltage, not resistance, so the NTC is placed in a divider with a fixed resistor RS. If the NTC is at the bottom, the voltage drops as it heats up; if it is at the top, it rises. The key is choosing RS well: sensitivity is highest at the temperature where RNTC = RS, so RS is taken equal to the NTC resistance in the middle of the range of interest. For a hot water thermostat at 60 °C, a 10 kΩ NTC works better with 2.4 kΩ (its value at 60 °C) than with 10 kΩ.

If the divider and the ADC reference come from the same voltage, the measurement is ratiometric: the ADC code depends only on the resistors and supply variations cancel out. This is the right way on Arduino (reference = 5 V) and on ESP32 or STM32 supplying the divider from the same 3.3 V.

From the ADC code to the temperature

With the NTC at the bottom and a 12-bit ADC, the program first calculates the resistance and then the temperature:

float r = RS * code / (4096.0 - code);           // NTC resistance
float t = 1.0 / (1.0 / 298.15 + log(r / R25) / B) - 273.15;   // °C

With the NTC at the top, the first line is r = RS * (4096.0 - code) / code. To save computation on small microcontrollers, a code → temperature table can be precomputed and interpolated.

Common errors

Related: voltage divider for the ADC, ADC and DAC conversion, Pt100 calculator and thermocouple calculator.