Arduino NTC Temperature Sensor Module: Wiring, Code and Simulator
To build this Arduino NTC Temperature Sensor Module project you need an Arduino Uno and an NTC temperature sensor module. An NTC thermistor on A0 and the Beta equation turn a reading into degrees Celsius. Make the 3 connections in the wiring table, upload the Arduino C++ code, and change the temperature slider and watch the serial monitor follow it.
Open this circuit in the free Arduino Uno simulator
Parts list
| Qty | Part | What it does |
|---|---|---|
| 1 | Arduino Uno | the microcontroller board |
| 1 | NTC temperature sensor module | OUT to an analog pin. °C = 1 / (ln(1 / (1023/reading − 1)) / 3950 + 1/298.15) − 273.15. |
Wiring
| # | From | To |
|---|---|---|
| 1 | Arduino Uno 5V | NTC temperature sensor module VCC |
| 2 | Arduino Uno GND | NTC temperature sensor module GND |
| 3 | Arduino Uno A0 | NTC temperature sensor module OUT |
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 an NTC temperature sensor module from the parts palette.
- Wire 1. Connect Arduino Uno 5V to NTC temperature sensor module VCC.
- Wire 2. Connect Arduino Uno GND to NTC temperature sensor module GND.
- Wire 3. Connect Arduino Uno A0 to NTC temperature sensor module OUT.
- Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
- Run it. Press Run. Change the temperature slider and watch the serial monitor follow it.
Arduino C++ code
// Thermometer: an NTC thermistor on A0, converted to degrees Celsius.
const float BETA = 3950;
void setup() {
Serial.begin(9600);
}
void loop() {
int reading = analogRead(A0);
float celsius = 1 / (log(1 / (1023.0 / reading - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.print("Temperature: ");
Serial.print(celsius, 1);
Serial.println(" C");
delay(500);
}
What to try
Change the temperature slider and watch the serial monitor follow it.
Frequently asked questions
How do I wire the NTC Temperature Sensor Module project on an Arduino Uno?
Make 3 connections: Arduino Uno 5V to NTC temperature sensor module VCC; Arduino Uno GND to NTC temperature sensor module GND; Arduino Uno A0 to NTC temperature sensor module OUT.
What parts do I need for this Arduino project?
An Arduino Uno and an NTC temperature sensor module.
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?
An NTC thermistor on A0 and the Beta equation turn a reading into degrees Celsius.
More Arduino Uno projects
- Arduino LED Blink: Wiring, Code and Simulator
- Arduino LDR Light Sensor: Wiring, Code and Simulator
- Arduino NTC Thermistor Thermometer: 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