How to Build a Motion Detection Alarm System with Arduino and PIR Sensor
Introduction:
A PIR Sensor-based Security Alarm is a simple and cost-effective way to protect your home or workspace from potential intruders. It is a DIY project that is popular among Arduino enthusiasts and hobbyists. In this blog, we will explain how to create a PIR Sensor-based Security Alarm using an Arduino, an LCD 16x2 display, and a buzzer.
Components:
The components required for this project are as follows:
- Arduino Uno
- BoardPIR SensorLCD 16x2 Display
- BuzzerJumper Wires
- Breadboard
- 10k Ohm Potentiometer
Working:
The PIR Sensor detects the motion of the intruder and sends a signal to the Arduino. The Arduino processes the signal and activates the buzzer and the LED light. It also displays a message on the LCD display indicating the intrusion.
The construction of this project involves connecting the PIR Sensor, buzzer, and LCD display to the Arduino board using jumper wires. The PIR sensor is connected to the Arduino's digital input pin, while the buzzer is connected to the digital output pin. The LCD display is connected to the Arduino's digital input and output pins.
Circuit Diagram :
Code:
// include the library code for LCD
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// initialize the PIR sensor input and the buzzer output pins
int pirSensor = 6;
int buzzer = 7;
void setup() {
// set the LCD display to 16x2 mode
lcd.begin(16, 2);
// set the PIR sensor input pin as input and the buzzer output pin as output
pinMode(pirSensor, INPUT);
pinMode(buzzer, OUTPUT);
// print a welcome message on the LCD display
lcd.print("PIR Sensor Alarm");
lcd.setCursor(0, 1);
lcd.print("System Ready");
}
void loop() {
// read the PIR sensor input
int pirState = digitalRead(pirSensor);
// if the PIR sensor is triggered, activate the buzzer and display a message on the LCD display
if (pirState == HIGH) {
digitalWrite(buzzer, HIGH);
lcd.clear();
lcd.print("Intrusion Alert!");
lcd.setCursor(0, 1);
lcd.print("Motion Detected");
delay(1000);
}
// if the PIR sensor is not triggered, turn off the buzzer and display a message on the LCD display
else {
digitalWrite(buzzer, LOW);
lcd.clear();
lcd.print("PIR Sensor Alarm");
lcd.setCursor(0, 1);
lcd.print("System Ready");
delay(1000);
}
}
Advantages:
The PIR Sensor-based Security Alarm is an effective way to protect your home or workspace from intruders. It is easy to build and requires only a few components. The project can be customized to suit your specific needs, and it can be programmed to perform different actions based on the type of intrusion detected.
Conclusion:
In conclusion, the PIR Sensor-based Security Alarm is a cost-effective way to secure your home or workspace. With the help of an Arduino, an LCD display, and a buzzer, you can create an effective security system that can detect intruders and alert you in real-time. This DIY project is an excellent way to learn more about electronics and programming.
Comments
Post a Comment