Thermistor Interfacing with Arduino UNO
Thermistor is a type of resistor whose resistance changes in accordance with change in temperature. It is used to measure the temperature over small range typically -100 °C to 300 °C

Overview of Thermistor

Thermistor is a variable resistance element, whose resistance varies with change in temperature. The change in resistance value is a measure of the temperature.
Thermistors are classified as PTC (Positive Temperature Coefficient) or NTC (Negative Temperature Coefficient).
They can be used as current limiters, temperature sensors, overcurrent protectors etc.
For more information about thermistor and how to use it, refer the topic NTC Thermistor in the sensors and modules section.
Connection Diagram of NTC Thermistor with Arduino

Measure Temperature using a thermistor and Arduino Uno
Here, an NTC type thermistor of 10kΩ is used. NTC of 10kΩ means that this thermistor has a resistance of 10kΩ at 25°C.
Voltage across the 10kΩ resistor is given to the ADC of UNO board.
The thermistor resistance is found out using simple voltage divider network formula.
Rth is the resistance of thermistor
Vout is the voltage measured by the ADC
The temperature can be found out from 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);
}
Video of Temperature Measurement using NTC Thermistor and Arduino Uno
Components Used
Powered by


× 1Thermistor is a type of resistor whose resistance changes in accordance with change in temperature. It is used to measure the temperature over small range typically -100 °C to 300 °C.
474-SEN-00250

Downloads
Comments1
Join the discussion — share a question or tip.
- JA
The A, B, and C values must match the a chosen thermistor. Many manufacturers provide a Beta value, or just a table of temperatures. This online calculator below gave me values for A, B and C that matched temperatures using the vendor's Beta value My thermistor was NRBG104?3380B1* (datasheet https://www.eaton.com/content/dam/eaton/products/electronic-components/resources/data-sheet/eaton-nrbg-glass-sealed-radial-lead-ntc-thermistor-datasheet-elx1105-en.pdf) which had Beta of 3380 I used this calculator https://www.thinksrs.com/downloads/programs/therm%20calc/ntccalibrator/ntccalculator.html to calculate the A B and C values from three suggested points in the temperature table of the thermistor specification. A=0.000731689962 B=0.0002780392358 C=0.00000007870109994 (Note, the Beta value calculated didn't match the vendor's 3380, and I did not debug this perceived discrepancy. The vendor's Beta value DID calculate properly... Whatever you do, use a calibrated meter with thermocouple to verify your readings! In my validating spreadsheet, ln() must be used for Natural Log, but the code uses LOG() for Natural Log, which is confusing... yet isn't a mistake. (LOG is often shortcut for LOG base 10, but not for the compiler.
