How to Build a Low Cost Motion Sensor Alarm with Arduino in 10 Minutes

How to Build a Low Cost Motion Sensor Alarm with Arduino in 10 Minutes

Building a motion sensor alarm with Arduino is an easy and fun electronics project that can be completed in just 10 minutes. With a few simple components, you can create your own security system to detect movement and sound an alarm. Here is a step-by-step guide on how to build a low cost motion sensor alarm with Arduino.

What You Will Need

Circuit Diagram

Here is the circuit diagram for connecting the components:

The PIR motion sensor has three pins - VCC, GND, and OUT. The VCC and GND pins are connected to the 5V and GND pins on the Arduino. The OUT pin is connected to pin 2 on the Arduino.

The positive terminal of the buzzer connects to pin 3 on the Arduino and the negative terminal to GND.

Setting Up the Arduino

  1. Connect the components on the breadboard as per the circuit diagram.
  2. Connect the Arduino to your computer using a USB cable.
  3. Open the Arduino IDE.
  4. Copy the following code and upload it to the Arduino:

int pirPin = 2; //PIR output pin
int buzzer = 3; //Buzzer pin

void setup() {

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


void loop() {

if(digitalRead(pirPin) == HIGH) {

tone(buzzer, 1000); // Send 1KHz sound signal

delay(500);        // Delay 500 ms

noTone(buzzer);     // Stop sound



This code initializes the PIR sensor and buzzer pins, reads the sensor input, and triggers the buzzer when motion is detected.

Testing the Alarm

Now you can test your motion sensor alarm!

  1. Power the Arduino with the 9V battery.
  2. When the PIR sensor detects motion, the buzzer will sound.
  3. Walk in front of the PIR sensor to trigger the alarm.
  4. The buzzer will sound for 500ms whenever motion is detected.

And that's it! You now have your own DIY motion sensor alarm with Arduino that can detect intruders.

Improving the Alarm Further

Here are some ways you can enhance this project:

The possibilities are endless! With just a few extra components, you can create a fully-featured home security system with Arduino.

Building this motion sensor alarm is a great entry point into Arduino-based electronics projects. With the knowledge you gain, you can build more complex sensors, alarms, robots and IoT devices. So go ahead and enhance this project or come up with ideas of your own!