Pantech.AI

How to Interface Thermistor with Arduino UNO

Overview of Thermistor

A thermistor is a temperature-sensitive resistor whose resistance changes with variations in temperature. This change in resistance is used to measure temperature.

Thermistors are categorized into two types: PTC (Positive Temperature Coefficient) and NTC (Negative Temperature Coefficient).

They are commonly used as current limiters, temperature sensors, and overcurrent protectors.

For more information on thermistors and their usage, refer to the NTC Thermistor topic in the sensors and modules section.

Connection Diagram of NTC Thermistor with Arduino

Interfacing Thermistor With Arduino UNO

Measure Temperature using a thermistor and Arduino Uno

In this setup, a 10kΩ NTC thermistor is used, meaning it has a resistance of 10kΩ at 25°C.

The voltage across the 10kΩ resistor is fed to the ADC of the UNO board.

The resistance of the thermistor is calculated using a simple voltage divider formula.

Rth is the resistance of thermistor

Vout is the voltage measured by the ADC

The temperature can be calculated from the thermistor resistance using the Steinhart-Hart equation.

Temperature in Kelvin = 1 / (A + B[ln(R)] + C[ln(R)]^3)

where A = 0.001129148, B = 0.000234125 and C = 8.76741*10^-8

and R is the thermistor resistance.

NTC Thermistor Code for Arduino

#include <math.h>
const int thermistor_output = A1;

void setup() {
  Serial.begin(9600);	/* Define baud rate for serial communication */
}

void loop() {
  int thermistor_adc_val;
  double output_voltage, thermistor_resistance, therm_res_ln, temperature; 
  thermistor_adc_val = analogRead(thermistor_output);
  output_voltage = ( (thermistor_adc_val * 5.0) / 1023.0 );
  thermistor_resistance = ( ( 5 * ( 10.0 / output_voltage ) ) - 10 ); /* Resistance in kilo ohms */
  thermistor_resistance = thermistor_resistance * 1000 ; /* Resistance in ohms   */
  therm_res_ln = log(thermistor_resistance);
  /*  Steinhart-Hart Thermistor Equation: */
  /*  Temperature in Kelvin = 1 / (A + B[ln(R)] + C[ln(R)]^3)   */
  /*  where A = 0.001129148, B = 0.000234125 and C = 8.76741*10^-8  */
  temperature = ( 1 / ( 0.001129148 + ( 0.000234125 * therm_res_ln ) + ( 0.0000000876741 * therm_res_ln * therm_res_ln * therm_res_ln ) ) ); /* Temperature in Kelvin */
  temperature = temperature - 273.15; /* Temperature in degree Celsius */
  Serial.print("Temperature in degree Celsius = ");
  Serial.print(temperature);
  Serial.print("\t\t");
  Serial.print("Resistance in ohms = ");
  Serial.print(thermistor_resistance);
  Serial.print("\n\n");
  delay(1000);
}

Leave a Comment

Your email address will not be published. Required fields are marked *