Smart Security System


22 January 2022, Surya Pratap

Security has become a prime concern in recent years. As the technology is emerging every second, abundant microcontroller based security systems have been developing and implementing with many modern features to keep the place safe. This paper presents design and prototype implementation of a smart security system that makes place security more convenient, flexible, and less expensive. The system is based on microcontroller, which assists in ensuring residential security. This system includes a PIR sensor, a sim card, a microcontroller (ATmega328), a flame detection sensor (KY-026), a SIM800L GSM module, a flammable gas sensor (MQ-2) and a mobile consisting of SMS application which readily endow the users the ability to receive SMS from anywhere via the cellular network. This system also provides an alarm facility as well as led to ensure its working.


Modern complex home security systems include several security features like fire, intruders, electronic door lock, heat, smoke, temperature, etc. Some security systems may be a combination of all the security measures.


smart security system diagram

Such complex systems may be expensive and may not be affordable by everyone. There are individual security systems based on the requirement.


In this project, we designed a simple but very efficient home security that has a function of sending SMS to the homeowner on his/her mobile number in case of an intruder alert.


The project is based on Arduino, PIR motion detection sensor, Flame Sensor, Smoke Sensor and GSM Module.


Circuit Diagram

The circuit diagram of smart security system is shown in given below. Arduino UNO board consist of ATmega328P microcontroller. It is important component of Arduino board. In this other components are present like flammable gas sensor, flame sensor, PIR motion sensor, GSM module, breadboard, LEDs and buzzer.


cicuit diagram

Hardware Required

Wiring up the Components

This step in the build process is to make the necessary connections using long connecting wires as per the circuit diagram and securing these wires so that they don’t hang around. The MQ-2 gas sensor’s analog output (AO) pin is connected to analog pin A5. Anode terminal of GAS LED1, GAS LED2 and GAS Buzzer pins are connected to digital pin D7, D6, D8 respectively and VCC is connected to +5V and GND and cathode is connected to ground pin of Arduino board. All the wires from the components are connected to respective pins of Arduino. This finishes up the build process of the Smart Security System. In Arduino code has been uploaded.

OUT pin of PIR motion sensor is connected to digital pin D11. Anode terminal of PIR LED1, PIR LED2 and PIR Buzzer pins are connected to digital pin D3, D13, D12 respectively and VCC is connected to +5V and GND and cathode is connected to ground pin of Arduino board.

Analog output (AO) of KY-026 flame sensor pin is connected to analog pin A2. Anode terminal of FLAME LED1, FLAME LED2 and FLAME Buzzer pins are connected to digital pin D2, D5, D4 respectively and VCC is connected to +5V and GND and cathode is connected to ground pin of Arduino board.

Now we need to connect SIM800L GSM module to Arduino board so we have connected TXD and RXD pin to digital pins D9 and D10 respectively. VCC connected to +5V and VCC to ground of Arduino board. Hence, GSM module is used to send SMS on registered mobile number.


All the wires from the components are connected to respective pins of Arduino. This finishes up the build process of the Smart Security System. In Arduino code has been uploaded.

Methodology

SMART SECURITY SYSTEM is an IOT based project. Here we are using Arduino for code execution, for sensing we used flammable gas sensor (MQ-2), flame detection sensor (KY-026) and PIR motion sensor which will send respectively analog, digital and analog data to Arduino board and after that GSM module sends SMS on registered mobile number. It is a microcontroller based security system so it would be easy to install suitable place.

Our aim is also to make it cost effective so that many number of people can get the benefit from this. And it should be usable to anyone and helpful for them. To complete our product, we require some software as well as some hardware.


Component Description

Working of Smart Security System

Home Security Alarm Systems are very important in present day society, where crime is increasing. With the technological advancements we have achieved in the recent years, a homeowner doesn’t have to worry about home security while getting off his/her home.

Modern home security systems provide enough security from burglars, fire, smoke, etc. They also provide immediate notification to the homeowner.

The working of the project is explained below.

