Tutorial 16 – Reading Temperature with a Thermistor

Welcome back to CraftedTech Engineering's Arduino tutorial series! In this tutorial, we’ll show you how to read temperature values using a thermistor and an Arduino. This project will introduce you to analog sensors and give you hands-on experience in building a basic temperature-sensing system.


🔌 What You’ll Need

  • 1 Arduino Board (e.g., Arduino UNO)
  • 1 Thermistor (e.g., 10kΩ NTC thermistor)
  • 1 10kΩ Resistor
  • Jumper wires
  • Breadboard
  • USB cable for Arduino

You can order the required components here:


🧠 What Is a Thermistor?

A thermistor is a type of temperature sensor that changes its resistance with temperature. It is commonly used in temperature-sensing applications. In this example, we'll use an NTC thermistor (Negative Temperature Coefficient), which decreases in resistance as temperature increases.


🧾 Step-by-Step Instructions

🔧 Step 1: Wiring the Thermistor

  • Connect one leg of the thermistor to 5V on the Arduino.
  • Connect the other leg of the thermistor to A0 (analog pin 0) on the Arduino.
  • Connect a 10kΩ resistor from A0 to GND to form a voltage divider circuit.

💻 Step 2: Arduino Code to Read the Temperature

int sensorPin = A0; // The pin where the thermistor is connected int sensorValue = 0; // Variable to store the analog reading float voltage = 0; // Variable to store the voltage float temperature = 0; // Variable to store the temperature void setup() { Serial.begin(9600); // Start the serial communication } void loop() { sensorValue = analogRead(sensorPin); // Read the analog value from A0 voltage = sensorValue * (5.0 / 1023.0); // Convert the value to voltage (0-5V) // Convert voltage to temperature (this calculation is for a 10kΩ thermistor) temperature = (voltage - 0.5) * 100; Serial.print("Temperature: "); Serial.print(temperature); // Display temperature on the serial monitor Serial.println(" °C"); delay(1000); // Wait for 1 second }

🔍 Code Breakdown

  • sensorPin = A0; Specifies the analog pin where the thermistor is connected.
  • analogRead(sensorPin); Reads the analog value (0-1023) from the thermistor.
  • voltage = sensorValue * (5.0 / 1023.0); Converts the analog reading to a voltage value (0-5V).
  • temperature = (voltage - 0.5) * 100; Converts the voltage to temperature in Celsius based on a 10kΩ thermistor’s characteristics.
  • Serial.print() & Serial.println(); Outputs the temperature reading to the serial monitor.

🧪 Try This!

  • Adjust the thermistor’s position and observe how the temperature value changes in the serial monitor.
  • You can also try using a different thermistor or adding a display to show the temperature.

🛠️ Troubleshooting Tips

  • Ensure the thermistor is connected correctly and the voltage divider is properly wired.
  • If the temperature reading seems inaccurate, check the value of the thermistor and the resistors to ensure they match your calculations.

🧭 What You Learned in This Tutorial

✔️ How to wire and read data from an analog sensor (thermistor)
✔️ How to convert analog readings to a voltage value
✔️ How to use a thermistor for temperature measurement
✔️ How to display the temperature on the serial monitor


📌 Next Up: Tutorial 17 – Controlling Multiple LEDs with Arduino

In the next tutorial, we’ll explore how to control multiple LEDs using Arduino and create simple light patterns.


📣 Don’t forget to follow CraftedTech Engineering for more hands-on tutorials and project ideas!

🔗 Website: craftedtechengineering.com
📘 Facebook: @CraftedTechEngineering
📺 YouTube: @CraftedTechEngineering

Back to blog

Leave a comment