ESP32 S3 - NTC Thermistor Temperature Sensor

A freezer door that stays open a crack overnight can spoil a whole drawer of food before anyone sees it. A small steel probe on a thin cable can catch that early. The DIYables 10K NTC thermistor probe is waterproof, reads from -20°C up to 105°C, and costs very little, and in this guide your ESP32 S3 reads it on GPIO1 and prints the temperature in Celsius and Fahrenheit.

What you'll build in this tutorial:

  1. A close look at the probe: the steel tip, the two wires without polarity, the white 2-pin plug, and the 10K resistor that comes in the kit
  2. A voltage divider on just three pins of the ESP32 S3: 3V3, GPIO1 and GND
  3. A sketch that averages calibrated millivolt readings, works out the thermistor resistance and turns it into degrees with the B formula
  4. A cold test with ice and salt that takes the reading below 0°C
ESP32 S3 reads a waterproof 10K NTC thermistor probe as a digital thermometer

Overview of NTC Thermistor Temperature Sensor

Waterproof 10K NTC thermistor probe with its 0.5m cable and white JST XH2.54 plug
image source: diyables.io

Unlike most sensor modules, this one has no board, no chip and no pin header. At the very end of the steel tip sits one tiny part, a thermistor: a resistor whose value changes a lot with temperature. The ESP32 S3 measures that resistance and turns it into degrees. Because the tip is sealed, you can drop it into water, push it into soil, or lay it on a freezer shelf, while the ESP32 S3 stays dry outside.

Key Specifications

The thermistor is 10kΩ at 25°C with a 1% tolerance, and its B value is 3950. It works from -20°C to 105°C. The stainless-steel tip is 5mm wide and 25mm long with a round end, and a black two-wire cable of 0.5m runs from it to a white JST XH2.54 2-pin plug. The insulation is more than 100MΩ. DIYables sells the probes in a set of five, and each probe comes with its own 10K resistor, so you do not have to buy one.

NTC Thermistor Pinout

The plug has two openings, and the pin of a male jumper wire pushes straight into each one. Neither opening has a label, and you do not need one:

  1. Probe wire A — to the 3V3 pin of the ESP32 S3
  2. Probe wire B — to GPIO1, where one leg of the 10K resistor also joins; the other resistor leg goes to GND

It does not matter which wire you call A. Like any resistor, the thermistor works the same way in both directions, so swapping the two wires gives the same reading.

How It Measures Temperature

NTC means Negative Temperature Coefficient. When the tip gets colder, its resistance goes up, and when it gets warmer, its resistance goes down. An ADC measures voltage, not resistance. So the thermistor and the 10K resistor sit in a row between 3V3 and GND, and GPIO1 measures the voltage at the point where they meet. A cold tip has a high resistance and leaves only a small part of the 3.3V for GPIO1. A hot tip does the opposite. Some points of the curve:

Probe temperature Thermistor resistance Voltage on GPIO1
-10°C about 58.2kΩ 0.48V
0°C about 33.6kΩ 0.76V
25°C 10.0kΩ 1.65V
45°C about 4.35kΩ 2.30V
85°C about 1.09kΩ 2.98V

From the voltage, the sketch finds the resistance R. Then it uses the B-parameter (beta) equation:

1/T = 1/T0 + (1/B) × ln(R/R0)

Here T0 is 298.15K (25°C), R0 is 10000Ω and B is 3950. The answer T is in Kelvin, so the code takes away 273.15 to get °C. Many thermistor guides use the Steinhart-Hart equation instead. It has three constants and is a little more exact, but with this probe the B equation does the job. In practice, readings close to room temperature land within roughly 1°C of the truth; the 10K resistor and the ESP32 S3 ADC set the rest of the error.

Only need a temperature and want no math at all? The waterproof DS18B20 probe sends a ready digital value; see ESP32 S3 - Temperature Sensor. For an oven or a grill, which go far above 105°C, a thermocouple with a MAX6675 module is the right tool.

Wiring Diagram

Apart from the probe, the only part is the 10K resistor from the kit, and the ESP32 S3 gives three pins: 3V3, GPIO1 and GND. The resistor bridges the GPIO1 wire and the GND wire; a small breadboard makes this joint easy, or you can twist each resistor leg around the bare end of its wire and solder it. Why GPIO1? On the screw terminal block below, the top row starts with GND, TX, RX, 1. GPIO1 is only three terminals away from a GND terminal, so the 10K resistor can be screwed straight into both.

The wiring diagram between ESP32 S3 NTC thermistor

This image is created using Fritzing. Click to enlarge image

