Digital Thermometer using arduino and temperature sensor( LM35 )



Materials:-

Diagram:-


Connections:-

LCD display to arduino
  • Vss = Arduino GND
  • VDD = Arduino 5V
  • V0 = Potentiometer center pin
  • RS = Digital pin  2
  • RW = Arduino GND
  • E =   Digital pin 3
  • D4 = Arduino digital pin  4
  • D5  = Arduino digital pin 5
  • D6 = Arduino digital pin 6
  • D7 = Arduino digital pin 7
  • A = Arduino  5V
  • K = Arduino GND
    Potentiometer to arduino
    •   Left pin  = Arduino GND
    •   Right pin = Arduino 5v
    • center pin = Display VO 
    temperature sensor(LM35) to arduino
    • Sensor VCC = Arduino 3.5V
    • Sensor GND = Arduino GND
    • Sensor center = Arduino A0

    Downloads:-


    Code:-

     #include <LiquidCrystal.h>
    LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
    int tempin = A0; // the output pin of LM35
    int temp;
    int cel;
    int tempmin = 30;  
    int tempmax = 35;
    int kel;
    void setup() {
      pinMode(tempin, INPUT);
      Serial.begin(9600);
    lcd.begin(16,2);
    }

    void loop() {
      temp = analogRead(tempin);
      cel = temp * 0.48828125;
      kel= cel+ 273.15;
      Serial.print(cel);
      Serial.println();
      lcd.print("celsius: ");
      lcd.print(cel); // display the temperature(celcius)
      lcd.print("C ");
      lcd.setCursor(0, 1);// move cursor to next line
      lcd.print("kelvin:  ");
      lcd.print(kel); // display the temperature(kelvin)
      lcd.print("k ");
      delay(200);
      lcd.clear();


    }