Burglar Alarm Using Arduino and PIR Sensor
Burglar Alarm Using Arduino and PIR Sensor
The circuit diagram to build a simple burglar alarm or an intruder alarm using arduino is given below.
You may assemble the circuit as shown in the diagram. Before getting into working of the alarm
circuit, I shall brief the components used in this project.
PIR Sensor – is the heart of this simple burglar alarm circuit using arduino. A PIR sensor – is basically a
motion sensor or a motion detector which identifies any object that moves inside its range of view. PIR sensor
identifies infra red radiations emitted by any object under its radar range.
Buzzer – is used to create a sound alarm when ever a movement is identified inside the range of PIR sensor. A
transistor 2N2222 is used to drive the buzzer. The maximum current that can be sourced or sinked from an
arduino pin is 20mA (the total current being 200mA from different pins). But the buzzer will need more than
just 20mA for its proper functioning. So how to give the necessary current required fir buzzer ? We use
switching transistor 2N222 for this purpose. It can act as a switch and at the same time it provides the required
current amplification. A 2N2222 transistor with a gain of 100 can give upto 1A current at its output. Another
purpose of using a transistor in between arduino pin and buzzer is isolation. A short circuit of the buzzer will
destroy only the collector – emitter junction of transistor. Since their is isolation at the base region of transistor
(base is connected to arduino), the destruction of collector-emitter junction will not affect base and hence our
arduino will be safe from getting burned! The 100 ohms resistor at base is used to limit base current of
transistor.
Switch – a push button switch is used to reset the burglar alarm once its activated. The capacitor is used for
bypassing bouncing effects of a switch ( debouncing capacitor).
Connections Explained
Arduino – Pin 7 – Output of PIR Sensor | Pin 6 – Push button switch | Pin 8 – Buzzer
Buzzer – + pin to Vcc (5 volts) | other pin to collector side of 2N2222
Transistor – 2N2222 – NPN – Collector to Buzzer | Emitter to Ground | Base to Arduino through 100 Ohm
Resistor
Switch – One end of switch to +5V | Other end to Ground through a 10K current limiting resistor
PIR Sensor – has got 3 pins – Vcc to +5 volts | GND to Ground | OUT pin to Arduino pin 7
Note:- Wire all grounds together at a common point.
void setup()
{
void loop()
}}
Advanced version of the Project – SMS Burglar Alarm using Arduino with GSM
Module
Since we have built a simple arduino anti theft alarm, why not build an advanced version of the same burglar
detector? What if we can build a burglar alarm that texts you an sms when an intruder is detected ? cool idea –
isn’t it? So lets get our hands at it – a burglar alarm that sends text message (sms) using arduino and pir sensor.
We are going to use a gsm module in addition to components and modules used in above circuit. You need to
have an idea of how to interface a gsm module and arduino together before you begin this project. Assemble
the circuit as shown in the gsm burglar alarm circuit.
Connections Explained!
Refer previous circuit diagram and its explanation first. The only addition module used is GSM Module.
GSM Module – Connect its Tx pin to Pin 9 of Arduino | Connect Rx to Pin 10 – Arduino | Vcc or Power Jack
to +12 Volt | Make GND or Ground pin common to all other components and modules
Objectives of the PIR Sensor Alarm using Arduino
Detect a motion – an intruder or a burglar using PIR sensor
Activate the buzzer alarm upon detection of burglar/intruder – Alarm should sound until Reset switch is
pressed
Send 3 SMS to a predefined mobile number set inside the program.
Stop the alarm when reset switch is pressed. Also reactivate the SMS alert facility upon reset.
The Program
#include<SoftwareSerial.h>
int sms_count=0;
void setup()
mySerial.begin(9600);
void loop()
void Check_Burglar()
}}
void Check_Reset()
}}
void SendTextMessage()
delay(1000);
delay(1000);
delay(200);
delay(1000);
sms_count++;