Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

Make: Projects

PIR Sensor Arduino Alarm

Build a motion-sensing alarm with a PIR sensor and an Arduino microcontroller.

PIR Sensor Arduino Alarm

In this simple project, we’ll build a motion-sensing alarm using a PIR (passive infrared) sensor and an Arduino microcontroller. This is a great way to learn the basics of using digital input (from the sensor) and output (in this case, to a noisy buzzer) on your Arduino.

This alarm is handy for booby traps and practical jokes, and it’s just what you’ll need to detect a zombie invasion! Plus, it’s all built on a breadboard, so no soldering required!

Download the project code here.

Steps

Step #1: Gather your parts.

PrevNext
PIR Sensor Arduino Alarm

This project requires just a few parts, and because you\'re using a solderless breadboard and pre-cut jumper wires, you won\'t need any tools at all — except your computer and USB cable to connect the Arduino.

Step #2: Wire the Arduino to the breadboard.

PrevNext
PIR Sensor Arduino Alarm
  • Connect digital input/output (I/O) pin 2 on the Arduino to row 1 on the breadboard.
  • Connect the 5V pin on the Arduino to row 2 on the breadboard, and connect a nearby ground (Gnd) pin to row 3.

Step #3: Connect your motion sensor.

PrevNext
PIR Sensor Arduino AlarmPIR Sensor Arduino AlarmPIR Sensor Arduino AlarmPIR Sensor Arduino Alarm
  • Find the Gnd (–), Vcc (+), and Out pins on the PIR sensor.
  • Plug the PIR sensor into the breadboard so that its (–) pin connects to the Gnd row, its (+) pin connects to 5V, and its Out pin connects to digital pin 2.
  • NOTE: If you have a different sensor than the one shown here, you may need to extend the sensor's pins with a stacking female header, wires, interconnect cables, etc. to fit.

Step #4: Plug in the LED.

PrevNext
PIR Sensor Arduino AlarmPIR Sensor Arduino AlarmPIR Sensor Arduino Alarm
  • Plug the LED's anode (the longer leg) into digital pin 13 on the Arduino.
  • Plug the LED's cathode (the shorter leg, and/or the leg on the flattened side of the LED base) into the adjacent ground (Gnd) pin on the Arduino.

Step #5: Connect the piezo buzzer.

PrevNext
PIR Sensor Arduino AlarmPIR Sensor Arduino AlarmPIR Sensor Arduino Alarm
  • Connect the buzzer's red wire to the Arduino's digital pin 10.
  • Connect the buzzer's black wire to the Arduino's Gnd pin (there's a spare one on the Power block of pins).
  • NOTE: These two wires can be reversed, as the polarity of the buzzer doesn't matter.

Step #6: Program the Arduino.

PrevNext
PIR Sensor Arduino AlarmPIR Sensor Arduino AlarmPIR Sensor Arduino Alarm
  • Launch the Arduino IDE software. You can download it for free here.
  • Plug the USB cable into your computer and Arduino.
  • Set the board and port settings for your Arduino board, in this case, an Arduino Uno.
  • Open the PIR Alarm sketch found at this link: https://raw.github.com/jedgarpark/Make_PIR_Sensor/master/MAKE_PIR_Sensor.pde (Arduino programs are called sketches.)
  • Upload the sketch to the Arduino.

Step #7: Test your alarm.

PrevNext
PIR Sensor Arduino AlarmPIR Sensor Arduino AlarmPIR Sensor Arduino Alarm
  • When you power up your alarm, the PIR sensor will glow an ominous red. Stand very still or leave the room while the alarm calibrates the infrared level reading for the room.
  • Now test it by moving: the buzzer will buzz and the LED will light up.
  • Be amazed! Your PIR Sensor Arduino Alarm can sense movement up to 20 feet away. No one will be stealing your yo-yo today.
  • NOTE: Might not be reliable for detecting the undead.

John Edgar Park

John Edgar Park likes to make things and tell people about it. He works in CG animation at DisneyToon Studios and writes for Make, Boing Boing, and other places online and in print. You can find him at jpixl.net and twitter @johnedgarpark -- if you like that sort of thing.


blog comments powered by Disqus

Featured Products from the MakerShed

Follow

Get every new post delivered to your Inbox.

Join 25,786 other followers