OBJECTIVES:
The goals of the motion alarm system are to detect heat movements in a specified area triggering a siren/buzzer to sound. This design promotes added control to the crime rate of the regulated work environment after hours of work operation.
COMPONENTS REQUIRED:
- Arduino Mega 2560 or UNO
- P.I.R Sensor Module
- SIM800 GSM module
- L.C.D(16 X 2)
- 9V/12V Battery
- 9V/12V Battery Clip
- Piezo Buzzer
- Breadboard
- Some Jumper Wires
- An USB Cable
- A Computer or Smartphone
CIRCUIT DIAGRAM:
CIRCUIT CONNECTION:
Step 1: Connecting the P.I.R sensor to Arduino:
1. Connect Vcc pin of P.I.R sensor to positive terminal of Arduino (5V).2. Connect Gnd pin of P.I.R sensor to any ground pin of Arduino.
3. Connect out pin of P.I.R sensor to Pin no. -7 of Arduino.
Step 2: Connecting L.E.D and Piezo Buzzer To Arduino
Connecting L.E.D
Connect Positive terminal (Longer Lead) Of L.E.D To Arduino Pin no. 8.
Connect Negative terminal (Shorter Lead) Of L.E.D To Any Ground Pin.
Connecting Piezo Buzzer
Connect Positive terminal (Red Wire) Of Buzzer to Arduino Pin no. 8.
Connect Negative terminal (Black Wire) Of Buzzer to Any Ground Pin.
Connect Positive terminal (Longer Lead) Of L.E.D To Arduino Pin no. 8.
Connect Negative terminal (Shorter Lead) Of L.E.D To Any Ground Pin.
Connecting Piezo Buzzer
Connect Positive terminal (Red Wire) Of Buzzer to Arduino Pin no. 8.
Connect Negative terminal (Black Wire) Of Buzzer to Any Ground Pin.
Step 3: Connecting L.C.D to Arduino:
LCD RS pin to digital pin 12
LCD Enable pin to digital pin 11
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2
Additionally, wire a 10K pot to +5V and GND, with its wiper (output) to LCD screens VO pin (pin3).
METHODOLOGY AND MOTIVATION OF PROJECT:
This system is a basic motion activated alarm. It is built around an Arduino Microcontroller. It is connected to a PIR motion sensor, a buzzer, a resistor, and a pair of external terminals. The whole system is battery powered so that it is easily portable. Once you have the code, you can connect all the external parts. The easiest way to do this is with a breadboard. This will let you make temporary connections to test everything out. The project involves the use of Arduino, motion sensor, buzzer, LCD display and a simple program. The sensor detect any motion in its permissible range and triggers the alarm. It will also send the signal to Arduino which processes the signal and set off the alarm along with detection message on display and also a SMS is sent to the user as soon as motion is detected. With this system we can easily set up a security alarm in our home for unwanted intruders.
PROGRAM:
#include <SoftwareSerial.h>#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
SoftwareSerial mySerial(9, 10);
int sensor=7; //The output of PIR sensor connected to pin 7
int push_switch=6; // push button switch connected to pin 6
int buzzer=8; // buzzer connected at pin 8
int sensor_value; //variable to hold read sensor value
int sms_count=0;
int ledPin=13;
void setup()
{ pinMode(sensor,INPUT); // configuring pin 7 as Input
pinMode(push_switch,INPUT); // configuring pin 6 as Input
pinMode(buzzer,OUTPUT); // configuring pin 8 as OUTPUT
mySerial.begin(9600);
lcd.begin(16,2);
delay(500);
lcd.setCursor(2, 0); // Set LCD cursor position (column, row)
lcd.print("Adv Security"); // Print text to LCD
lcd.setCursor(5, 1); // Set LCD cursor position (column,row)
lcd.print("System"); // Print text to LCD
delay(4000); // wait 4s // Delay to read text
lcd.clear(); // clear LCD display // Clear the display
lcd.setCursor(2, 0); // Set LCD cursor position (column, row)
lcd.print("Developed By"); // Print text to LCD
lcd.setCursor(2, 1); // Set LCD cursor position (column, row)
lcd.print("XXXX"); // Print text to LCD
delay(5000); // Delay to read text
lcd.clear(); // Clear LCD
lcd.setCursor(0, 0);
lcd.print("Processing Data.");
delay(3000);
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("Waiting For");
lcd.setCursor(3, 1);
lcd.print("Motion....");
}
void loop()
{
Check_Burglar();// subroutine to check sensor status and activation of outputs
Check_Reset(); // subroutine to check if alarm reset switch pressed or not
}
void Check_Burglar()
{
{
sensor_value=digitalRead(sensor); // Reading sensor value from pin 7
if(sensor_value==HIGH) // Checking if PIR sensor sends a HIGH signal to Arduino
{
digitalWrite(ledPin, HIGH); // turn LED ON
playTone(1000, 300);
delay(150);
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Motion Detected");
while(sms_count<1) //Number of SMS Alerts to be sent limited at 1
{
SendTextMessage(); // Function to send AT Commands to GSM module
}
sensor_value=HIGH;
}}
}
void Check_Reset()
{
if(digitalRead(push_switch==HIGH))// Checking if pushbutton was pressed
{
digitalWrite(buzzer,LOW); // turning OFF the buzzer
lcd.setCursor(3, 0);
lcd.print("Waiting For");
lcd.setCursor(3, 1);
lcd.print("Motion...."); // We only want to print on the output change, not state
sensor_value = LOW;
sms_count=0; // Reactivating the SMS Alert Facility
}}
void SendTextMessage()
{
mySerial.println("AT+CMGF=1"); //To send SMS in Text Mode
delay(1000);
mySerial.println("AT+CMGS=\"+91XXXXXXXXXX\"\r"); // change to the phone number you using
delay(1000);
mySerial.println("Someone just peeped into ur home. Take care of your belongings. Call 100. Be Alert");//the content of the message
delay(200);
mySerial.println((char)26);//the stopping character
delay(100);
lcd.clear();
sms_count++;
}
// duration in mSecs, frequency in hertz
void playTone(long duration, int freq)
{
duration *= 1000;
int period = (1.0 / freq) * 100000;
long elapsed_time = 0;
while (elapsed_time < duration)
{
digitalWrite(buzzer,HIGH);
delayMicroseconds(period / 2);
digitalWrite(buzzer, LOW);
delayMicroseconds(period / 2);
elapsed_time += (period);
}
}
NOTE:
XXXX ==> Type your name
+91XXXXXXXXXX ==> Give your phone number to which the SMS will be sent
ADVANTAGES:
- The given system is handy and portable, and thus can be easily carried from one place to another.
- The circuitry is not much complicated and thus can be easily troubleshoot.
- The given system sets off a powerful buzzer, and it is effective as any other alarm system available in the market.
- LCD can provide remote display of the detection of an intruder.
- The SMS facility makes the system more useful and practical..
- You can get information about any intruder wherever you are present in the country within seconds.
DISADVANTAGES:
- The given alarm system determines the presence of the intruder only, and does not determine how many persons are in there actually.
- The alarm activates only when the person cuts through the line of the PIR sensor.
- The SMS facility doesn’t work if the person is in an area where there is no network access.
APPLICATIONS:
This type of motion sensing alarm system can be easily employable for security purposes at banks, various offices and even for sensitive establishments such as for military. We can easily set up this system for household purposes. The inbuilt SMS system is very essential factor for security purposes and for concerned authorities.
FUTURE PROSPECTS:
- This project can be extended by using IR sensors, GPRS and 3G technologies.
- IR module helps in alerting if any door or window is open.
- Through GPRS, we can monitor the security area from anywhere in the world.
- 3G technologies helps in finding out the emergency times and fast responding to the situations.
CONCLUSION:
Thus, we have designed a home security alarm system using Arduino and PIR motion sensor, which is handy, portable, cost-effective and highly effective as well. Such alarm systems are hugely in demand for security purposes, and thus the given system can be proved useful and effective in view of the above features.TRY THIS AND COMMENT YOUR FEEDBACK