0% found this document useful (0 votes)
15 views5 pages

Experiment - 4

The document describes building a basic burglar alarm system using an Arduino, PIR sensor, buzzer, transistor, switch, and capacitor. It provides the circuit diagram, component connections, and Arduino code to detect motion with the PIR sensor and activate the buzzer, as well as code to deactivate the buzzer using the switch.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views5 pages

Experiment - 4

The document describes building a basic burglar alarm system using an Arduino, PIR sensor, buzzer, transistor, switch, and capacitor. It provides the circuit diagram, component connections, and Arduino code to detect motion with the PIR sensor and activate the buzzer, as well as code to deactivate the buzzer using the switch.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment– 4

Aim: Basic Burglar alarm security system with the help of PIR sensor and buzzer
using Arduino

Procedure

A PIR sensor is generally known to the world as motion sensor or motion detector.A
PIR sensor do not emit any kind of radiation for detection purposes but they just
measure the infra red radiation emitted by other objects inside its field or range of
measurement.
APIRsensormodulehasonly3pins–oneisVccwhichisa+5voltsinput,aground pin and finally
the digital output pin. Connect +5V from Arduino to Vcc of PIR sensor module, connect a
GND from Arduino to ground of PIR sensor and finally connect the
outputpin(markedas‘out’)toanydigitalpinofarduino.Inourcircuitdiagram,we
haveconnectedittopin7ofarduino.
PIRSensor– is the heart of this simple burglar alarm circuit using arduino. A PIRsensor–
isbasicallyamotionsensororamotiondetectorwhichidentifiesanyobject
thatmovesinsideitsrangeofview.PIRsensoridentifiesinfraredradiationsemitted
byanyobjectunderitsradarrange.

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 aswitch
and at the same time it provides the required current amplification.

A 2N2222 transistor with a gain of 100 can give up to 1A current at its output.
Another purpose of using a transistor in between arduino pin and buzzer isisolation.
A short circuit of the buzzer will destroy only the collector –emitter junction of
transistor. Since there 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–apushbuttonswitchisusedtoresettheburglaralarmonceitsactivated.
Thecapacitorisusedforbypassingbouncingeffectsofaswitch(debouncing capacitor).

BurglarAlarmusingArduino–CircuitDiagram
Connections

Arduino – Pin 7 – Output of PIR Sensor |Pin 6 – Push button switch |Pin 8 –
Buzzer

Buzzer–+pintoVcc(5volts)|otherpintocollectorsideof2N2222

Transistor–2N2222 –NPN –CollectortoBuzzer|Emitter toGround|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:-Wireallgroundstogetheratacommonpoint.

ArduinoCodeforBulgarAlarmusingPIRSensorandBuzzer

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
valuevoid setup()
{
pinMode(sensor,INPUT); // configuring pin 7 as Input
pinMode(push_switch,INPUT);//configuringpin6asInput
pinMode(buzzer,OUTPUT);//configuringpin8asOUTPUT
}
voidloop()
{
sensor_value=digitalRead(sensor); // Reading sensor value from pin
7if(sensor_value==HIGH)//CheckingifPIRsensorsendsaHIGHsignalto Arduino
{
digitalWrite(buzzer,HIGH);//Activatingthebuzzer
}
if(digitalRead(push_switch==HIGH))//Checkingifpushbuttonwaspressed
{
digitalWrite(buzzer,LOW);//turningOFFthebuzzer
}}
ArduinoCodeforPIRSensorInterfacing
intsensor=7; //Theoutputof PIRsensor connectedtopin7 int
sensor_value; //variable to hold read sensor value
voidsetup()
{
pinMode(sensor,INPUT); // configuring pin 7 as
InputSerial.begin(9600);//Toshowoutputvalueofsensorinserialmonitor
}

voidloop()
{
sensor_value=digitalRead(sensor); // Reading sensor value from pin
7Serial.println(sensor_value);//Printingoutputtoserialmonitor
}

Output:

whenthereisnomotioninsiderange

OutputofPIRSensorinArduinoSerialMonitor–whenthereismotion detected in
range
.

Result:Theaboveexperimentisdesignedandexecutedsuccessfully

You might also like