Arduino with Thermistor
Thermistor
​
A thermistor is a resistance thermometer, or a resistor whose resistance is dependent on temperature. The name is a combination of "thermal" and "resistor". It is made of metallic oxides, pressed into a bead, disk, or cylindrical shape and then encapsulated with an impermeable material such as epoxy or glass.
Some common applications of the thermistor include: digital thermometers, used in cars to measure oil and coolant temperatures, in household appliances such as ovens and refrigerators, also found in any application that requires heating cooling protection circuits for safe operations.
​
Unlike other sensors, the thermistor doesn't actually read temperature, rather the resistance of a thermistor changes with temperature. The level of temperature depends on the material used in the thermistor. In addition to thermistor, several other types of temperature sensors are used. The most common types being: Resistance Temperature Detector (RTD) and integrated circuits (IC), such as the LM35 and AD590. The thermistor and LM35 are commonly used with the Arduino. Common differences between these two include: thermistor is more durable, smaller in size, less expensive, highly sensitive, and best for measuring single point temperature. While the LM35 provides linear output (i.e, the voltage is equivalent to the resistance) which thermistor does not. Thermistor also has slow response time.
Because the thermistor is a variable resistor, we need to measure the resistance before we calculate the temperature. But the Arduino can only measure voltage and not resistance directly. So, the Arduino will measure the voltage at a point between the thermistor and a known resistor, known as voltage divider. In our case, the known resistance is 10K ohms, because we are using a 10K ohms thermistor.
voltage divider equation:
where:
Vout = Voltage bwteen thermistor and known resistor.
Vin = Vcc (5V).
R1 = Known resistor value.
R2 = Resistance of thermistor.
​
to find R2:
Finally, the Steinhart-Hart equation is used to convert the resistance of the thermistor to a temperature reading.
where:
T = temperature (in Kelvins).
R = resistance at T. (in ohms).
A, B, C = the Steinhart-Hart coefficients, which vary depending on the type and model of thermistor and the temperature range of interest. (Here we will replace A, B, C with c1, c2, and c3).
​
(Will be expanded in the Arduino sketch.)
Schematic
​
Required components.
-
Arduino UNO R3.
-
Solderless Breadboard.
-
Thermistor (10K ohms).
-
Resistor (10K).
-
Jumper wires
Sketch
​
//Declaring your variables.
int ThermistorPin = 0;
int Vo;
float R1 = 10000;
float logR2, R2, T, Tc, Tf;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
​
void setup() {
Serial.begin(9600); //set rate for Serial monitor
}
​
void loop() {
Vo = analogRead(ThermistorPin);
R2 = R1 * (1023.0 / (float)Vo - 1.0); //finding R2.
logR2 = log(R2);
T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2)); //Steinhart-Hart equation
Tc = T - 273.15; //converting temperature to Celsius.
Tf = (Tc * 9.0)/ 5.0 + 32.0; //converting temperature to Fahrenheit.
​
//Dispay result in Serial monitor.
Serial.print("Temperature: ");
Serial.print(Tf);
Serial.print(" F; ");
Serial.print(Tc);
Serial.println(" C");
delay(500);
}
The above sketch will read temperature using thermistor and display results in Fahrenheit and Celsius in Arduino Serial monitor.