Temperature level bar graph using LM35 with Arduino

The bar graph LED output is very easy to understand the level of output. Here we used LM35 three pin temperature sensor and arduino uno to take input from LM35 and to control array of LED.




The temperature sensor’s output pin connected with the analog input pin (A0) of arduino and the digital pins 8 to 12 are connected with LEDs.

Here you can additionally connect the buzzer at digital pin D7 of arduino to get beep output when the temperature level exceeds particular level. The arduino sketch code given here has the buzzer output function.

lm35-temp-graph-schematics

Circuit diagram

lm35-temp-graph-ckt-mi

Temperature level bar graph arduino sketch code

[code]

//theorycircuit.com
//temperature sensor (LM35) controlled LED output with buzzer
int tempsensor = 0;
int firstled = 8;
int secondled = 9;
int thirdled = 10;
int fourthled = 11;
int fifthled = 12;
int buzzerpin = 7;
void setup()
{
Serial.begin(9600);
pinMode(firstled,OUTPUT);
pinMode(secondled,OUTPUT);
pinMode(thirdled,OUTPUT);
pinMode(fourthled,OUTPUT);
pinMode(fifthled,OUTPUT);
pinMode(buzzerpin,OUTPUT);
}
void loop()
{
tempsensor=analogRead(0);
if(tempsensor<=129)
{
digitalWrite(firstled,HIGH);
digitalWrite(secondled,LOW);
digitalWrite(thirdled,LOW);
digitalWrite(fourthled,LOW);
digitalWrite(fifthled,LOW);
digitalWrite(buzzerpin,LOW);
}
else if(tempsensor>=130&&tempsensor<155)
{
digitalWrite(firstled,LOW);
digitalWrite(secondled,HIGH);
digitalWrite(thirdled,LOW);
digitalWrite(fourthled,LOW);
digitalWrite(fifthled,LOW);
digitalWrite(buzzerpin,LOW);
}
else if(tempsensor>=155&&tempsensor<165)
{
digitalWrite(firstled,LOW);
digitalWrite(secondled,LOW);
digitalWrite(thirdled,HIGH);
digitalWrite(fourthled,LOW);
digitalWrite(fifthled,LOW);
digitalWrite(buzzerpin,LOW);
}
else if(tempsensor>=165&&tempsensor<180)
{
digitalWrite(firstled,LOW);
digitalWrite(secondled,LOW);
digitalWrite(thirdled,LOW);
digitalWrite(fourthled,HIGH);
digitalWrite(fifthled,LOW);
digitalWrite(buzzerpin,LOW);
}
else if(tempsensor>=180&&tempsensor<200)
{
digitalWrite(firstled,LOW);
digitalWrite(secondled,LOW);
digitalWrite(thirdled,LOW);
digitalWrite(fourthled,LOW);
digitalWrite(fifthled,HIGH);
digitalWrite(buzzerpin,LOW);
}
else if(tempsensor>200)
{
digitalWrite(firstled,HIGH);
digitalWrite(secondled,HIGH);
digitalWrite(thirdled,HIGH);
digitalWrite(fourthled,HIGH);
digitalWrite(fifthled,HIGH);
digitalWrite(buzzerpin,HIGH);
}
Serial.println(tempsensor);
delay(150);
}

[/code]

LM35 Pinout

LM35-pin

Components List

S.No Name Quantity
1. Arduino uno 1
2. LED Red
LED Yellow
LED Green
2
1
2
3. Resistor-220Ω
Resistor 1KΩ
5
1
4. Connecting wires as required
5. LM 35 temperature sensor 1

 



Prototype

LM35

LM35-temperature

Screen shot

temperature-shot-new

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *