Burglar Alarm System

Burglar Alarm System


In this blog I am going to deliver the way I constructed my own burglar alarm system, simply using an Arduino.


How it works?

In this system, alarm sounds and alert bulb blinks if someone enters through the main door.

 What are the essential things?

1         Arduino UNO    

2         Arduino IDE (Software)

3         USB Cable Type A/B (2.0)

4         Resistor (220 Ω) x 1

5         Ultra-Sonic sensor (HC-SR04)  x 1

6         Active piezo buzzer x 1

7         LED x 1

8         Jumper wires(Male to Male)  x 7

9         Bread board


How to do?

First, use the Arduino UNO and  draw a circuit virtually in tinker cad and set all connections. Then, code it correctly and simulate it successfully.

 Following is the picture which I drew virtually:

'image.png' failed to upload. TransportError: There was an error during the transport or processing of this request. Error code = 103, Path = /_/BloggerUi/data/batchexecute


Let’s go through the steps mentioned below to briefly understand the connections:

1. Let’s see how to set up an ultra-sonic sensor on Arduino.


             I            First, connect the Vcc to the 5V pin on Arduino.

           II           Connect the Trig (trigger) pin to digital pin 2 on Arduino.

         III        Then, connect the Echo pin to digital pin 4 on Arduino.

        IV         Finally, the Gnd (ground) pin to the Gnd pin on Arduino.


2.  Following are the steps to connect the piezo buzzer and the LED.


Active piezo buzzer

 I         Connect the Signal(S) to digital pin 8 on Arduino.

II         Next, connect the negative (-) to ground (GND) pin on Arduino.

III    Next, connect one side of resistor with        the negative (-) of piezo buzzer and other side of 220 ohm resistor with the LED's negative (-) as shown in the picture.

IV  Then, connect the positive pin of LED to the digital pin 7 on Arduino board.



3. How to the write the code?



 Here, declare the variables before the void setup loop and in the pinMode method, Declare which pins are the outputs and inputs. The ultra-sonic sensor echo pin which is always is the input and trig (trigger) pin is the output. Buzzer and LED are outputs.






Below is the code for the ultra-sonic sensor:


This code can calculate the distance of the object which is in front of the ultra-sonic sensor. Distance will be calculated in centimeters (cm).





Next, write the code for the buzzer alert and LED. If anyone comes through the main door, the LED’s will blink with the alert sound.


















 Finally, upload  the code to Arduino board using USB Cable Type A/B (2.0).

after coding, uploaded the device to check whether it works properly.


Comments