Overview
In this lesson, we will learn how to use a thermistor to collect the temperature data by programming Arduino. The information what a thermistor collects is displayed on the LCD1602.
Components
- 1 * Arduino UNO
- 1 * USB Cable
- 1 * LCD1602
- 1 * 10kΩ Potentiometer
- 1 * 10kΩ Resistor
- 1 * Thermistor
- 1 * Breadboard
- Several jumper wires
Principle
A thermistor is a type of resistor whose resistance varies significantly with temperature, more so than in standard resistors. In this experiment we use an MF52 NTC-type thermistor, and it is usually used as a temperature sensor.
The key parameters of an MF52 thermistor:
B-parameter: 3470.
25℃ resistance: 10kΩ.
The relationship between the resistance of thermistor and temperature is as follows:
: the resistance of the thermistor at temperature T1
R: the nominal resistance of the thermistor at room temperature T2
e: 2.718281828459
B: one of the important parameters of thermistor
T1: the Kelvin temperature that you want to measure
T2: Under the condition of a 25 ℃ (298.15K) room temperature, the standard resistance of MF52 thermistor is 10K;
Kelvin temperature = 273.15 (absolute temperature) + degrees Celsius;
After transforming the above equation, we can get the following formula:
Procedures
Step 1: Build the circuit
Step 2: Program
/*********************************************************** File name: 16_thermistor.ino Description: The information which a thermistor collects temperature is displayed on the LCD1602. Website: www.adeept.com E-mail: support@adeept.com Author: Tom Date: 2015/05/02 ***********************************************************/ #include <LiquidCrystal.h> int tim = 50; //the value of delay time // initialize the library with the numbers of the interface pins LiquidCrystal lcd(4, 6, 10, 11, 12, 13); int thermistorPin = 0; // thermistor connected to analog pin 3 void setup() { lcd.begin(16, 2); // set up the LCD's number of columns and rows: lcd.clear(); //Clears the LCD screen and positions the cursor in the upper-left corner } void loop() { float a = analogRead(thermistorPin); //the calculating formula of temperature float resistor = (1023.0*10000)/a-10000; float tempC = (3435.0/(log(resistor/10000)+(3435.0/(273.15+25)))) - 273.15; lcd.setCursor(0, 0); // set the cursor to column 0, line 0 lcd.print(" adeept ");// Print a message of "Temp: "to the LCD. lcd.setCursor(0, 1); // set the cursor to column 0, line 0 lcd.print(" Temp: ");// Print a message of "Temp: "to the LCD. lcd.print(tempC);// Print a centigrade temperature to the LCD. lcd.print(" C "); // Print the unit of the centigrade temperature to the LCD. delay(500); }
Step 3: Compile the program and upload to Arduino UNO board
Now, you can see the temperature collected by thermistor on the LCD1602.
Summary
After this lesson, you may have learned to use a thermistor to measure the temperature. Next, you can use it to make some interesting applications.