Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Recipe

Turn a thermistor reading into degrees

Use when: an NTC thermistor sits on top of a fixed resistor in a divider, read by an analog pin

Goal: the temperature in °C, from the ADC code (or millivolts) and the thermistor's datasheet numbers

Taught in Temperature and humidity

  1. 1

    On the Uno R4, use the code itself: ratio = code / 1024. On the ESP32-S3, use analogReadMilliVolts and the 3V3 rail you measured: ratio = mV / supply mV.

    Example

    Uno R4, code 450: ratio = 450 / 1024 = 0.439.

    Why: the divider's output is a fraction of its supply, so the fraction is what carries the information.

  2. 2

    With the thermistor on top: R_{NTC} = R_f \times (1 - \text{ratio}) / \text{ratio}.

    Example

    10\ \text{k}\Omega \times (1024 - 450) / 450 = 12{,}756\ \Omega.

    Why: this is the divider formula rearranged for the one unknown resistor.

  3. 3

    1/T = 1/298.15 + \ln(R_{NTC}/R_{25})/\beta, then subtract 273.15.

    Example

    \ln(1.2756) = 0.2434; 0.2434 / 3977 = 0.0000612; 1/T = 0.0033540 + 0.0000612 = 0.0034152; T = 292.8 K, about 19.7 °C.

    Why: the beta model is a straight line between 1/T and \ln R, and kelvin starts at true zero.

  4. 4

    Find the two table rows either side of your resistance.

    Example

    Vishay lists 15,698 Ω at 15 °C and 12,488 Ω at 20 °C. 12,756 Ω sits between, near 20 °C.

    • your answer falls between them — done.
    • it doesn't — check the divider's orientation and the units (kelvin, ohms).

    Why: an upside-down divider or a forgotten 273.15 gives a wildly wrong answer that a table catches at a glance.

Common mistakes

  • Putting the thermistor on the bottom but using the "on top" formula: hot and cold come out swapped.
  • Using °C inside the beta equation instead of kelvin.
  • Integer division: (1024 - code) / code in int arithmetic drops the fraction.
  • Taking ln of the resistance in kΩ while R_{25} is in Ω.