A Two-Resistor Thermometer: Read an NTC with Raspberry Pi Pico

Temperature can become a voltage without a digital temperature chip. Place a thermistor and a fixed resistor in a divider, then calculate what its midpoint means. This project is deliberately transparent: the code first recovers resistance and only then estimates temperature.

Meet the thermistor

NTC means negative temperature coefficient: resistance falls as the part warms. The exact part matters. This lesson uses a 10 kΩ Vishay NTCLE100E3103JB0 with a B25/85 value of 3977 kelvin. Another “10k thermistor” can use a different curve. B is a parameter describing how steeply resistance changes with temperature; it is not the resistance tolerance.

The chosen component has nominal resistance 10 kΩ at 25 °C. A matching fixed resistor places the divider midpoint near half the supply there. This uses a useful part of the ADC range for room-temperature experiments. ADC means analog-to-digital converter, the circuit that measures the voltage as a numeric code.

Parts to gather

  • Original Raspberry Pi Pico with MicroPython 1.26
  • Vishay NTCLE100E3103JB0, 10 kΩ at 25 °C, B25/85 = 3977 K
  • One 10 kΩ 1% fixed resistor and one 100 nF ceramic capacitor
  • USB cable, breadboard, multimeter and a reference room thermometer
A Two-Resistor Thermometer: Read an NTC with Raspberry Pi Pico. 3V3(OUT), pin 36 → 10 kΩ fixed resistor → SENSE SENSE → thermistor → GND, pin 38 SENSE → GP26, pin 31; 100 nF from SENSE to GND
Original Tricky Circuit connection diagram. Nominal values are calculated; this build has not been physically tested.

Complete connections

ConnectionPurpose
3V3(OUT), pin 36 → 10 kΩ fixed resistor → SENSEFixed resistor is the upper leg.
SENSE → thermistor → GND, pin 38The thermistor has no electrical polarity.
SENSE → GP26, pin 31; 100 nF from SENSE to GNDThe capacitor reduces rapid noise; it is parallel with the thermistor.

From a code to resistance

Call the scaled reading n, with full scale 65,535. The divider equation rearranges to Rntc = 10,000 × n/(65,535 − n). Because the divider and ADC reference follow the same 3.3 V supply, the ideal ratio cancels the absolute supply value. Real converter errors, resistor tolerance and wiring still matter.

At n = 32,767.5, Rntc = 10 kΩ and the temperature estimate is 25 °C. When the thermistor warms, its resistance falls, the midpoint voltage falls and n falls. If your reading moves in the opposite direction, check which component is connected to ground.

The temperature model

The approximation is 1/T = 1/298.15 + ln(Rntc/10,000)/3977, with T in kelvin. Subtract 273.15 to obtain degrees Celsius. The beta model is convenient for an introductory room experiment; for a wider range or an accuracy claim, use the manufacturer’s full resistance-temperature curve and an error budget. The code’s decimal place is display resolution, not proof of 0.1 °C accuracy.

Complete MicroPython program

"""Pico: 3V3 -> 10k fixed -> GP26 -> NTCLE100E3103JB0 -> GND."""
import math

def temperature_c(raw):
    if not 1000 < raw < 64500:
        raise ValueError("Input near rail: check open/short or operating range")
    resistance = 10000.0 * raw / (65535.0 - raw)
    kelvin = 1.0 / (1.0 / 298.15 + math.log(resistance / 10000.0) / 3977.0)
    return kelvin - 273.15

def main():
    from machine import ADC, Pin
    from time import sleep_ms
    adc = ADC(Pin(26))
    while True:
        raw = sum(adc.read_u16() for _ in range(32)) / 32
        try:
            print("raw=%.0f estimated_C=%.1f" % (raw, temperature_c(raw)))
        except ValueError as exc:
            print("temperature=UNKNOWN", exc)
        sleep_ms(1000)

if __name__ == "__main__":
    main()

Assembly and a useful test sequence

  1. Wire the divider with USB disconnected. Reconnect, save the code as main.py and watch the serial output.
  2. Leave the assembly on the table until it settles. Compare with a reference thermometer located beside it, away from the Pico’s warm electronics.
  3. Gently hold the thermistor body between dry fingers. Expect a gradual rise in the estimate and a falling raw reading. Do not expect an immediate jump.
  4. With power disconnected, replace the thermistor temporarily with another 10 kΩ resistor. The reading should be close to 25 °C by construction; this checks the conversion chain, not the thermistor’s accuracy.
  5. Remove that lower resistor and restart: near-full-scale input should report UNKNOWN. Short the thermistor’s two circuit nodes and test again: near-zero input should also report UNKNOWN.

Self-heating and faults

At 25 °C the nominal divider current is 3.3/20,000 = 165 µA. The thermistor dissipates I²R, about 0.272 mW. Even the act of measurement introduces heat; this modest power reduces that effect but does not eliminate all error. Keep air circulation and mounting consistent between comparisons.

Near-rail rejection protects the calculation from division by nearly zero and catches the demonstrated open and short conditions. It does not prove that every in-range reading is valid. The thermistor coating is not specified as electrical insulation or waterproofing. Keep this lesson at room temperatures with dry, low-voltage connections.

Challenge: why can a fixed 10 kΩ substitute be useful?

It produces a known divider ratio independently of temperature. If the program does not show approximately 25 °C with that substitute, investigate the fixed resistor, input connection and conversion before blaming the sensor curve.

Sources and related learning

Explore the Tricky Circuit interactive lessons. This article presents a design and software checks; no physical build results are claimed.

📡Broadcast the signal — amplify the connection.

Leave a Reply