Having valuables at home can make me feel uneasy about potential burglars. A great way to get peace of mind is to build a simple motion detector that can alert me when it senses movement. In this article, I will show you how I built an Arduino-based motion detector to protect my valuables for less than $20.

What You Need

Building this motion detector requires just a few components that can be purchased online or at electronics stores for very affordable prices. Here is what you will need:

Arduino Uno Board

The Arduino Uno is a microcontroller board that serves as the brain of this motion detector. It processes input from the sensor and controls the alarm. An authentic Arduino Uno costs around $20 but you can find clones for under $10.

PIR Motion Sensor

This pyroelectric infrared sensor can detect motion up to 20 feet away. When it senses movement, it outputs a high signal that the Arduino can detect. These sensors cost around $2-5.


A simple buzzer that beeps when motion is detected. These small electronic components are less than $1.


To easily connect the components without soldering, a breadboard is needed. A small one costs around $5.

Jumper wires

Jumper wires allow connections between components on the breadboard. A pack of various lengths can be bought for around $5.

9V Battery

An Arduino can be powered by a 9V battery. Rechargeable are best for repeated use. Expect to pay $5-10.

Circuit Assembly

With all the components ready, it's time to assemble the motion detector circuit on the breadboard. Follow these steps carefully:

Step 1

Connect the power (+) and ground (-) pins on the Arduino Uno to the positive and negative rails on the breadboard. This provides power to the Arduino.

Step 2

Place the PIR motion sensor on the breadboard and use jumper wires to connect power and ground to the positive and negative rails.

Step 3

Connect the output pin on the PIR sensor to digital pin 2 on the Arduino. This sends motion detection data to the Arduino.

Step 4

Place the buzzer on the breadboard and connect power/ground to the rails. Connect the positive lead to Arduino pin 3.

Step 5

Place the 9V battery connector onto the breadboard and connect positive/negative to the rails.

The circuit should now be fully assembled and ready for testing!

Arduino Code

Now that the hardware is set up, I need to upload code to the Arduino so it knows how to interpret signals from the sensor and trigger the alarm:

const int pirPin = 2; //PIR Out pin connected to pin 2
const int buzzer = 3; //Buzzer pin connected to pin 3

void setup() {

pinMode(pirPin, INPUT);
pinMode(buzzer, OUTPUT);


void loop(){

if(digitalRead(pirPin) == HIGH){

digitalWrite(buzzer, HIGH); //Turn Buzzer ON



 digitalWrite(buzzer, LOW); //Turn Buzzer OFF



This simple code checks the PIR sensor pin constantly. If motion is detected, it activates the buzzer to sound the alarm.

Testing and Use

After uploading the code, open the Arduino IDE Serial Monitor. Then power up the Arduino board and wait 30 seconds for the PIR sensor to stabilize. When I walk in front of the motion sensor, the buzzer starts beeping loudly to alert me of the detected motion. It works perfectly!

To use this motion detector to protect valuables, I simply place it in a hallway or room facing the entry points. Whenever someone enters the monitored area, the alarm is triggered to alert me. This Arduino motion detector gives me great peace of mind about my valuables' safety for less than $20!

Let me know if you have any other questions about this project. I'll be happy to help you build your own motion detector.