DIY Room Temperature Detector
by prayag nao in Circuits > Arduino
4224 Views, 81 Favorites, 0 Comments
DIY Room Temperature Detector
Now you can build your own room temperature monitor using an Arduino board. The circuit is a combination of an Arduino UNO board, LM35 temperature sensor, and 7 segment display. It will display the temperature on the 7 segment in degree C. It can be powered from any standard Arduino AC mains adaptor (9VDC), or from a suitable battery. First of all note that this circuit can not measure the temperature of the whole city or province.It can only measure the temperature of the surroundings!
Things You Will Need
you will need arduino starter kit
you can buy kit from here
Discount coupon code:GBDADD
following things will required from the kit:
arduino uno.
7 segment .
LM35(temperature) sensor.
A buzzer
RGB LED module.
connecting wires.
A battery.
A registor.
A bread board
A laptop or pc having arduino IDE installed.
etc.
Now make the circuit according to given picture above.
connect 2nd pin to 9th pin to seven segment display.
arduino pin 7segment pin
2nd => e
3rd => d
4th => c
5th => dp
6th => b
7th => a
8th => f
9th => g
now coonect A0 pin arduino to 2nd pin of LM35.
now connect RGB led and buzzer to arduino uno pin no.0,1,13 and 12.
Programming.....
Just copy and paste following code into Arduino IDE and burn the code into Arduino UNO///
inti=0;
intval;
int temp=0;
void setup()
{
Serial.begin(9600);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(1,OUTPUT);
pinMode(0,OUTPUT);
digitalWrite(0,LOW);
digitalWrite(12,LOW);
digitalWrite(1,LOW);
digitalWrite(13,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
}
void loop()
{
val = analogRead(A0);
float mv = ( val/1024.0)*5000;
intcel = mv/10;
if(cel<=30)
{
digitalWrite(0,HIGH);
digitalWrite(1,LOW);
digitalWrite(12,LOW);
delay(10);
digitalWrite(0,LOW);
digitalWrite(1,LOW);
digitalWrite(12,LOW);
digitalWrite(13,LOW);
//Serial.println("lower 30");
}
if(cel>30 &&cel<40)
{
digitalWrite(0,LOW);
digitalWrite(1,HIGH);
digitalWrite(12,LOW);
delay(10);
digitalWrite(0,LOW);
digitalWrite(1,LOW);
digitalWrite(12,LOW);
digitalWrite(13,LOW);
//Serial.println("Higher 30");
}
if(cel>=40)
{
digitalWrite(13,HIGH);
digitalWrite(0,LOW);
digitalWrite(1,LOW);
digitalWrite(12,HIGH);
delay(10);
digitalWrite(0,LOW);
digitalWrite(1,LOW);
digitalWrite(12,LOW);
digitalWrite(13,LOW);
//Serial.println("Higher 40");
}
else{
digitalWrite(0,LOW);
digitalWrite(1,LOW);
digitalWrite(12,LOW);
}
temp=cel/10;
digitalWrite(11,HIGH);
SevenSegament(temp);
digitalWrite(11,LOW);
i=cel%10;
digitalWrite(10,HIGH);
SevenSegament(i);
digitalWrite(10,LOW);
}
voidSevenSegament(int j)
{
if(j==0){
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,HIGH);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
}
if(j==1){
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
}
if(j==2){
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,HIGH);
digitalWrite(9,LOW);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
}
if(j==3)
{digitalWrite(2,HIGH);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,HIGH);
digitalWrite(9,LOW);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
}
if(j==4){
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);}
if(j==5){
digitalWrite(2,HIGH);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);}
if(j==6){
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
}
if(j==7){
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);}
if(j==8)
{
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);}
if(j==9){
digitalWrite(2,HIGH);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
}
}
Power...
Now just give power from electric cell pack which is provided in kit.you will see temperature reading on seven-segment.
That's it.Enjoy.