Uno: NTC Thermistor Temperature is a runnable microcontroller simulation example on SensBench — open the wired circuit, inspect the code, and compile real firmware in your browser, no install needed. Last updated Aug 14, 2026.

FREE SIMULATOR EXAMPLE · INTERMEDIATE

Uno: NTC Thermistor Temperature

This example reads a 10 kΩ NTC thermistor wired as a voltage divider on analog pin A1 and converts the ADC counts to Celsius with the simplified Steinhart-Hart equation. Temperature prints to the Serial Monitor in both °C and °F, to two decimals, once per second.

Board Arduino Uno (ATmega328P, 16 MHz, 5 V logic)
Difficulty intermediate
Category sensors
Libraries None — just the Arduino core
Runs in Sensbench browser simulator — free, no account
Arduino Uno reading a 10k NTC thermistor voltage divider on analog pin A1 in the Sensbench simulator

The exact circuit you get when you open this example — already wired, ready to run.

The sketch

// Arduino Uno — NTC Thermistor Temperature Sensor
// Wiring: OUT → A1  |  VCC → 5V  |  GND → GND

#define NTC_PIN A1

// Thermistor parameters for a 10 kΩ NTC (B = 3950)
const float VCC         = 5.0;
const float SERIES_R    = 10000.0;  // series resistor (10 kΩ)
const float NOM_R       = 10000.0;  // nominal resistance at 25 °C
const float B_COEFF     = 3950.0;   // Beta coefficient
const float NOM_TEMP_K  = 298.15;   // 25 °C in Kelvin

float readTempC() {
  int   raw  = analogRead(NTC_PIN);
  float v    = raw * (VCC / 1023.0);
  // Divider modelled by sensbench's ntc-temperature-sensor:
  //   VCC → R_pull (10k) → A1 → R_NTC → GND.
  // Higher temperature → R_NTC drops → V FALLS, so
  //   r = R_pull * v / (VCC - v)
  float r    = SERIES_R * v / (VCC - v);
  // Steinhart–Hart simplified equation
  float st   = log(r / NOM_R) / B_COEFF + 1.0 / NOM_TEMP_K;
  return (1.0 / st) - 273.15;
}

void setup() {
  Serial.begin(9600);
  Serial.println("NTC Thermistor Temperature Sensor");
}

void loop() {
  float tc = readTempC();
  float tf = tc * 9.0 / 5.0 + 32.0;
  Serial.print("Temperature: ");
  Serial.print(tc, 2); Serial.print(" C  /  ");
  Serial.print(tf, 2); Serial.println(" F");
  delay(1000);
}

How it works

The front-end is a divider: 5V through a fixed 10 kΩ pull-up into A1, then through the thermistor to ground. An NTC’s resistance falls as it gets hotter, so the voltage at A1 falls too — the code comment calls this out because it surprises people. readTempC() turns the raw analogRead() (0-1023 on the Uno’s 10-bit ADC) back into resistance with r = SERIES_R * v / (VCC - v), which is just the divider equation solved for the unknown leg.

The math after that is the Beta-parameter form of Steinhart-Hart: log(r / NOM_R) / B_COEFF + 1.0 / NOM_TEMP_K, invert, subtract 273.15 for Celsius. Two constants do all the calibration work in that line — B_COEFF (3950 here) and the nominal 10 kΩ at 25 °C — and they have to match the thermistor actually on your bench.

Before you build it for real

The equation is only as honest as its constants. B = 3950 fits many cheap 10 kΩ NTCs, but plenty ship with B = 3435 or 3380 — a wrong B means errors of several degrees that grow the further you get from 25 °C, so check the datasheet of the part in your hand. The same goes for SERIES_R: if your module’s divider resistor is not 10 kΩ, every reading shifts until you change the constant. One thing you do not have to worry about: because both the divider and the ADC’s reference run from the same 5V rail, the measurement is ratiometric — a droopy USB supply mostly cancels out.

Get the parts

Related examples

FAQ

Why does the voltage drop when the temperature rises?

Because the thermistor is the lower leg of the divider. NTC means negative temperature coefficient — hotter means lower resistance — and a shrinking lower leg pulls the midpoint toward ground. Some modules wire the thermistor on top instead, which flips the relationship and would need the divider equation reworked.

How accurate is this compared to a DHT22?

With matched constants, an NTC resolves about 0.1 °C near room temperature on the Uno’s 10-bit ADC, and the element itself is typically within a few percent — comparable to a DHT22 for temperature, minus the humidity and the digital convenience. The NTC wins on range: it keeps working well past 100 °C, where a DHT22 gives up.