Fiverr gig
$15 — I will help you with your project and simulate it for you
Hire me
🤖 Arduino Projects

Interfacing NTC Thermistor With Arduino

The Engineer PostMay 29, 20265 min read
[Interfacing NTC Thermistor With Arduino](https://circuitdigest.com/microcontroller-projects/interfacing-Thermistor-with-arduino) — Arduino UNO tutorial cover image

Welcome to this beginner-friendly Arduino tutorial on the ntc thermistor. By the end of the guide, you'll wire the module to an Arduino UNO, flash a short sketch, and read live values on the Serial Monitor — no prior electronics experience required.

What you'll learn

  • How the module works in plain language
  • The exact parts you need and how to wire them safely
  • The full Arduino IDE sketch with comments
  • Common issues and how to fix them
[Interfacing NTC Thermistor With Arduino](https://circuitdigest.com/microcontroller-projects/interfacing-Thermistor-with-arduino) — overview
[Interfacing NTC Thermistor With Arduino](https://circuitdigest.com/microcontroller-projects/interfacing-Thermistor-with-arduino) — wiring diagram

Arduino code

Open the Arduino IDE, paste the sketch below into a new file, install any libraries the sketch #includes (Tools → Manage Libraries), select your board and COM port, then click Upload.

/*!
 * @file        Arduino_NTC_Interface.ino
 * @brief       Interfacing NTC Thermistor With Arduino
 * @author      Jobit Joseph
 * @copyright   Copyright (c) 2022 Semicon Media Pvt Ltd (https://circuitdigest.com)
 */
#define ntc_pin A0         // Pin,to which the voltage divider is connected
#define vd_power_pin 2        // 5V for the voltage divider
#define nominal_resistance 10000       //Nominal resistance at 25⁰C
#define nominal_temeprature 25   // temperature for nominal resistance (almost always 25⁰ C)
#define samplingrate 5    // Number of samples 
#define beta 3950  // The beta coefficient or the B value of the thermistor (usually 3000-4000) check the datasheet for the accurate value.
#define Rref 10000   //Value of  resistor used for the voltage divider
int samples = 0;   //array to store the samples
void setup(void) {
  pinMode(vd_power_pin, OUTPUT);
  Serial.begin(9600);   //initialize serial communication at a baud rate of 9600
}

void loop(void) {
  uint8_t i;
  float average;
  samples = 0;
  // take voltage readings from the voltage divider
  digitalWrite(vd_power_pin, HIGH);
  for (i = 0; i < samplingrate; i++) {
    samples += analogRead(ntc_pin);
    delay(10);
  }
  digitalWrite(vd_power_pin, LOW);
  average = 0;
  average = samples / samplingrate;
  Serial.println("\n \n");
  Serial.print("ADC readings ");
  Serial.println(average);

  // Calculate NTC resistance
  average = 1023 / average - 1;
  average = Rref / average;
  Serial.print("Thermistor resistance ");
  Serial.println(average);

  float temperature;
  temperature = average / nominal_resistance;     // (R/Ro)
  temperature = log(temperature);                  // ln(R/Ro)
  temperature /= beta;                   // 1/B * ln(R/Ro)
  temperature += 1.0 / (nominal_temeprature + 273.15); // + (1/To)
  temperature = 1.0 / temperature;                 // Invert
  temperature -= 273.15;                         // convert absolute temp to C

  Serial.print("Temperature ");
  Serial.print(temperature);
  Serial.println(" *C");

  delay(2000);
}
[Interfacing NTC Thermistor With Arduino](https://circuitdigest.com/microcontroller-projects/interfacing-Thermistor-with-arduino) — reference image
[Interfacing NTC Thermistor With Arduino](https://circuitdigest.com/microcontroller-projects/interfacing-Thermistor-with-arduino) — reference image

How it works

The sketch initialises serial communication and the ntc thermistor driver in setup(), then in loop() it samples the sensor at a regular interval and prints the result to the Serial Monitor at 9600 baud. Open the Serial Monitor (Ctrl+Shift+M) after upload to see live readings.

Troubleshooting checklist

  • No readings: verify the baud rate in Serial Monitor matches the sketch (usually 9600).
  • Garbage characters: wrong baud rate or loose GND wire.
  • Library not found: install the exact library referenced in the #include line via Library Manager.
  • Sensor not detected (I²C): run an I²C scanner sketch to confirm the address.

What to build next

Once the basic readout works, try logging values to an SD card, sending them over Wi-Fi with an ESP32, or pushing them to a Blynk IoT dashboard. Pair this module with our simulator round-up to prototype the circuit before soldering.

Frequently Asked Questions

Q.What library do I need for the ntc thermistor?

Open Arduino IDE → Tools → Manage Libraries, then search for any library named in the sketch's #include lines and install the latest version.

Q.Why does the Serial Monitor show nothing?

The most common cause is a baud-rate mismatch — set the Serial Monitor to 9600 baud (bottom-right dropdown) so it matches Serial.begin(9600) in the code.

Q.Can I use this with an ESP32 instead of Arduino UNO?

Yes. The ntc thermistor works with any 3.3-5 V microcontroller. Just remap the wiring to ESP32 I/O pins and keep the rest of the sketch the same.

TEP

The Engineer Post

Embedded systems engineer and educator. Writes weekly tutorials at EmbedLab to help beginners ship real hardware.

Related projects

Browse all 50+ projects