How to use a thermistor to measure temperature


10K ohm thermistor connected between 5V and A4
10K ohm fixed resistor between A4 and ground (GND)


  Use a thermistor to read the temperature.
  Specifically, this expects a 10K thermistor such as the Vishay NTCLE100 series.
  Hardware setup:
  Pick an analog pin on your Arduino.
  Make sure it matches the choice below in the code (usually A4).

  The thermistor should be wired from the analog pin (one lea) to 5V (the other lead).
  A 10K resistor (preferably 1%) should be wired from the analog pin to GND.
  This forms a voltage divider.
  As the temperature increases, the thermistor's resistance will go down, and so
  the voltage at the analog pin will go up.
  author: Rolf Widenfelt
  created: july 3, 2013
  additional credit to Charlie Sellers for working out the Steinhart-Hart equation for the thermistor.
// connect the thermistor to analog pin A4
int AnalogThermPin = A4;

// the setup routine runs once
void setup() {
  // start serial port

double ReadThermistor(int adc) {

  double resistance = ((1024.0/adc) - 1);    //calculate from voltage divider, for 10k resistor
  double Temp = log(resistance);

  // calculate the temperature, in K, using 4 thermistor model/material specific parameters A, B, C, D
  // here we use the values for the Sparkfun/Hactronics version of the Vishay 10k NTC thermistor
  Temp = 1 / (0.003354016 + 0.0002569850 * Temp + 0.000002620131 * Temp * Temp + 0.00000006383091 * Temp * Temp * Temp);
  Temp = Temp - 273.15;            // Convert Kelvin to Celsius
  // Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celsius to Fahrenheit
  return Temp;

// the loop routine runs over and over
void loop() {
  int adc = analogRead(AnalogThermPin);
  if (adc > 1 && adc < 1022) {    // catch an "open" or a "short"
    double tempC = ReadThermistor(adc);
    Serial.print("The temp is: ");
    Serial.println(tempC, 1);
  } else {

  delay(2000);               // wait for a bit
Print Friendly
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Leave a Reply

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