A bare 10k NTC thermo sensor does not output a pre-calculated temperature value; it outputs a variable resistance that requires a voltage divider and the Steinhart-Hart equation to convert raw ADC readings into physical Celsius units. When interfacing this analog component with a 3.3V microcontroller like the ESP32, you must account for ADC non-linearity and self-heating errors to achieve better than ±1°C accuracy.
How an NTC Thermo Sensor Actually Works
An NTC (Negative Temperature Coefficient) thermistor is a passive semiconductor ceramic whose electrical resistance drops predictably and non-linearly as ambient temperature rises. Unlike digital sensors that transmit formatted I2C or SPI packets, a bare NTC thermo sensor is strictly a resistive element. It outputs neither voltage nor current on its own; it merely modulates current flow based on thermal excitation of its internal charge carriers.
To extract a usable signal, you must place the thermistor in a voltage divider circuit alongside a known precision resistor (typically 10kΩ). The microcontroller’s Analog-to-Digital Converter (ADC) measures the analog voltage at the junction of these two components. Because the resistance-to-temperature curve is highly non-linear—meaning a 10°C change at room temperature produces a vastly different voltage shift than a 10°C change at 80°C—you cannot use a simple linear multiplier. You must apply logarithmic scaling via the Steinhart-Hart equation to map the raw voltage to an accurate physical temperature.
Wiring the Thermo Sensor to an ESP32
The ESP32 operates at 3.3V logic and features a 12-bit ADC (yielding raw values from 0 to 4095). However, the ESP32’s internal ADC is notoriously non-linear at the extreme ends of its voltage range (below 0.15V and above 3.1V). To maintain accuracy, we select a voltage divider that keeps the junction voltage squarely in the linear middle-band (1.0V to 2.5V) for standard room-temperature applications.
| Component / Pin | Connection | Specification / Notes |
|---|---|---|
| ESP32 3V3 | Voltage Divider Top | Supply range: 3.2V - 3.4V (Use LDO for precision) |
| 10kΩ Precision Resistor (1%) | Between 3V3 and GPIO 34 | Pull-up resistor; sets the divider midpoint |
| NTC Thermo Sensor (10kΩ) | Between GPIO 34 and GND | e.g., Vishay NTCLE100E3103 (B-value: 3977K) |
| ESP32 GPIO 34 | ADC Junction (Input) | ADC1_CH6; Input only, no internal pull-up needed |
| 100nF Ceramic Capacitor | Between GPIO 34 and GND | Filters high-frequency EMI on the analog trace |
| ESP32 GND | Common Ground | Must share ground with the 3.3V supply source |
The Math: Converting Raw ADC to Celsius
Converting the raw 12-bit ADC integer into a usable Celsius reading requires a three-step mathematical pipeline. This scaling is mandatory; skipping it will yield completely unusable data.
Step 1: ADC Raw to Voltage
Assuming a stable 3.3V reference and a 12-bit resolution:
V_out = ADC_raw * (3.3 / 4095.0)
Step 2: Voltage to Thermistor Resistance
Using the voltage divider formula, we solve for the unknown NTC resistance ($R_{ntc}$), where $R_{series}$ is your 10,000Ω precision resistor:
R_ntc = R_series * (V_out / (3.3 - V_out))
Step 3: Resistance to Temperature (Steinhart-Hart)
The Steinhart-Hart equation models the non-linear curve of the thermistor. For a standard 10kΩ NTC with a B25/85 value of 3977K, the coefficients are approximately:
A = 0.001129148
B = 0.000234125
C = 0.0000000876741
The formula calculates temperature in Kelvin ($T_k$):
1 / T_k = A + B * ln(R_ntc) + C * (ln(R_ntc))^3
Finally, convert Kelvin to Celsius:
T_celsius = T_k - 273.15
For a deeper look at deriving these coefficients for off-brand sensors, refer to the Ametherm Steinhart-Hart guide. If you require higher precision than the ESP32's internal ADC can provide, bypass this math pipeline by using an external 16-bit I2C ADC like the ADS1115, which eliminates the ESP32's internal non-linearity errors entirely (see the Espressif ADC Oneshot Documentation for hardware limitations).
Common Interference Sources and Fixes
Analog thermo sensors are highly susceptible to environmental and electrical interference. If your readings are jittery or offset, check these three failure modes:
- Self-Heating Error: Current flowing through the thermistor generates heat ($P = I^2R$). If your series resistor is too small (e.g., 1kΩ), the thermistor will heat itself, reading 2°C to 5°C above ambient. Keep the continuous current below 50µA by using a 10kΩ or 47kΩ pull-up resistor.
- Lead Resistance Offset: Copper wire has resistance. If you run 20 feet of 22 AWG wire to a remote thermo sensor, the wire adds roughly 0.3Ω. While negligible for a 10kΩ thermistor at room temperature, it becomes a measurable error source in low-resistance, high-temperature scenarios.
- EMI and 50/60Hz Mains Hum: High-impedance analog nodes act as antennas for AC mains noise. This manifests as a ±20 count jitter on the ESP32 ADC. Fix this by routing the analog trace away from AC lines, using shielded twisted-pair cable for remote sensors, and placing a 100nF ceramic capacitor directly across the ADC pin and ground.
Thermo Sensor FAQ
Why is my thermo sensor reading 10 degrees too high?
A massive positive offset is almost always caused by self-heating or an incorrect B-value coefficient in your code. First, measure the voltage across the thermistor with a multimeter and calculate the current; if it exceeds 100µA, increase your pull-up resistor value. Second, verify the B-value printed on your sensor's datasheet. If you are using the Steinhart-Hart coefficients for a 3977K sensor, but your physical part is a 3435K or 3950K variant, the logarithmic math will compound the error at temperature extremes, resulting in massive offsets.
Can I use a digital thermo sensor instead of an analog NTC?
Yes, and for many hobbyist projects, you should. Digital sensors like the DS18B20 (1-Wire) or BME280 (I2C) contain internal ADCs and factory-calibrated lookup tables, outputting a clean digital Celsius value and completely bypassing the Steinhart-Hart math and ESP32 ADC non-linearity issues. However, analog NTC thermo sensors still win in three scenarios: extreme miniaturization (bare bead thermistors are under 1mm), ultra-fast thermal response times (under 1 second), and high-temperature environments (up to 300°C) where digital silicon ICs would melt or fail.
How do I waterproof a thermo sensor for liquid measurements?
Bare epoxy-coated NTC thermistors are moisture-resistant but not waterproof; prolonged submersion will cause water ingress, altering the dielectric properties and drifting the resistance. To waterproof a thermo sensor for brewing or hydroponics, slide the sensor and its solder joints into a 4mm diameter stainless steel or brass tube. Fill the void with high-temperature thermal epoxy or potting compound, leaving only the metal tip exposed for fast liquid thermal transfer. Avoid standard silicone sealants, as their thermal conductivity is too low and will severely slow down the sensor's response time.






