Introduction

Room Temperature Using Arduino

Figure 1: LM35

Parts of list

Connection from sensor to board

Connection from LCD Display to Arduino

Room Temperature Using Arduino

Figure 2: LCD Display

Connection from Potentiometer to Arduino

Room Temperature Using Arduino

Figure 3: Potentiometer

Programming

#include <LiquidCrystal.h>    
    
// initialize the library with the numbers of the interface pins    
LiquidCrystal lcd(2 ,3 ,4 ,5 ,6 ,7);    
    
//declare variables    
float tempC;    
float tempF;    
int tempPin = 1;    
    
void setup(){    
  // set up the LCD's number of columns and rows:    
  lcd.begin(16, 2);    
  lcd.print("Temp1=");    
  lcd.setCursor(0, 1);    
  lcd.print("Temp2=");    
}    
    
void loop(){    
  tempC = analogRead(tempPin);           //read the value from the sensor    
  tempC = (5.0 * tempC * 100.0)/1024.0;  //convert the analog data to temperature    
  tempF = ((tempC*9)/5) + 32;            //convert celcius to farenheit    
    
  // print result to lcd display    
  lcd.setCursor(6, 0);    
  lcd.print(tempC,1);    
  lcd.print("'C");    
    
  lcd.setCursor(6, 1);    
  lcd.print(tempF,1);    
  lcd.print("'F");    
    
  // sleep...    
  delay(1000);    
}

Explanation

Output

Room Temperature Using Arduino

Figure 4: Output

Read more articles on Arduino: