EmbeddedEra EmbeddedEra

← Notes from the bench.

Why an NTC thermistor reads wrong on a microcontroller

Nov 1, 2026pcb-designlayoutfirmwareDrafted with AI assistance, reviewed and edited by our engineer.

You wired a 10 kΩ NTC thermistor and a fixed resistor to an ADC pin. The reading wanders by a degree or two at rest, reads high when the enclosure closes, or is fine at room temperature and wrong at both ends of the range. The thermistor is almost never the broken part. The usual cause is in the divider, the conversion math, or the power the circuit puts into the sensor.

The divider decides where you have resolution

An NTC thermistor changes resistance by orders of magnitude across its range, and the curve is steeply nonlinear. A divider turns that into a voltage, but the divider is only most sensitive near the temperature where the thermistor resistance equals the fixed resistor. Far from that point, a large temperature change moves the ADC voltage by only a few counts.

So pick the fixed resistor for the temperature range you care about, not for the datasheet’s 25 °C value by habit. A freezer monitor and a heater-block monitor should not use the same divider. If you need a wide range with good accuracy everywhere, a single divider on a single ADC input may not be enough. Options are a second divider with a different resistor, a switched resistor, or a dedicated sigma-delta converter.

Which side the thermistor sits on matters for firmware only. Espressif’s NTC driver component exposes separate circuit modes for the thermistor on the supply side or the ground side, and notes that temperature moves the voltage in opposite directions in the two layouts. A wrong mode there gives a reading that falls when it should rise. That is a wiring-versus-code mismatch, not a noise problem.

Ratiometric beats absolute

If the divider is powered from the same rail the ADC uses as its reference, supply variation cancels. The reading depends on the resistor ratio, not on the rail voltage. If instead the divider is powered from one rail and the ADC compares against an internal reference, any rail movement shows up as temperature error. Check this first when the reading changes while a radio, motor or display switches on.

On ESP32 parts the internal reference is not tightly controlled from chip to chip. Espressif’s ADC calibration documentation says the ADC is designed around a 1100 mV reference, that the true value can range from 1000 mV to 1200 mV among chips, and that calibration reduces the variation. It also says the ADC is sensitive to noise and suggests a 100 nF capacitor at the input pad and multisampling. If you convert raw counts with the nominal reference and skip calibration, expect a unit-to-unit offset that looks like a sensor tolerance problem.

We cover the general causes of a noisy converter, such as source impedance, reference choice and sampling order, in why a microcontroller ADC reading is noisy or wrong. A thermistor divider adds one more trap. A high-value fixed resistor gives a high source impedance, and a sample-and-hold input wants a low one, so the capacitor at the pin is doing real work.

The conversion math

There are three common ways to turn resistance into temperature.

MethodGood forWatch for
Beta equationNarrow range around 25 °CError grows away from the reference point
Steinhart-HartWide range, three fitted coefficientsNeeds coefficients that match your exact part
Lookup table with interpolationAny curve, small MCUsTable must come from the manufacturer’s data

The Beta equation is a one-parameter fit, so it is accurate near its reference point and drifts away from it. Steinhart-Hart uses three coefficients and is the usual choice when you need a good fit across a wide range. A lookup table taken from the vendor’s resistance-temperature table, with linear interpolation between rows, avoids floating-point math and fits any curve. On a small Cortex-M0 or MSP430 that is often the better choice.

Two mistakes recur. First, using a Beta value quoted for one temperature pair (for example 25 °C and 85 °C) outside that pair. Second, mixing a coefficient set from one part family with a resistance value from another. The thermistor’s tolerance is also a floor: a part with a stated resistance tolerance at 25 °C cannot give better absolute accuracy than that tolerance unless you calibrate each unit. No code fixes that.

Do the math in a way that survives the ends of the range. At open or shorted sensor the ADC reads near full scale or zero, and a logarithm of zero or a divide by zero will produce nonsense or a crash. Reject out-of-range counts and report a sensor fault instead of a temperature.

Self-heating and the leads

Current through the thermistor heats it. The datasheet’s dissipation constant is the power needed to raise the part 1 °C above ambient in still air, and a lower constant makes a part more prone to self-heating. Look up the value for your exact part and multiply your measured dissipation by its inverse to estimate the error. TE’s testing considerations note works through a 10 kΩ part on a 2 V excitation and calls the resulting error too large for most purposes.

The fix is to keep dissipation low. Use a higher divider resistance (watching source impedance, as above), a lower excitation voltage, or power the divider only during the measurement from a GPIO. The last option also saves battery. Allow the node to settle before sampling, since the thermistor and the capacitor form an RC.

Self-heating depends on how well the part is coupled to its surroundings. The same circuit self-heats more in still air than in a liquid or against a metal surface, so a bench test in free air does not predict a potted or bonded installation.

Leads and layout matter too:

  • Long leads add resistance and pick up noise. For a 10 kΩ thermistor, a few ohms of lead resistance is small. For high-value dividers, noise pickup is the concern. Use twisted pair, put the filter capacitor at the board end, and keep the run away from switching supplies.
  • Board heat is the bigger error for board-mounted parts. A thermistor next to a regulator, charger or power resistor reads the board, not the air. Slots or distance help, and so does a thermal path to what you actually want to measure.
  • Leakage from flux residue or humidity across a high-value divider shifts the reading. Cleaning and conformal coating choices affect this.

A checklist before changing parts

  1. Confirm the divider resistor suits the temperature range you need, not just 25 °C.
  2. Confirm the divider and the ADC share a reference, or that you calibrate the ADC.
  3. Confirm the firmware’s circuit orientation matches the schematic.
  4. Confirm the coefficients or table come from the exact thermistor part number.
  5. Measure the voltage across the thermistor and compute its dissipation.
  6. Hold the sensor in a known bath and compare against a reference thermometer at two or three temperatures.
  7. Check the reading with the radio, display and loads on and off.

If the error is the same on every unit, it is math or orientation. If it differs between units, look at the reference, tolerance and calibration. If it changes with load, look at the supply and grounding. That split narrows the cause quickly.

How we approach it

We check the divider, reference, conversion code and thermal placement against the accuracy the product needs, and we say plainly when a single-ended ADC input cannot meet it. Send the schematic, the thermistor part number, the target temperature range and accuracy, and a few raw ADC readings with the temperatures they should have been.

If your thermistor reading is off by more than the sensor tolerance, we would review the divider, the ADC front end and the conversion code against your target accuracy.

ENGINEERING NOTES

One note a week on PCB design, firmware and getting hardware built. No sales email.

Double opt-in. Unsubscribe in one click.