Connect A Thermistor With Arduino To Measure and Display The Temperature On The LCD Screen
Connect A Thermistor With Arduino To Measure and Display The Temperature On The LCD Screen
Connect A Thermistor With Arduino To Measure and Display The Temperature On The LCD Screen
Electrical circuit:
Vout=Vin*R/(R+Rt)
Vin/Vout =(R+Rt)/R=1+(Rt/R)
(Vin/Vout)-1 = Rt/R
Rt = R((Vin/Vout)-1)
Code:
Rt = R((Vin/Vout)-1)= R((1024/Vo)-1)
T = 1 / (A + Bln(Rt) + Cln(Rt)^3 )
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);
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);
}