Aziz Bench

NTC thermistor calculator

Temperature to resistance and back with the Beta equation, plus the divider in front of your ADC: the reading at each temperature, how many degrees each step is worth and the fixed resistor that suits your range.

Resistance
5.3kΩ
at 40.0 °C · 0.53 × R25
Voltage at the ADC
1.143 V
ADC reading
1,419
Per ADC step
0.027 °C
ADC reading against temperature
02,0004,0000°20°40°60°80°100°
Thermistor
Ω
K

From the datasheet. B25/50 fits room temperatures best, B25/85 warmer ranges.

Calculate
Start from
°C
Divider and ADC
V
V

Same as the supply on an Arduino Uno with the default reference. The ESP32 ADC has its own reference: use calibrated voltages there if you can.

Ω
Thermistor goes to
ADC resolution
Temperature range
°C
°C

Used for the table, the chart and the best fixed resistor.

Best fixed resistor

For 0 °C to 100 °C the divider is most sensitive in the middle with 3.59 kΩ, the thermistor’s resistance at 50 °C. Nearest E24 value: 3.6 kΩ.

Reading from 0 °C to 100 °C

TemperatureResistanceVoltageADCPer step
0 °C33.6 kΩ2.543 V3,1560.026 °C
10 °C20.2 kΩ2.206 V2,7380.022 °C
20 °C12.5 kΩ1.836 V2,2780.022 °C
30 °C8.04 kΩ1.470 V1,8250.023 °C
40 °C5.3 kΩ1.143 V1,4190.027 °C
50 °C3.59 kΩ0.871 V1,0810.033 °C
60 °C2.49 kΩ0.657 V8150.043 °C
70 °C1.76 kΩ0.494 V6130.057 °C
80 °C1.27 kΩ0.372 V4620.077 °C
90 °C934 Ω0.282 V3500.1 °C
100 °C698 Ω0.215 V2670.14 °C

What to consider

Code

Arduino
// NTC 10 kΩ, B 3950, NTC to GND
const float R_FIXED = 10000.0;  // fixed resistor, ohms
const float R25 = 10000.0;      // NTC resistance at 25 °C, ohms
const float BETA = 3950.0;
const float V_SUPPLY = 3.3;    // divider supply, volts
const int PIN = 34;  // GPIO34

float readTempC() {
  long sum = 0;
  for (int i = 0; i < 16; i++) sum += analogReadMilliVolts(PIN);  // average 16 readings
  float ratio = (sum / 16.0) / 1000.0 / V_SUPPLY;  // ESP32: calibrated millivolts, not raw counts
  if (ratio <= 0.0 || ratio >= 1.0) return NAN;          // shorted or disconnected
  float r = R_FIXED * ratio / (1.0 - ratio);   // NTC to GND
  return 1.0 / (1.0 / 298.15 + log(r / R25) / BETA) - 273.15;
}
ESPHome
sensor:
  - platform: adc
    id: ntc_voltage
    pin: GPIO34
    attenuation: 12db
    update_interval: 10s
  - platform: resistance
    id: ntc_resistance
    sensor: ntc_voltage
    configuration: DOWNSTREAM  # NTC to GND
    resistor: 10kOhm
    reference_voltage: 3.3V
  - platform: ntc
    sensor: ntc_resistance
    name: Temperature
    calibration:
      b_constant: 3950
      reference_temperature: 25°C
      reference_resistance: 10kOhm
Plain text, for your notes or a forum post.

The Beta equation

An NTC thermistor’s resistance falls as it warms up, roughly exponentially. Datasheets give its resistance at 25 °C (R25) and a B value, which together describe the curve:

R(T) = R25 × e^(B × (1/T − 1/298.15))
T = 1 ÷ (1/298.15 + ln(R ÷ R25) ÷ B) − 273.15
(T in kelvin: °C + 273.15)

Example: a 10 kΩ B3950 thermistor at 50 °C. 1/323.15 − 1/298.15 = −0.00025948; × 3950 = −1.0249; e^−1.0249 = 0.3588; R = 10 kΩ × 0.3588 ≈ 3.59 kΩ.

B25/50 or B25/85?

