Connect A Thermistor With Arduino To Measure and Display The Temperature On The LCD Screen

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Connect a Thermistor with Arduino to measure and display the

temperature on the LCD screen


Using a thermistor is an easy and cheap way to sensor the
temperature. And in order to accurately measure the temperature with
a thermistor, a microcontroller (microcontroller) will be required. So
here we are using an Arduino with a Thermistor to read the
temperature and an LCD to display the temperature. It is useful in
many projects such as remote weather station, home automation,
industrial and electronic equipment protection and control.
In this instructable we will interface the Thermistor with Arduino and
display the temperature on the LCD display.

Electrical circuit:

The thermistor provides the temperature value according to the


change in its electrical resistance. In this circuit, an analog pin in
Arduino is connected with the thermistor and can only provide the
ADC conversion values, so the electrical resistance of the thermistor
is not calculated directly. So the circuit is designed to be like the
voltage divider circuit as shown in the figure above, by connecting a
known resistance of 10 kOhm in series with a thermistor with a
negative temperature coefficient (resistance decreases with
temperature) NTC. Using this voltage divider we can get the voltage
across the thermistor and with that voltage we can extract the
resistance of the thermistor at that moment. Finally we can get the
temperature value by putting the resistance of the thermistor into the
Stein-Hart equation as shown below.
Thermistor:
The main component in this circuit is the thermistor, which is used to
detect overheating. A thermistor is a temperature sensitive resistor,
whose resistance changes according to the temperature. There are
two types of thermistors NTC (Negative Temperature Coefficient) and
PTC (Positive Temperature Coefficient), we use NTC type
thermistor. NTC thermistor is a resistor whose resistance decreases
with increasing temperature while PTC is a resistor whose resistance
increases with increasing temperature.

Calculating temperature using a thermistor:


We know that from the voltage divider circuit:
Code:

Vout=Vin*R/(R+Rt)
Vin/Vout =(R+Rt)/R=1+(Rt/R)
(Vin/Vout)-1 = Rt/R

Therefore, the value of Rt is:


Code:

Rt = R((Vin/Vout)-1)

Where Rt is the resistance of the thermistor and R is the known


resistance of 10k.
This equation is used to calculate the resistance of the thermistor
from the result of the ADC conversion value (let it be Vo). The output
voltage of the voltage divider is the analog input voltage of the
Arduino, so it is:
Code:

Vout = ADC Reading * (5/1024) = Vo * (5/1024)

And it will be:


Code:

Vin/Vout = 5/(V * (5/1024) = 1024/V

Code:

Rt = R((Vin/Vout)-1)= R((1024/Vo)-1)

Calculating temperature from the resistance of the thermistor:


Mathematically, the resistance of the thermistor can only be
calculated with the help of the Stein-Hart equation, which gives the
temperature T in Kelvin units.
Code:

T = 1 / (A + Bln(Rt) + Cln(Rt)^3 )

Where, A, B and C are constants, Rt is the resistance of the thermistor


and ln represents the logarithm log. The constant values for the
thermistor used in the project are A = 1.009249522 × 10−3, B =
2.378405444 × 10−4, C = 2.019202697 × 10−7.

Program:
To perform a calculation, we use (include) the header file “#include
<math.h>” and of course the header file for the LCD unit, which is
“#include <LiquidCrystal.h>”.
Code:

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

LiquidCrystal lcd(12,11,5,4,3,2);

float A = 1.009249522e-03, B = 2.378405444e-04, C = 2.019202697e-07;


float T,logRt,Tf,Tc;
int Vo;

void setup(){
lcd. begin(16,2);
lcd. clear();
}

void loop()
{
lcd. setCursor(0,0);
lcd. print("Temp:");

Vo=analogRead(A0);
logRt = log(10000.0*((1024.0/Vo-1)));
T = (1.0 / (A + B*logRt + C*logRt*logRt*logRt)); // We get the temperature value in Kelvin from this
Stein-Hart equation
Tc = T - 273.15; // Convert Kelvin to Celcius
Tf = (Tc * 1.8) + 32.0; // Convert Kelvin to Fahrenheit

lcd. print((T));
lcd. print("k");

lcd. setCursor(0,1);
lcd. print((Tc));
lcd. print(" C ;");
lcd. setCursor(9,1);
lcd. print((Tf));
lcd. print(" F");
delay(800);
}

Application: Controlling home appliances based on temperature


using Arduino and the thermistor.
Suppose you are sitting in a room and feel cold and want to turn on
the heater automatically, then turn it off after some time when the
room temperature rises. This project helps you control your home
appliances. automatically according to the temperature. Here we have
used a thermistor to read the temperature.
In this instructable, we will connect a home appliance with a relay and
make a home automation system to control the temperature using
Arduino. The temperature and status of the device are also displayed
on the 16 * 2 LCD screen connected to the circuit.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy