tutorialspinouttools
Sensors · ESP32-C3

NTC 10k Thermistor on OLED: Temperature

Free ESP32 & Arduino tutorial · wiring, code & parts · gokul.builds

Overview & Wiring

What it is: An NTC thermistor is a resistor whose resistance falls as temperature rises. The common "10k" type reads 10,000 Ω at 25 °C. With one fixed resistor it becomes a cheap, accurate temperature sensor. How it works: Build a voltage divider — NTC from 3V3 to the junction, a 10k fixed resistor from the junction to GND. Read the junction voltage, compute the NTC's resistance, then convert to temperature with the Beta equation (Beta ≈ 3950 for typical 10k NTCs). Wiring (voltage divider): 3V3 -> one leg of the NTC GPIO0 -> junction between the NTC and the 10k resistor (this is "SIG") GND -> other leg of the 10k resistor OLED VCC=3V3, GND=GND, SDA=GPIO4, SCL=GPIO5 Libraries: only "Adafruit SSD1306" and "Adafruit GFX Library". On screen / Serial: temperature in °C. Pinch the thermistor and watch it rise. Gotchas: If temperature reads backwards (drops when you warm it), swap the NTC and the fixed resistor positions. If your thermistor's Beta or nominal resistance differs, edit BETA / R_NOMINAL in the code. Use a 1% resistor for best accuracy.

Circuit Diagram

NTC 10k Thermistor on OLED: Temperature wiring diagram for ESP32-C3

Parts You Need

ESP32-C3 SuperMiniBuy →
0.96" SSD1306 OLEDBuy →

Source Code (Arduino / ESP32)

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <math.h>

Adafruit_SSD1306 display(128, 64, &Wire, -1);

#define NTC 0                 // junction on GPIO0 (ADC)
const float VREF     = 3.3;   // supply voltage across the divider
const float R_FIXED  = 10000; // fixed resistor to GND (ohms)
const float R_NOMINAL = 10000;// NTC resistance at 25 °C
const float T_NOMINAL = 25.0; // reference temperature (°C)
const float BETA     = 3950;  // NTC Beta coefficient

void setup() {
  Serial.begin(115200);
  Wire.begin(4, 5);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}

void loop() {
  float v = analogReadMilliVolts(NTC) / 1000.0;   // junction volts
  float rNtc = R_FIXED * (VREF / v - 1.0);         // NTC resistance (divider math)

  // Beta equation -> kelvin -> celsius
  float tK = 1.0 / (1.0 / (T_NOMINAL + 273.15) + (1.0 / BETA) * log(rNtc / R_NOMINAL));
  float tempC = tK - 273.15;

  display.clearDisplay();
  display.setTextColor(SSD1306_WHITE);
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println("NTC 10k");
  display.setTextSize(3);
  display.setCursor(0, 24);
  display.printf("%.1f", tempC);
  display.setTextSize(2);
  display.print(" C");
  display.display();

  Serial.printf("Temp: %.1f C  (R=%.0f ohm)\n", tempC, rNtc);
  delay(400);
}
Browse all tutorials ESP32-C3 pinout Calculators