Lesson 9 Thermistor

Share for us
Share on facebook
Share on twitter
Share on pinterest
Share on whatsapp

Introduction

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

Components

– 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 Monitor.

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.

Code

/************************************
* name:thermistor
* function:you can see current temperature displayed on the serial monitor.
**************************************/
//Email: support@sunfounder.com
//Website: www.sunfounder.com#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()
{
Serial.begin(9600);
}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;//convert centigrade to Fahrenheit
Serial.print(“TempC: “);//print” TempC: “
Serial.print(tempC);//print Celsius temperature
Serial.print(” C”);//print the unit
Serial.println();
//Serial.print(“TempF: “);
// Serial.print(tempF);
// Serial.print(” F”);
delay(200); //wait for 200 milliseconds
}

Video