Thermistor Circuit ESP32 S3 Pin
Probe wire A 3V3
Probe wire B GPIO1 (ADC1)
10K resistor, one end GPIO1 (ADC1)
10K resistor, other end GND

Jumper wires are good for a quick test, but not for a final build. You can plug the ESP32 S3 into a Screw Terminal Block for ESP32 S3 and connect the wires to its screw terminals. Here is the same circuit wired through the screw terminal board:

The wiring diagram between ESP32 S3 NTC thermistor Screw Terminal

This image is created using Fritzing. Click to enlarge image

On this board the 10K resistor sits in the GND terminal and the GPIO1 terminal, and the probe wire shares the GPIO1 terminal with it, so you do not need a GND wire.

Or plug the ESP32 S3 into a GPIO Breakout Board for ESP32 S3. The same wiring then looks like this:

The wiring diagram between ESP32 S3 NTC thermistor GPIO Breakout Board

This image is created using Fritzing. Click to enlarge image

Safety Notes

Give the probe its power from 3V3 and never from 5V. The warmer the tip, the closer GPIO1 gets to the supply voltage, so with 5V a hot probe would push the pin over the 3.3V it can take. 3V3 is also the value the sketch counts on, because it uses 3300 millivolts as the top of the divider. GPIO1 belongs to ADC1, which keeps reading correctly after you turn on WiFi, while the ADC2 pins do not; that leaves room to send the temperature to a phone later without moving a wire. Last, the seal ends at the steel tip. In the ice test below, or in a fish tank, hold the white plug, the jumper wires and the resistor junction well above the water, where they stay dry.

How To Program For NTC Thermistor

No library is needed. In setup(), analogSetAttenuation(ADC_11db) lets GPIO1 measure up to about 3.1V. In loop(), the sketch takes ten analogReadMilliVolts() readings and averages them; this function uses the calibration that was stored in the chip at the factory, which is more accurate than dividing analogRead() by 4095, mostly near the low and high ends of the ESP32 S3 ADC. From the average, the resistance is 10000 × (3300 − mV) / mV, the B equation turns it into Kelvin, and two short lines give °C and °F. When the voltage is almost 0V or at the very top of the range, the sketch prints a wiring hint instead of a strange number.

ESP32 S3 Code - NTC Thermistor Temperature Sensor

Every second, this sketch prints the voltage on GPIO1, the thermistor resistance in kΩ, and the temperature in both units.

/* * This ESP32 S3 code was developed by newbiely.com * * This ESP32 S3 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3/esp32-s3-ntc-thermistor-temperature-sensor */ #define THERMISTOR_PIN 1 // ESP32 S3 GPIO1 (ADC1), the joint between the thermistor and the 10K resistor #define VCC_MV 3300.0 // the divider is powered from the 3V3 pin (in millivolts) #define SERIES_OHMS 10000.0 // the 10K resistor from GPIO1 to GND (it comes in the probe kit) #define NOMINAL_OHMS 10000.0 // thermistor resistance at 25°C (R0) #define NOMINAL_KELVIN 298.15 // 25°C written in Kelvin (T0) #define BETA 3950.0 // B value of the probe #define NUM_SAMPLES 10 // readings averaged for one result #define OPEN_MV 100 // below this, GPIO1 is held at GND by the resistor alone: no probe #define TOP_MV 3100 // above this, GPIO1 is at the top of the ADC range void setup() { Serial.begin(9600); analogSetAttenuation(ADC_11db); // GPIO1 can now measure from 0V up to about 3.1V } void loop() { // add up several calibrated readings and divide, so the ADC noise is smoothed out long total_mv = 0; for (int i = 0; i < NUM_SAMPLES; i++) { total_mv += analogReadMilliVolts(THERMISTOR_PIN); // uses the factory calibration of the chip delay(10); } float mv = total_mv / (float)NUM_SAMPLES; if (mv < OPEN_MV) { // nothing connects GPIO1 to 3V3, so the 10K resistor pulls it down to 0V Serial.println("GPIO1 reads about 0 V: is the probe plugged in, and is its other wire on 3V3?"); } else if (mv > TOP_MV) { // the thermistor has (almost) no resistance left: a short, a wrong wire, or a very hot probe Serial.println("GPIO1 is at the top of its range: probe wires shorted, resistor not on GND, or hotter than about 100 °C"); } else { // thermistor on the 3V3 side, 10K resistor on the GND side: // mv = VCC_MV * SERIES_OHMS / (SERIES_OHMS + r_ntc), solved for r_ntc float r_ntc = SERIES_OHMS * (VCC_MV - mv) / mv; // B (beta) equation: 1/T = 1/T0 + ln(R/R0) / B, with T in Kelvin // log() in Arduino code is the natural logarithm (ln) float kelvin = 1.0 / (1.0 / NOMINAL_KELVIN + log(r_ntc / NOMINAL_OHMS) / BETA); float celsius = kelvin - 273.15; float fahrenheit = celsius * 9.0 / 5.0 + 32.0; Serial.print("GPIO1 = "); Serial.print(mv / 1000.0, 3); // volts, 3 decimals Serial.print(" V | R_ntc = "); Serial.print(r_ntc / 1000.0, 2); // kilo-ohms, 2 decimals Serial.print(" kΩ | "); Serial.print(celsius, 1); Serial.print(" °C ("); Serial.print(fahrenheit, 1); Serial.println(" °F)"); } delay(1000); // about one result per second }

