techvaler
Published © GPL3+

Burglar Alarm using PIR sensor

The Lights go ON, the buzzer starts to beep, the intensity is HIGH. You might have just caught a thief trying to break-in...

BeginnerProtip16,675
Burglar Alarm using PIR sensor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Buzzer
Buzzer
×1
LED (generic)
LED (generic)
×1
Resistor 220 ohm
Resistor 220 ohm
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
Optional
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB-A to B Cable
USB-A to B Cable
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

PIR, Buzzer, LED and Arduino

Code

PIR_sensor_code.ino

C/C++
/* 
 * Credits to all sources on Google and Youtube, acting as reference to this code below. This code is not 
 * TechValer's own creation. TechValer has referred to different projects and websites to 
 * find an easy code for beginners to get started with PIR sensor and Arduino.
 * TechValer does not claim this code to be its own. TechValer is greatly thankful for original 
 * creaters of this code and also all others who acted as reference. 
 */

/* 
 *  About TechValer
 *  
 *  What comes to mind when you think of tech...hmm, were sure youre thinking of iPhone, 
 *  Alexa, Boston Dynamics robotic dog etc., at least thats what we would have thought of. 
 *  Our point here is, when you look inside this tech...youll find weird boards with 
 *  components attached to it. This stuff is electronics and we at Techvaler deeply appreciate 
 *  this piece of tech. As the name suggests, we are Tech Enthusiasts who know the Worth and 
 *  Potential of these amazing tech stuff! So, check out our website techvaler.com and 
 *  Youtube Channel: Techcafe to find out more.
 */

/*
 * Thanks to Drona Automations Pvt.Ltd for Sponsoring this project!
 */

int Buzz= 8; // Define Bizzer pin
int LED= 13; // Define LED pin
int PIR= 3; // Define PIR pin
int val= 0; // Initializing the value as zero at the beginning
  
void setup() {
  
pinMode(Buzz, OUTPUT);
pinMode(LED, OUTPUT);
pinMode(PIR, INPUT);
Serial.begin(9600);
}

void loop() {

val = digitalRead(PIR); // The value read from PIR pin 3 will be assigned to 'val'
if(val == HIGH){
  digitalWrite(LED, HIGH); // Turn LED ON
  digitalWrite(Buzz, HIGH); // Turn Buzzer ON
  Serial.println("Movement Detected"); // Print this text in Serial Monitor
}
else 
{
  digitalWrite(LED, LOW);
  digitalWrite(Buzz, LOW);
  Serial.println("Movement not Detected");
}
}

Credits

techvaler

techvaler

0 projects • 1 follower

Comments