First we need to give power supply to the system using the 5V adapter and then insert sim card in the SIM800L module and wait until it get the network. To check network detect led of GSM module start blinking of the delay of 3 seconds. Now the smart security system is ready to work. If system detects any flammable gas it sends a SMS on our mobile phone containing text “Gas Leakage alert” and blue led is start glowing and buzzer also starts producing sound. And when the PIR motion sensor detects motion it send a SMS containing text “Motion Detected!” and green led is start glowing and buzzer also start producing sound. And when the flame sensor detects flame it send a SMS containing text “Fire Detected!” and the red led is start glowing and the buzzer also start producing sound.


Code

Checkout project code.

#include <SoftwareSerial>

SoftwareSerial mySerial(9, 10);

int pirled1 = 3;

int pirled2 = 13;

int pirsensor = 11;

int state = LOW;

int val = 0;

int pirbuzzer = 12;

int gasled1 = 7;

int gasled2 = 6;

int gasbuzzer = 8;

int gasA0 = A5;

int sensorThres = 350;

const int flameled1=2;

const int flameled2=5;

const int flamepin=A2;

const int flamebuzzer=4;

const int threshold=200;

int flamesensvalue=0;

void setup() {

Serial.println(" logging time completed!");

pinMode(pirled1, OUTPUT);

pinMode(pirled2, OUTPUT);

pinMode(pirsensor, INPUT);

pinMode(pirbuzzer, OUTPUT);

pinMode(gasled1, OUTPUT);

pinMode(gasled2, OUTPUT);

pinMode(gasbuzzer, OUTPUT);

pinMode(gasA0, INPUT);

pinMode(flamepin, INPUT);

pinMode(flameled1, OUTPUT);

pinMode(flameled2, OUTPUT);

pinMode(flamebuzzer, OUTPUT);

mySerial.begin(9600);

Serial.begin(9600);

delay(1000);

}

void loop(){

flamesensvalue=analogRead(flamepin);

if (flamesensvalue<=threshold) {

digitalWrite(flameled1,HIGH);

digitalWrite(flameled2,HIGH);

tone(flamebuzzer,300);

delay(100);

mySerial.println("OK");

delay(1000);

mySerial.println("ATH");

delay(1000);

mySerial.println("AT+CMGF=1");

delay(1000);

mySerial.println("AT+CMGS=\"+91XXXXXXXXXX\"\r"); //XXXXXXXX is target mobile number.

delay(1000);

mySerial.println("Fire Detected!");

delay(1000);

mySerial.println((char)26);

delay(1000);

}

else{

digitalWrite(flameled1,HIGH);

digitalWrite(flameled2,LOW);

noTone(flamebuzzer);

}


if ( digitalRead(pirsensor) == HIGH){

digitalWrite(pirbuzzer, HIGH);

digitalWrite(pirled1, HIGH);

digitalWrite(pirled2, HIGH);

mySerial.println("OK");

delay(1000);

mySerial.println("ATH");

delay(1000);

mySerial.println("AT+CMGF=1");

delay(1000);

mySerial.println("AT+CMGS=\"+91XXXXXXXXXX\"\r"); //XXXXXXXX is target mobile number.

delay(1000);

mySerial.println("Motion Detected!");

delay(1000);

mySerial.println((char)26);

delay(1000);

}

if ( digitalRead(pirsensor) == LOW)

{

digitalWrite(pirbuzzer, LOW);

digitalWrite(pirled1, HIGH);

digitalWrite(pirled2, LOW);

delay(1000);

}

int analogSensor = analogRead(gasA0);

Serial.print("Pin A0: ");

Serial.println(analogSensor);

if (analogSensor > sensorThres)

{

digitalWrite(gasled2, HIGH);

digitalWrite(gasled1, HIGH);

digitalWrite(gasbuzzer,HIGH);

mySerial.println("OK");

delay(1000);

mySerial.println("ATH");

delay(1000);

mySerial.println("AT+CMGF=1");

delay(1000);

>mySerial.println("AT+CMGS=\"+91XXXXXXXXXX\"\r"); //XXXXXXXX is target mobile number.

delay(1000);

mySerial.println("Gas Leakage alert");

delay(1000);

mySerial.println((char)26);

delay(1000);

}

else

{

digitalWrite(gasled2, LOW);

digitalWrite(gasled1, HIGH);

digitalWrite(gasbuzzer,LOW);

}

}


Note

Thanks!

Contact