Arduino

How to Make Burglar Alarm Using Arduino Uno

To detect any unwanted movement in an area or to keep out thieves from entering that area, we need a sensor that can trigger an alarm. For this we will be requiring a sensor that can detect the motion of any body and trigger the alarm as soon as it detects the motion. In short, to make a burglar detection system we need a motion detection sensor and a buzzer and using Arduino Uno we can make a burglar detection system.

How to make burglar alarm system with Arduino Uno

To create a burglar alarm system, we have to be needing the following list of components

  • Arduino uno 
  • Breadboard
  • Connecting wires
  • 1 RGB LED
  • 1 PIR sensor

To detect any unwanted movement in any area we have designed a circuit whose schematic is given in the figure below:

Hardware assembly for creating a burglar alarm with Arduino Uno and PIR sensor

The schematic of the circuit given above is implemented on the hardware and to further understand the connections of the circuit we have given the image below which explains the hardware assembly.

We connected the output of the PIR sensor to the Arduino by connecting the brown wire to pin 6 whereas the buzzer is connected with Arduino using the gray wire that connects it with pin 3 of Arduino.

Despite using the buzzer for indication we have also used the RGB LED for indication. So, when there is no movement, the green LED will remain on but as soon as some movement is detected the red LED will turn on and buzzer will also be turned on respectively.

Arduino code for burglar alarm using PIR sensor with Arduino Uno

The code compiled for creating the burglar detection system using the PIR sensor with Arduino uno is given below:

int redPin = 5;/* assigning the Arduino pin for red LED*/int greenPin = 4;/* assigning the Arduino pin for green LED*/

int sensorPin = 6; /* assigning the Arduino pin for motion detection sensor*/

int buzzPin = 3; /* assigning the Arduino pin for buzzer */

int val = 0; /*assigning the variables for string the output of the sensor */

 

void setup() {

  /* assigning  pin mode for the LEDs and sensor */

  pinMode(redPin, OUTPUT);

  pinMode(greenPin, OUTPUT);

  pinMode(sensorPin, INPUT);

  pinMode(buzzPin, OUTPUT);

 

  Serial.begin(9600);

  digitalWrite(greenPin,HIGH); /* giving the LED a HIGH state */

}

void loop(){

  val = digitalRead(sensorPin);  /* reading the output of the motion sensor*/

 

  if (val == HIGH) /* if the value is HIGH then */

  {

    digitalWrite(redPin, HIGH);  /* turn on the RED led */

    digitalWrite(greenPin,LOW);/* turn off the green led */

    digitalWrite(buzzPin,HIGH);/* turn on the buzzer alarm */

  }

    if (val == LOW)/* if the output of the sensor is low then */

    {

      digitalWrite(redPin, LOW); /* turn the red led off */

      digitalWrite(greenPin,HIGH);/* turn on  the green led*/

      digitalWrite(buzzPin,LOW);/* turn off the buzzer*/

    }

}

To summarize the working of the Arduino code we can say that when the PIR sensor detects any heat signature in the surrounding  its output will become HIGH. When the output of the sensor gets HIGH the buzzer will sound the alarm and red LED will also turn on and vice versa. To control the buzzer alarm with respect to the output of the sensor we have used the if conditions by reading the output of the sensor using the digitalRead() function.

Hardware implementation for burglar alarm using PIR sensor with Arduino Uno

We have implemented the hardware for the circuit according to the hardware assembly described above and as it can be seen from the image given below:

For demonstration purposes we have used a toy car as the moving object and the system will also work when a human crosses within the detection range of the sensor.

In the place of the buzzer a quality alarm bell can be used with a relay.

Conclusion

The sensors used for detecting the movement of the objects in an area are the PIR sensors that pick up the movement from the infrared radiation emitted in the form of heat from a moving object. This type of sensor can be used in a number of applications like automatic opening of doors, automatic lights and security alarms. To demonstrate how we can detect any unwanted movement in an area we have created a burglar alarm system using the PIR sensor with Arduino.

About the author

Aaliyan Javaid

I am an electrical engineer and a technical blogger. My keen interest in embedded systems has led me to write and share my knowledge about them.