Introduction: Arduino Thermometer (LM 35 Temperature Sensor)
This is a simple circuit to check room temperature using Arduino and LM35(Temperatuure Sensor).If temperature is greater than 29 degree C then RED LED will glow else GREEN LED will glow.
GREEN LED indicates temperature is normal.
RED LED indicates temperature is high.
Step 1: Parts List
1x Arduino nano
1x LM 35 Temperature Sensor
2x 220 Ohms resistor
1x Red LED (Your wish)
1x Green LED (Your wish)
1x Breadboard or stripboard, as you prefer
1x USB Cable
and connecting wires.
Step 2: Circuit Diagram.
This is very simple circuit.
Step 3: Code
/*
* Arduino Button Game *
* Developed by Mohammed Adil
* B.Tech 3rd sem
* Student at Lovely Professional University
*
*/
int val;
void setup()
{
pinMode(2,OUTPUT);//For LED 1
pinMode(3,OUTPUT);//For LED 2
}
void loop()
{
val=analogRead(A0);
float mv=(val/1024.0)*5;// 10 bit ADC from 0-1024 (2^10=1024)
float cel=mv*100;
//float f=(cel*9)/5 + 32;//For far
if(cel>29)//If temperature is greater than 29 degree C then RED LED will glow
{
digitalWrite(2,HIGH);
digitalWrite(3,LOW);
}
else //Else GREEN LED will glow.
{
digitalWrite(2,LOW);
digitalWrite(3,HIGH);
}
}