Arduino: Project 19: Temperature Sensor

Hello everyone!! Welcome to this post on Arduino Projects!!
Need a short introduction to what the Arduino is then click on LINK
Check out the breadboard intro right HERE

In this project I’ve used a Thermistor (a resistor whose resistance varies with temperature) to build a temperature sensor

Demo:

So this is what my project turned out to be:

Things Required:

  1. Arduino UNO
  2. Jumper Wires
  3. 16×2 LCD Screen
  4. Thermistor
  5. 100 k ohm resistor
  6. 10k potentiometer
  7. Arduino IDE on computer

Reference Material:

  1. In this project there is some stuff you need to know before getting started.
    1. So a thermistor is a resistor whose resistance varies with temperature. You can learn more here (LINK).
    2. We connect a known resistance in series with the thermistor and form a voltage divider and read off the voltage across the thermistor.
    3. Then we convert the voltage to resistance.
What is a Voltage Divider or Potential Divider, Formula and ...

Vout= voltage obtained from voltage divider
Vin= 5volts
R1= 100k ohms
Now calculate R2

  1. To convert resistance to temperature, we have to make use of the Steinhart- Hart equation.
{\displaystyle {\frac {1}{T}}=A+B\ln R+C(\ln R)^{3},}
find out more here (LINK)
  1. I followed (LINK) this video to learn about this project.

Code:

View on/ Download from Github: (LINK)

#include<LiquidCrystal.h>
int rs= 7;
int en=8;
int d4=12;
int d5=11;
int d6=10;
int d7=9;
LiquidCrystal lcd (rs, en, d4,d5,d6,d7);

int Thermistorpin=A0;
int Vo;
float R1=100000;
float logR2, R2, T;
float A=1.009249522e-03, B= 2.3784054444e-04, C=2.019202697e-07;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(Thermistorpin, INPUT);
  lcd.begin(16,2);

}

void loop() {
  // put your main code here, to run repeatedly:
  Vo= analogRead(Thermistorpin);
  R2= R1*(1023.0/(float)Vo -1.0);
  logR2= log(R2);
  T=(1.0/(A+B*logR2 + C*logR2*logR2*logR2));
  T=T-273.15;
  //T= (T*9.0)/5.0 + 32.0;

  Serial.print("Temperature: ");
  Serial.print(T);
  Serial.println(" C");

  lcd.setCursor(0,0);
  lcd.print("Tempertaure: ");
  lcd.setCursor(0,1);
  lcd.print(T);
  lcd.print(" C");

  delay(500);

}

Stay Tuned for upcoming posts on Arduino Projects! Want to be the first to know when a new and amazing post comes up?? Then feel free to subscribe!

Happy Learning!!

This image has an empty alt attribute; its file name is stay-tuned.gif

Leave a Reply

PHP JS HTML CSS BASH PYTHON CODE

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: