How to Build a Simple Arduino-Powered Motion Sensor Alarm On a Budget


Building a motion sensor alarm with an Arduino is a fun and educational project that can be completed on a budget. A motion sensor allows you to detect movement and trigger an alarm or other actions. With just a few inexpensive components, I can make a simple yet effective security system for my home or office.

In this article, I will walk through the full process of constructing a basic motion sensor alarm with an Arduino uno board. I will cover:

Follow along to learn how I built an Arduino motion sensor alarm on a budget!

Components Needed

To build my Arduino motion sensor alarm, I will need the following components:

Arduino Uno Board

The Arduino Uno is the microcontroller board that will run my program and control the alarm. The Uno is inexpensive but full-featured.

PIR Motion Sensor

A PIR (passive infrared) motion sensor is the key component that will detect movement and trigger the alarm. PIR sensors are widely available for around $10.


A breadboard provides a place to build and connect my circuit. A small solderless breadboard costs just a few dollars.

Jumper wires

Jumper wires are used to connect the Arduino, PIR sensor, and other components on the breadboard. A variety pack of male-to-male, male-to-female, and female-to-female jumpers runs less than $10.


A 220 ohm resistor is needed between the PIR sensor and Arduino's 5V power pin. Resistors are extremely cheap.

Buzzer or Speaker

An electronic buzzer or speaker will provide the audible alarm sound. Small active buzzers can be purchased for under $2. Speakers salvaged from old electronics also work.

Battery Pack

A 9V battery pack powers the Arduino and other components. Rechargeable 9V batteries or wall adapters can also be used.

Prototyping Supplies

Optional items like a prototyping shield, breadboard wires, or jumper caps can make connecting circuits easier. But these are not essential.

Assembling the Circuit

With my components gathered, it's time to assemble the motion sensor alarm circuit on my breadboard:

  1. Connect the red (power) and black (ground) rails on the sides of the breadboard to the Arduino's 5V and GND pins respectively. This provides power to the system.

  2. Insert the PIR motion sensor on the breadboard. Pay attention to the pin labels.

  3. Use jumper wires to connect the following pins:

    • PIR VCC pin to the red power rail
    • PIR GND pin to the black ground rail
    • PIR OUT pin to Arduino digital pin 2
  4. Add the 220 ohm resistor between the red power rail and the Arduino's 5V pin. This protects the Arduino from voltage spikes.

  5. Finally, connect the buzzer or speaker between Arduino pins 11 and 12.

That completes the motion sensor alarm circuit! It's ready to be programmed.

Programming the Arduino

With my circuit assembled, I can now program the Arduino to activate the alarm when the PIR sensor detects movement:

  1. Install the Arduino IDE on my computer if you don't already have it. This is the software used to program Arduino boards.

  2. Open the IDE, then go to Tools > Board and select Arduino Uno. Also select the right serial port under Tools > Port.

  3. Create a new sketch and save it as "MotionSensorAlarm".

  4. At the top of the sketch, include the line #include "Pitch.h" to access functions for playing tones.

  5. In the setup() function, initialize digital pin 2 as an input and pin 11 as an output.

  6. In the loop() function, read the state of the PIR sensor on pin 2. If motion is detected, activate the buzzer on pin 11 to sound the alarm.

  7. Finally, upload the sketch to the Arduino!

Now when the PIR sensor detects movement, the Arduino will signal the buzzer to sound, creating my DIY motion alarm. The full Arduino code for this project can be found in the references.

Setting Up the Motion Sensor

To get my new motion sensor alarm up and running, I just need to make a few adjustments:

With those simple setup steps complete, my DIY motion sensor alarm is ready detect intruders! The PIR sensor has a wide 120° field of view and can detect movement up to 5 meters away.

Tips for Using Your Motion Sensor Alarm

Here are some useful tips to get the most out of my homemade motion sensor alarm:

With a few dollars of parts and some basic Arduino skills, I've built my own motion sensor alarm for enhanced security. This simple project is also a great stepping stone to more advanced home automation systems.


In this project, I walked through constructing a budget-friendly motion sensor alarm using an Arduino Uno and PIR sensor. With just a few inexpensive components, I assembled the circuit, programmed motion detection logic, and set up the sensor for optimal performance. My new security system reliably detects intruders moving within its field of view. This DIY alarm provides peace of mind and valuable hands-on learning experience working with Arduino microcontrollers. With the skills I've gained, I can now build even more advanced projects.