B is worked out from the resistance at two temperatures, and the datasheet says which: B25/50 uses 25 and 50 °C, B25/85 uses 25 and 85 °C. The two differ slightly for the same part: Murata’s NCP18XH103F03RB is 3380 K as B25/50 and 3434 K as B25/85. Use the one whose second temperature is closer to where you measure.

Choosing the fixed resistor

In a divider, the voltage changes fastest with temperature when the fixed resistor equals the thermistor’s resistance at that temperature. So pick the resistance at the middle of the range you care about: 10 kΩ for a 10 k thermistor around room temperature, about 3.6 kΩ for 0–100 °C (3.59 kΩ at 50 °C). Further from the middle, each ADC step covers more degrees.

Which side the thermistor goes on only flips the curve: with the thermistor to GND the voltage falls as it warms, with the thermistor to the supply it rises.

Resistance of a 10 kΩ B3950 thermistor

TemperatureResistanceα
-20 °C105 kΩ-6.16 %/°C
-10 °C58.2 kΩ-5.7 %/°C
0 °C33.6 kΩ-5.29 %/°C
10 °C20.2 kΩ-4.93 %/°C
20 °C12.5 kΩ-4.6 %/°C
30 °C8.04 kΩ-4.3 %/°C
40 °C5.3 kΩ-4.03 %/°C
50 °C3.59 kΩ-3.78 %/°C
60 °C2.49 kΩ-3.56 %/°C
70 °C1.76 kΩ-3.35 %/°C
80 °C1.27 kΩ-3.17 %/°C
90 °C934 Ω-3 %/°C
100 °C698 Ω-2.84 %/°C
110 °C529 Ω-2.69 %/°C
120 °C407 Ω-2.56 %/°C

Calculated with the Beta equation, R25 = 10 kΩ, B = 3950 K. α is the change in resistance per degree. Real parts follow the table in their datasheet, especially far from 25 °C.

Accuracy

Three things usually set the error. The thermistor’s tolerance: ±1 % on R25 is about ±0.26 °C near room temperature for a B 3380 part, because its resistance changes by about 3.8 % per degree there. The model: the Beta equation is exact at its two reference temperatures and drifts outside them; over a wide range, use the Steinhart–Hart equation with three calibration points. And self-heating: the divider current warms the thermistor, so keep it small, or power the divider only while measuring.

Frequently asked questions

What does B3950 mean on a thermistor?

It is the B value, 3950 K: how steeply the resistance falls with temperature. Together with the resistance at 25 °C (10 kΩ in a “10k B3950”) it defines the curve the calculator uses. The datasheet says which pair of temperatures it was measured between, for example 25/50 °C.

10 kΩ or 100 kΩ?

Pick the one whose resistance stays in a range your divider can read across your temperatures. 10 kΩ suits room, water and fridge temperatures. At 250 °C a 10 kΩ B3950 part drops to about 34 Ω, so 3D-printer hotends use 100 kΩ thermistors such as the Semitec 104GT-2, which by the Beta equation is still about 500 Ω at 200 °C.

Which fixed resistor should I use?

The thermistor’s resistance at the middle of your temperature range: then the divider is most sensitive where you measure. The calculator works it out from the range you enter and rounds it to a standard value.

NTC, PTC or DS18B20?

An NTC is cheap, small and fast, but needs a divider, an ADC and the formula. A PTC thermistor’s resistance rises with temperature, often sharply at one point, so PTCs mostly serve as resettable fuses and over-temperature switches rather than for measuring. A DS18B20 is a digital sensor: no calibration and ±0.5 °C from −10 to +85 °C according to its datasheet, but slower and limited to −55 to +125 °C.

Why are my readings off by a few degrees?

Check, in order: that R25 and B match your part; the fixed resistor’s real value; that the code assumes the same wiring (thermistor to GND or to the supply); that the ADC reference is the one the code assumes; and the ADC itself. The ESP32’s ADC is non-linear near 0 V and at the top of its range, so keep the divider voltage in the middle or use calibrated readings.

How do I wire a thermistor to an ESP32 or Arduino?

One leg of the thermistor to GND, the other to an analog pin and, through the fixed resistor, to 3.3 V (5 V on a 5 V Arduino). Add a 100 nF capacitor from the pin to GND. On an ESP32 use an ADC1 pin such as GPIO34: ADC2 can’t be used while Wi-Fi is on.