In today’s world, security has become a paramount concern for homeowners. With the rise in home automation technologies, protecting your home has never been easier or more innovative. Imagine having a security system so sophisticated that it uses lasers to detect intruders, yet so simple that you can build it yourself using an Arduino and a GSM module. Sounds like something out of a spy movie, right? Well, it’s not. In this guide, we’ll walk you through how to build a laser-powered anti-burglar system that leverages the power of Arduino and GSM technology to keep your home safe. Whether you’re a seasoned DIY enthusiast or a beginner looking to dabble in home automation, this project is perfect for you. Let’s dive in!
At its core, a laser-powered anti-burglar system is a security setup that uses laser beams to create an invisible fence around your home. The idea is simple: laser lights travel in a straight line, and when this line is interrupted—say, by a person or object—the system detects the break and triggers an alarm. The beauty of this system lies in its simplicity and effectiveness.
It is upgraded up a notched when a motion sensor module, PIR sensors are added to detect human proximity at hours when there supposed to be no one around the vicinity. By integrating it with an Arduino board and a GSM module, we took this project to the next level by enabling remote monitoring and control through the use of calls and SMS commands to activate and deactivate it.
Read Bimodal Biometric-based Surveillance System
Before we get into the nitty-gritty of building the system, let’s talk about the components we used for the project design:
The concept is straightforward. The laser torches are positioned to shine directly onto LDRs, creating an invisible barrier around the perimeter of your model home. As long as the laser light is uninterrupted, the LDRs will register a high level of brightness, and the Arduino will record this as a safe state. However, if someone or something blocks any of the laser beams, the LDRs will detect a drop in brightness, signaling the Arduino that the system has been tripped.
Also, if the burglar was able to maneuver the tripwire and didn’t interrupt any of the laser torch on each sides, the PIR motion sensor would be trigger of such motion when this happens. This is where the GSM module comes into play. Once the system detects a breach, the Arduino sends a signal to the GSM module, which then sends an SMS alert to the designated phone numbers, informing them of the intrusion. Also an alarm goes off that deters the burglary act further. Additionally, the system can be armed or disarmed remotely via SMS or phone call, making it incredibly versatile and user-friendly.
Now that you understand the basic concept, let’s break down the steps to build this laser-powered anti-burglar system.
The schematic diagram is shown above, you can view the bread board version below.
We began by setting up our Arduino Uno standalone board. We connected the SIM800L GSM module to the Arduino standalone board using the software serial communication. The GSM module will be responsible for sending and receiving both call and SMS commands. We made sure to insert a SIM card into the module and connect it to the Arduino using jumper wires.
Read also The Women’s Suffrage Movement.
This setup allows the Arduino to communicate with the GSM module, enabling remote control capabilities.
Next, we positioned the laser torches and LDRs around our model home. The lasers should be set up so that their beams shine directly onto the LDRs. Each LDR will need to be connected to the Arduino to monitor the light intensity on the Light dependent resistors (LDRs).
This configuration ensures that the LDRs are correctly positioned to detect any interruption in the laser beams.
One of the unique features of this system is its ability to work both during the day and at night. To achieve this, we needed to calibrate the LDRs for different light conditions. During the day, ambient light might affect the LDR readings, so we used an additional LDR to monitor the overall light level.
This ensures that the system remains effective regardless of the time of day.
Image on WordPress Post Not Showing on Frontend – Image Error Solved
The heart of this project is the Arduino code, which ties all the components together. The code will:
#include <SoftwareSerial.h>
#include <EEPROM.h>
// Configure software serial port
SoftwareSerial mySerial(11, 12);
String CellNumtemp, textMessage;
String CellNum;
String admin1 = "+2347062174135";
boolean Armed = EEPROM.read(0);
char checkStatus; //
int pirPin1 = 5;
int pirPin2 = 6;
int ldrRoofPin = A5;
int ldrFrontPin = A1;
int ldrleftPin = A2;
int ldrRightPin = A3;
int ldrBackPin = A0;
// Output Pins
int laserActivePin = A4;
int AlarmPin = 7;
int ldrTopSense, ldrBackSense, ldrLeftSense, ldrRightSense, ldrFrontSense;
int pirRead, pir2Read;
// Variables will change:
int ledState = LOW;
unsigned long previousMillis = 0; // will store last time LED was updated
// constants won't change:
const long interval = 1000;
boolean night, day;
String number = "+2348114180467"; //-> change with your number
String showMessage;
char mode = 'r';
String message1 = "Command Received. System Armed";
String message2 = "Command Received. System Disarmed";
String message3 = "Command Received, System is ";
String message4 = "Alert!!, Alert!!! System is Breached! ";
String message5 = "Alert!!, Alert!!! System Motion is triggered! ";
String message6 = "I am sorry but you don't have admin power hence you can't make such commands. Thank you. ";
String systemStatus = "";
String nullMessage = "is UNSUCCESSFUL";
void setup() {
//tell MCU ur outputs
pinMode(laserActivePin, OUTPUT);
pinMode(AlarmPin, OUTPUT);
//tell MCU ur inputs
pinMode(pirPin1, INPUT);
pinMode(pirPin2, INPUT);
//off Alarm
digitalWrite(AlarmPin, LOW);
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Serial begin ok");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("AT");
delay(10);
disarmSensors();
}
int readLdrSensors() {
ldrTopSense = analogRead(ldrRoofPin);
ldrLeftSense = analogRead(ldrleftPin);
ldrRightSense = analogRead(ldrRightPin);
ldrFrontSense = analogRead(ldrFrontPin);
ldrBackSense = analogRead(ldrBackPin);
return ldrLeftSense, ldrRightSense, ldrFrontSense, ldrTopSense, ldrBackSense;
}
bool nightAndDay() {
readLdrSensors();
if (ldrTopSense <= 500) {
day = true;
night = false;
} else if (ldrTopSense >= 500) {
day = false;
night = true;
}
return night, day;
}
bool checkMotion() {
for (int i = 0; i < 25; i++) {
int pirRead = digitalRead(pirPin1);
//Serial.println(pirRead);
if (pirRead == 1) {
return true;
} else {
return false;
}
}
delay(500);
}
bool checkMotion2() {
for (int i = 0; i < 25; i++) {
int pir2Read = digitalRead(pirPin2);
//Serial.println(pirRead);
if (pir2Read == 1) {
return true;
} else {
return false;
}
}
delay(500);
}
int armSensors() {
Serial.println("\nArmed");
Armed = 1;
EEPROM.update(0, Armed);
return Armed;
}
int disarmSensors() {
Serial.println("\nSensors Disarmed");
analogWrite(laserActivePin, 0);
digitalWrite(AlarmPin, LOW);
Serial.println("LASER OFF");
Armed = 0;
EEPROM.update(0, Armed);
return Armed;
}
char burglarDetect() {
armSensors();
readLdrSensors();
nightAndDay();
if ((night == true) && (day == false)) {
analogWrite(laserActivePin, 255);
digitalWrite(AlarmPin, LOW);
Serial.println("LASER ON");
if ((checkMotion2() == true) || (checkMotion() == true) || (ldrBackSense <= 500) || (ldrFrontSense <= 500) || (ldrLeftSense <= 500) || (ldrRightSense <= 500)) {
digitalWrite(AlarmPin, HIGH);
checkStatus = 'd';
Serial.println("Sensors triggered at night!");
}
}
else if ((night == false) && (day == true)) {
analogWrite(laserActivePin, 0);
digitalWrite(AlarmPin, LOW);
Serial.println("LASER OFF");
digitalWrite(AlarmPin, LOW);
if ((checkMotion2() == true) || (checkMotion() == true)) {
digitalWrite(AlarmPin, HIGH);
checkStatus = 'e';
Serial.println("Motion Sensors triggered!");
}
}
else {
Serial.println("Quite as the grave");
}
Serial.print("pir 1: ");
Serial.print(checkMotion());
Serial.print(" Pir 2: ");
Serial.println(checkMotion2()); //
Serial.println("Night: " + String(night) + " Day " + String(day));
Serial.println("Top: " + String(ldrTopSense) + " left: " + String(ldrLeftSense) + " Right: " + String(ldrRightSense) + " Back: " + String(ldrBackSense));
delay(500);
return checkStatus;
}
void loop() {
//burglarDetect();
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
if (ledState == LOW) {
ledState = HIGH;
checkIncomingSMS();
}
else {
ledState = LOW;
SendMessage();
}
}
}
// check if there are incoming SMS
String checkIncomingSMS() {
// AT command to set mySerial to SMS mode
mySerial.print("AT+CMGF=1\r");
delay(100);
// Read the first SMS saved in the sim
mySerial.print("AT+CMGR=1\r");
delay(10);
// Set module to send SMS data to serial out upon receipt
mySerial.print("AT+CNMI=2,2,0,0,0\r");
delay(100);
if (mySerial.available() > 0) {
textMessage = mySerial.readString();
//save the phone number of the senders in a string (country code)
CellNumtemp = textMessage.substring(textMessage.indexOf("+234"));
CellNum = CellNumtemp.substring(0, 14);
Serial.print(" phone ");
Serial.print(CellNum);
Serial.print(" ");
Serial.println(textMessage);
delay(10);
if(CellNum == admin1){
if (textMessage.indexOf("Arm") >= 0) {
burglarDetect();
checkStatus = 'a';
}
if (textMessage.indexOf("Disarm") >= 0) {
disarmSensors();
checkStatus = 'b';
}
if (textMessage.indexOf("Status") >= 0) {
checkStatus = 'c';
}
}
else if(CellNum != admin1){
if ((textMessage.indexOf("Status") >= 0) || (textMessage.indexOf("Disarm") >= 0) || (textMessage.indexOf("Arm") >= 0)){
checkStatus = 'f';
}
}
}
CellNumtemp = "";
textMessage = "";
mySerial.print("AT+CMGD=1\r");
mySerial.print("AT+CMGD=2\r");
return CellNum;
}
void dummy() {
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(200);
mySerial.println("AT+CMGS=\"" + CellNum + "\"\r"); //Mobile phone number to send message
delay(200);
}
void SendMessage() {
Serial.print("Got phone: ");
Serial.println(CellNum);
Serial.println(" Arm State: " + String(Armed));
if (Armed == 1) {
systemStatus = "ACTIVE";
burglarDetect();
}
else if (Armed == 0) {
systemStatus = "OFF";
}
switch (checkStatus) {
case 'a':
dummy();
mySerial.println("Hello," + message1);
break;
case 'b':
dummy();
mySerial.println("Hello," + message2);
break;
case 'c':
dummy();
mySerial.println("Hello," + message3 + systemStatus);
break;
case 'd':
dummy();
mySerial.println("Alert!," + message4);
break;
case 'e':
dummy();
mySerial.println("Alert!," + message5);
break;
case 'f':
mySerial.println("Hello," + message6);
break;
}
updateSerial();
delay(100);
mySerial.println((char)26); // ASCII code of CTRL+Z
delay(200);
checkStatus = 'z';
}
void updateSerial() {
delay(5);
while (Serial.available()) {
mySerial.write(Serial.read()); //Forward what Serial received to Software Serial Port
}
while (mySerial.available()) {
Serial.write(mySerial.read()); //Forward what Software Serial received to Serial Port
}
}
Read also Flirt Like a Pro: Mastering the Art of Body Language
This Arduino code is designed for a laser-powered anti-burglar system that utilizes various sensors, such as PIR (Passive Infrared) sensors and LDRs (Light Dependent Resistors), to detect motion and light levels. The system includes GSM functionality for remote control and alerts via SMS. The code starts by configuring the necessary pins for inputs and outputs, initializes serial communication, and reads stored settings from EEPROM to determine whether the system is armed or disarmed upon startup.
In the setup function, the system initializes the serial ports, sets pin modes for the sensors and outputs, and disarms the sensors by default. The loop function periodically checks for incoming SMS messages and determines whether to arm, disarm, or check the status of the system based on commands sent via SMS. The code includes functions to handle the reading of light and motion sensors, enabling the system to differentiate between day and night, and activate or deactivate the laser and alarm accordingly.
When the system is armed, the burglarDetect
function continuously monitors the sensors. If it detects motion or a significant change in light levels, it triggers the alarm and sends an alert message. The system’s response varies based on whether it is day or night, using different sensors to determine if a breach has occurred. SMS commands are processed in the checkIncomingSMS
function, which verifies the sender’s number and executes the corresponding action, either arming, disarming, or reporting the system’s status.
Finally, the SendMessage function sends SMS responses based on the current status of the system and any detected breaches. The code includes safeguards to prevent unauthorized users from controlling the system, ensuring that only predefined admin numbers can arm or disarm the system. The use of EEPROM ensures that the system remembers its armed state even after a power cycle. Overall, the code provides a robust framework for a remote-controlled, sensor-based security system.
Before we finalized our setup, we began to test the system to ensure everything works as expected. We simulated an intrusion by interrupting one of the laser beams and observe whether the LDRs detect the change and trigger the alarm. Also, by triggering the motion sensors too placed at the various blind spot positions. This evidently worked as we programmed it as shown in the YouTube video above. We equally tested the SMS functionality by arming and disarming the system remotely.
See also 5 Weird Facts About the World’s Smallest Organism: Tardigrades
To get the code for both the SMS and Call commands, you can send us a message here on WhatsApp. We will be delighted to forward it to you. Alternatively, you can head over to the GitHub repo to download a free version of it. However, talk with us can enhance your chances of using the project and perhaps getting some of your questions answered.
Once the basic setup is working, you can fine-tune the system. Adjust the threshold values for the LDRs to optimize performance, and ensure the laser beams are accurately aligned with the sensors. You might also consider adding additional features, such as a siren or integration with other home automation systems.
There are several reasons why a laser-powered anti-burglar system is an excellent choice for home security:
While the system is effective, there are a few challenges you might encounter:
Once you’ve mastered the basic setup, you can explore expanding the system with additional features:
Building a laser-powered anti-burglar system with Arduino and GSM control is not just a fun and educational project—it’s a practical solution for home security. By following the steps outlined in this guide, you can create a robust security system that’s both cost-effective and easy to manage. Whether you’re looking to secure your home, a model house, or just want to experiment with Arduino projects, this system offers a versatile and scalable solution. So, why wait? Start building your own laser-powered security system today!
1. Can I use this system in a real house, or is it just for models? Yes, while this project is designed for a model house, you can scale it up for real-world use by using more powerful lasers and placing the LDRs strategically around your property.
2. What happens if someone tampers with the system? If someone tries to tamper with the system by cutting the power or blocking the lasers, the Arduino can be programmed to send an immediate alert via SMS, allowing you to take action.
3. How reliable is the SMS communication? The reliability of SMS communication depends on the GSM module and the network signal strength in your area. Ensure that your SIM card has sufficient balance and that the GSM module is in a location with good signal reception.
4. Can I add more laser beams to cover a larger area? Absolutely! You can add more laser torches and LDRs to cover additional entry points or a larger perimeter. Just make sure to adjust the Arduino code to accommodate the extra sensors.
5. How do I power the system? The system can be powered using a standard 9V battery or an external power supply. If you’re adding more components, consider using a more robust power source to ensure stability.
In the ever-evolving landscape of modern agriculture, artificial intelligence (AI) is emerging as a game-changing…
The Internet of Things (IoT) is reshaping the way we live, work, and produce goods.…
Introduction Have you ever wondered how some manufacturing industries consistently deliver high-quality products while minimizing…
In the ever-evolving landscape of modern agriculture, the integration of Internet of Things (IoT) technology…
Introduction Have you ever imagined diagnosing equipment issues without even being on-site? Welcome to the…
In the ever-evolving world of manufacturing, staying competitive means adopting innovative solutions to optimize every…
This website uses cookies.