YouTube player

In this simple project, we’ll build a motion-sensing arduino 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 Arduino 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.

Project Steps

Gather your parts.

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.

Wire the Arduino to the breadboard.

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.

Connect your motion sensor.

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.

Plug in the LED.

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.

Connect the piezo buzzer.

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.

Program the Arduino.

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:

(Arduino programs are called sketches.)

Upload the sketch to the Arduino.

Test your 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.