Lesson 9 Thermistor

Share for us


A thermistor is a type of resistor whose resistance varies significantly with temperature.


– 1 * SunFounder Uno board

– 1 * USB data cable

– 1 * Thermistor

– 1 * Resistor (10K)

– Several jumper wires

Experimental Principle

The resistance of the thermistor varies significantly with ambient temperature. It can detect surrounding temperature changes in real time. Send the temperature data to analog I/O port of SunFounder. Next we only need to convert sensor output to Celsius temperature by simple programming and display it on the serial port.

Experimental Procedures

Step 1: Build the circuit

The schematic diagram

Step 2: Program (Please refer to the example code in LEARN -> Get Tutorials on our website)

Step 3: Compile the code

Step 4: Upload the sketch to the SunFounder Uno board

Now, you can see current temperature displayed on the serial monitor.


// include the library code:
//#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
//LiquidCrystal lcd(4, 5, 9, 10, 11, 12);#define analogPin A0 //the thermistor attach to
#define beta 4090 //the beta of the thermistor
#define resistance 10 //the value of the pull-down resistorvoid setup()
// set up the LCD’s number of columns and rows:
//lcd.begin(16, 2);
}void loop()
//read thermistor value
long a = analogRead(analogPin);
//the calculating formula of temperature
float tempC = beta /(log((1025.0 * 10 / a – 10) / 10) + beta / 298.0) – 273.0;
//float tempF = 1.8*tempC + 32.0;
// Print a message of “Temp: “to the LCD.
// set the cursor to column 0, line 0
//lcd.setCursor(0, 0);
//lcd.print(“Temp: “);
Serial.print(“Temp: “);
// Print a centigrade temperature to the LCD.
// Print the unit of the centigrade temperature to the LCD.
//lcd.print(” C”);
Serial.print(” C”);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
//lcd.setCursor(0, 1);
//lcd.print(“Fahr: “);
// Print a Fahrenheit temperature to the LCD.
// Print the unit of the Fahrenheit temperature to the LCD.
//lcd.print(” F”);
delay(200); //wait for 100 milliseconds


Leave a Comment

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