Sanyam
Published

Temperature Sensitive Burglary Alarm

It is a device that will detect if there is any movement or temperature change in the room.

BeginnerShowcase (no instructions)1 hour488
Temperature Sensitive Burglary Alarm

Things used in this project

Hardware components

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

Story

Read more

Code

Alarm

Arduino
It is a temperature sensative alarm ,that rings when this device observes any motion . Once is detects a motion ,it calcualates the distance of anything nearest to it ,lights the LED ,Blows the buzzer
  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("Some is at a distace of ");
Serial.println(distance);
      pirState = HIGH;
    }
  } else {
    digitalWrite(ledPin, LOW); 
    if (pirState == HIGH){

      Serial.println("Motion ended!");
   
      pirState = LOW;
    }

  }
}

Credits

Sanyam
1 project • 1 follower

Comments