Posts about... All (17) Android (2) Hooking Up Parts (10) Game Controllers (3) Robots (2)

How to Hook Up > Thermistors

A thermistor, or thermal resistor, can detect temperature since it’s resistance will vary depending on the temperature. This post will detect how to wire a thermistor to an Arduino as well as code to read a Fahrenheit value from it.

Parts

Steps

Code

Upload the following code to your Arduino board. Once it’s finished, open your Serial Monitor in the Arduino software.

#include <math.h>

double Thermister(int RawADC) {
double Temp;
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
Temp = Temp - 273.15; // Convert Kelvin to Celcius
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
return Temp;
}

void setup() {
Serial.begin(115200);
}

void loop() {
Serial.println(int(Thermister(analogRead(0)))); // display Fahrenheit
delay(5000);
}