The \$2 Thermistor Temperature Sensor

A thermistor makes for a very inexpensive temperature sensor, under \$2 for the thermistor and the 10k ohm resistor, not counting the \$45 for the Arduino and LCD display:

#include <LiquidCrystal.h>
#include <math.h>

/*
LCD Connections:
rs (LCD pin 4) to Arduino pin 12
rw (LCD pin 5) to Arduino pin 11
enable (LCD pin 6) to Arduino pin 10
LCD pin 15 to Arduino pin 13
LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2

Thermistor Connections:
Thermistor Pin 1 to +5v
Thermistor Pin 2 to Analog Pin 0
10k ohm resistor pin 1 to Analog Pin 0
10k ohm resistor pin 2 to Gnd
*/

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int backLight = 13;    // pin 13 will control the backlight

void setup(void) {
pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH); // turn backlight on. Replace ‘HIGH’ with ‘LOW’ to turn it off.
lcd.begin(20, 4);              // rows, columns.  use 16,2 for a 16×2 LCD, etc.
lcd.setCursor(0,0);            // set cursor to column 0, row 0
}

double Temp;
// See See http://en.wikipedia.org/wiki/Thermistor for explanation of formula
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
Temp = Temp – 273.15;           // Convert Kelvin to Celcius
return Temp;
}

void printTemp(void) {
double fTemp;
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Temperature is:”);
lcd.setCursor(0,1);
lcd.print(temp);
lcd.print(” C, “);
fTemp = (temp * 1.8) + 32.0;    // Convert to Fahrenheit
lcd.print(fTemp);
lcd.print(” F”);
if (fTemp > 68 && fTemp < 78) {
lcd.setCursor(0,3);
lcd.print(“Very comfortable”);
}
}

void loop(void) {
printTemp();
delay(1000);
}

Subscribe
Notify of
Inline Feedbacks
13 years ago

Thank you Mark (Hacktronics), for the code and components.

13 years ago

hello, we have NTC 10d-11 thermistor, but we don`t understand formula, which digits to change on it. Now arduino show us 80C instead of 20C 🙂
Maybe you can help us ? 🙂

13 years ago

The piece we used is 10k Ohm resistance at 25C. If yours is different, you will need to change the formula:

Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));

as described in http://en.wikipedia.org/wiki/Thermistor

13 years ago

our resistance is 10 ohm!
we used this formula: