Monday 26 June 2017

Interfacing of Temperature Sensor (LM35) with Arduino:


Interfacing of Temperature Sensor (LM35) with Arduino:



float temp;      
int sensor = 0;     // LM35 middle pin is analog pin 0

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  temp = analogRead(sensor);        //analog read pin read the temp value then store in temp
  temp = temp * 0.48828125;         //converting volts to degrees celsius ----- 0.48828125 = [(5V*1000)/1024]10

  Serial.print("The temperature is :");
  Serial.print(temp);
  Serial.println("deg. Celsius");
  delay(1000);
}


Circuit Diagram:



0 comments:

Post a Comment

if you have any doubt please let me know