Detailed Instructions

  1. New to ESP32 S3? Complete our Getting Started with ESP32 S3 guide first.
  2. Wire the probe and the 10K resistor as shown in the table. Check twice that probe wire A sits on 3V3 and not on 5V.
  3. Connect the ESP32 S3 to your computer with the Type-C cable.
  4. In the Arduino IDE, choose ESP32S3 Dev Module under Tools > Board and the right port under Tools > Port.
  5. Paste the code into a new sketch and click Upload.
  6. Open the Serial Monitor at 9600 baud. Let a few lines go by while the probe lies on the desk.
  7. Fill a bowl with crushed ice, stir in two spoons of salt and a little water, then push the steel tip into the middle of it.
  8. Pro Tip: Salty ice is good to see the reading go below zero, but it is not a fixed point. To check the accuracy, use plain ice water without salt: after a minute, the probe should show close to 0°C. If it is always off by the same small amount, add or subtract that amount from celsius in the code.
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
GPIO1 = 1.697 V | R_ntc = 9.45 kΩ | 26.3 °C (79.3 °F) GPIO1 = 1.694 V | R_ntc = 9.48 kΩ | 26.2 °C (79.2 °F) GPIO1 = 1.701 V | R_ntc = 9.40 kΩ | 26.4 °C (79.5 °F) GPIO1 = 1.427 V | R_ntc = 13.13 kΩ | 19.0 °C (66.2 °F) GPIO1 = 1.076 V | R_ntc = 20.67 kΩ | 9.5 °C (49.1 °F) GPIO1 = 0.826 V | R_ntc = 29.95 kΩ | 2.2 °C (36.0 °F) GPIO1 = 0.664 V | R_ntc = 39.70 kΩ | -3.1 °C (26.4 °F) GPIO1 = 0.573 V | R_ntc = 47.59 kΩ | -6.4 °C (20.5 °F) GPIO1 = 0.535 V | R_ntc = 51.68 kΩ | -7.9 °C (17.8 °F) GPIO1 = 0.517 V | R_ntc = 53.83 kΩ | -8.6 °C (16.5 °F) GPIO1 = 0.512 V | R_ntc = 54.45 kΩ | -8.8 °C (16.1 °F)
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

The first three lines show a warm room at about 26°C. Then the tip goes into the bowl. The voltage drops, and the resistance climbs from about 9kΩ to more than 50kΩ, the NTC behavior from the table above. Salt makes ice melt at a lower temperature, so the mix gets colder than plain ice water and the probe passes 0°C after a few seconds. The last lines change only a little: the steel tip has reached the temperature of the bowl. Always wait for such steady lines before you trust a value.

If you see "GPIO1 reads about 0 V", the plug is loose or wire A is not on 3V3. If you see "GPIO1 is at the top of its range", the resistor does not reach GND, or the two probe wires touch.

Application and Project Ideas

A sealed probe that reads below zero and up to 105°C fits many ESP32 S3 projects at home.

  1. Freezer alarm: Sound a buzzer, or send a message over WiFi, when the freezer stays above -12°C for ten minutes.
  2. Aquarium heater check: Leave the tip in the tank and warn when the water leaves the 24°C to 28°C range.
  3. Fermentation logger: Write the temperature of beer, wine or yogurt to a web page every minute while it ferments.
  4. Hot water pipe monitor: Tape the tip to the pipe from a water heater to see when it runs and for how long.
  5. Battery pack guard: Tape the probe to a battery pack and switch the charger off with a relay when the pack gets too warm.

Challenge Yourself

  1. Beginner: Turn on an LED on GPIO4 whenever the temperature goes below 0°C.
  2. Intermediate: Keep the lowest and the highest temperature since power-up, and print them after every tenth reading.
  3. Advanced: Add a second probe and 10K resistor on GPIO7, which is also an ADC1 pin, and print both temperatures on one line, for example the fridge and the freezer.

Video Tutorial

A video for this ESP32 S3 thermistor lesson will be added here.

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!