Thermistor

Thermistor is same as a photoresistor, except that the temperature controls the resistance instead of light

Analog resistance

Check notes for computation of analog resistance from Analog readings.

The following formula is valid for potentiometer and photoresistor

R_analog = R_1 / (1023/A0 -1)

Sketch

// Thermistor resistance at ambient temperature = 10Kohm
// Therefore, we choose a serial resistance 10Kohm
#define THERMISTORRESISTANCE 1000
#define THERMISTORPIN A0

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  float reading;
  reading = analogRead(THERMISTORPIN);

  Serial.print("Analog reading");
  Serial.println(reading);

  //calculate resistance from analog reading
  // check notes for derivation
  reading = (1023/reading)-1;
  reading = THERMISTORRESISTANCE/reading;

  Serial.print("Termistor resistance ");
  Serial.println(reading);

  delay(1000);

}

Thermistor as thermometer

It is possible to compute temperature using a thermistor with **Steinhart–Hart equation

There is an external library that implements this calculation

Just install the library, instantiate the object with required parameters and read temperature