edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
Sanyam Chugh
Published

Temperature Sensitive Burglary Alarm

A device that senses temperature in the area and tells the user if anyone enters the room and their distance from an object.

BeginnerShowcase (no instructions)1 hour627
Temperature Sensitive Burglary Alarm

Things used in this project

Hardware components

PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Buzzer
Buzzer
×1
LED (generic)
LED (generic)
×1
Temperature Sensor
Temperature Sensor
×1
Ultrasonic Sensor
×1

Story

Read more

Code

Temperature Sensative Alarm

Arduino
It can be used in the rooms having precious objects and a danger sense from any obstruction or temperature change
const int trigPin = 7;
const int echoPin =10;
long duration;
int distance;
int ledPin = 13;                
int inputPin = 2;              
int pirState = LOW;             
int val = 0;   
float temp;
int tempPin = 0;
float f;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);     
pinMode(inputPin, INPUT);     
Serial.begin(9600);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
Serial.begin(9600);
pinMode(12,OUTPUT);  
}
void loop(){
temp=analogRead(tempPin);
temp=temp*0.48828125;
f=temp*9/5+32;
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
digitalWrite(trigPin,LOW);
duration=pulseIn(echoPin,HIGH);
distance=duration*0.034/2;
val = digitalRead(inputPin);  
 if (val == HIGH) {            
 digitalWrite(ledPin, HIGH); 
 if (pirState == LOW) {
 Serial.println("Motion detected!");
 Serial.print("Temperature= β€œ);
Serial.print(temp);
Serial.print("*C and ");
Serial.print(f);
Serial.print("*f");
Serial.println();
delay(1000);
Serial.print("Someone is at a distace of ");
Serial.println(distance);
pirState = HIGH;
if((temp>=35)||(temp<=25))
{digitalWrite(ledPin, HIGH);
delayMicreoseconds(20);
Serial.print(β€œ Beware ! Temperature is exceeding the safe range”);}
else
{Serial.print(β€œHURRY UP”);
}}}
 else {
    digitalWrite(ledPin, LOW); 
    if (pirState == HIGH)
{Serial.println("Motion ended!");
  pirState = LOW;
    }}}

Credits

Sanyam Chugh
13 projects β€’ 2 followers

Comments