Motion Detecting Alarm Using Pir Sensor

by thecoolergamer in Workshop > Home Improvement

3851 Views, 27 Favorites, 0 Comments

Motion Detecting Alarm Using Pir Sensor

QDqJY5GyCpQZe1j3.jpg

We made a diy motion alarm for security at the door.

Motion Detecting Alarm

What is it?

It is an motion detecting alarm made using arduino uno, PIR (motion) sensor and a buzzer

Why is it used?

It is used to provide security in a shop or home, at the door.

How to Make It

parts pir.jpg

input- PIR sensor

processor- arduino uno

output- buzzer

requirements-

jumper wires (as required)

PIR sensor- 1

arduino uno- 1

breadboard- 1

power supply- 9V battery

buzzer- 1

Procedure

JHRErPeVwx4oQRk6.jpg
EJhqHatpNspxnmZF.jpg
Z1gBHZQbmMh3VVIN.jpg
connections.jpg
ZX6xvTldjtXVBfxF.jpg

steps-

  • 1. connect I/O pin 2 to the breadboard.
  • 2. connect 5V and Gnd to the breadboard.
  • 3. find Gnd, Vcc and Out pins on the PIR sensor.
  • 4. connect (-) pin to the Gnd on breadboard, (+) pin to the 5V and the Out pin to the digital pin 2.
  • 5. connect anode of the led to digital pin 13 and cathode to the Gnd.
  • 6. connect the red wire of the buzzer to digital pin 10 and the black wire to the Gnd.

Code for the Alarm

void setup(){

pinMode(2, INPUT);

pinMode(10, OUTPUT);

pinMode(13, OUTPUT);

}

void loop(){

if(digitalRead(2)==HIGH)

{

digitalWrite(13, HIGH);

digitalWrite(10, HIGH);

delay(100);

digitalWrite(13, LOW);

digitalWrite(10, LOW);

delay(100);

}

}