Arduino NTC Thermistor Thermometer: Wiring, Code and Simulator
To build this Arduino NTC Thermistor Thermometer project you need an Arduino Uno and a 10 kΩ resistor and a 10k NTC thermistor. A 10 kΩ NTC thermistor under a 10 kΩ resistor; the sketch turns the A1 reading back into °C with the beta equation. Make the 4 connections in the wiring table, upload the Arduino C++ code, and move the Temperature slider on the thermistor and compare with the printed value: the maths recovers it.
Open this circuit in the free Arduino Uno simulator
Parts list
| Qty | Part | What it does |
|---|---|---|
| 1 | Arduino Uno | the microcontroller board |
| 1 | 10 kΩ resistor | Limits current. 220 Ω in series with an LED; 10 kΩ as a pull-up or pull-down. |
| 1 | 10k NTC thermistor | A 10 kΩ (at 25 °C) NTC thermistor, β = 3950: warmer means lower resistance. In a divider with a 10 kΩ resistor, the Steinhart–Hart / β equation turns the reading back into °C. |
Wiring
| # | From | To |
|---|---|---|
| 1 | Arduino Uno 5V | 10 kΩ resistor leg 1 |
| 2 | 10 kΩ resistor leg 2 | 10k NTC thermistor 1 |
| 3 | Arduino Uno GND | 10k NTC thermistor 2 |
| 4 | Arduino Uno A1 | 10 kΩ resistor leg 2 |
Step by step
- Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
- Add the parts. Add a 10 kΩ resistor and a 10k NTC thermistor from the parts palette.
- Wire 1. Connect Arduino Uno 5V to 10 kΩ resistor leg 1.
- Wire 2. Connect 10 kΩ resistor leg 2 to 10k NTC thermistor 1.
- Wire 3. Connect Arduino Uno GND to 10k NTC thermistor 2.
- Wire 4. Connect Arduino Uno A1 to 10 kΩ resistor leg 2.
- Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
- Run it. Press Run. Move the Temperature slider on the thermistor and compare with the printed value: the maths recovers it.
Arduino C++ code
// Thermometer: a 10 kOhm NTC thermistor in a voltage divider, turned back
// into degrees with the beta equation.
// 5V -- 10 kOhm --+-- NTC -- GND
// '-- A1
const float R_FIXED = 10000.0; // the divider's top resistor
const float R0 = 10000.0; // thermistor resistance at 25 C
const float BETA = 3950.0;
void setup() {
Serial.begin(9600);
}
void loop() {
int raw = analogRead(A1);
float rNtc = R_FIXED * raw / (1023.0 - raw); // from the divider
float kelvin = 1.0 / (1.0 / 298.15 + log(rNtc / R0) / BETA);
float celsius = kelvin - 273.15;
Serial.print("R = ");
Serial.print(rNtc, 0);
Serial.print(" ohm T = ");
Serial.print(celsius, 1);
Serial.println(" C");
delay(500);
}
What to try
Move the Temperature slider on the thermistor and compare with the printed value: the maths recovers it.
Frequently asked questions
How do I wire the NTC Thermistor Thermometer project on an Arduino Uno?
Make 4 connections: Arduino Uno 5V to 10 kΩ resistor leg 1; 10 kΩ resistor leg 2 to 10k NTC thermistor 1; Arduino Uno GND to 10k NTC thermistor 2; Arduino Uno A1 to 10 kΩ resistor leg 2.
What parts do I need for this Arduino project?
An Arduino Uno and a 10 kΩ resistor and a 10k NTC thermistor.
Can I simulate this Arduino project online for free?
Yes. The BitForBytes Embedded Lab runs this exact circuit and Arduino C++ code in your browser for free, with no install and no hardware. The sketch is compiled with the real Arduino toolchain and runs on an emulated ATmega328P.
What does the code do?
A 10 kΩ NTC thermistor under a 10 kΩ resistor; the sketch turns the A1 reading back into °C with the beta equation.
More Arduino Uno projects
- Arduino LED Blink: Wiring, Code and Simulator
- Arduino LDR Light Sensor: Wiring, Code and Simulator
- Arduino PWM to Analog RC Filter: Wiring, Code and Simulator
- Arduino Capacitance Meter: Wiring, Code and Simulator
- Arduino DC Motor PWM Speed Control with MOSFET: Wiring, Code and Simulator
- Arduino Push Button LED: Wiring, Code and Simulator