How to Build Your Own Low-Cost Motion Sensor Alarm with Arduino in 10 Minutes
Introduction
Building a motion sensor alarm with Arduino is an easy and inexpensive way to add security to your home or office. With just a few components, you can create a fully-functional alarm system that will detect movement and sound an alarm. In this guide, I will walk you through the entire process of assembling and coding a motion sensor alarm with Arduino in just 10 minutes.
Components Needed
To build the motion sensor alarm, you will need the following components:
-
Arduino Uno - The microcontroller board that will control the system.
-
HC-SR501 PIR motion sensor - Detects motion and sends a signal to the Arduino.
-
Buzzer - Sounds an audible alarm when motion is detected.
-
Jumper wires - For connecting the components.
-
Breadboard - To easily prototype the circuit connections.
-
9V battery - Power source for the Arduino.
-
USB cable - For uploading code onto the Arduino.
Assembling the Circuit
Follow these steps to assemble the motion sensing alarm circuit:
-
Connect the VCC pin of the PIR sensor to the 5V pin on the Arduino.
-
Connect the GND pin of the PIR sensor to the GND pin on the Arduino.
-
Connect the OUT pin of the PIR sensor to digital pin 2 on the Arduino.
-
Connect the positive terminal of the buzzer to digital pin 3 on the Arduino.
-
Connect the negative terminal of the buzzer to the GND pin on the Arduino.
-
Insert the 9V battery into the Arduino to power it.
Coding the Arduino
With the circuit assembled, it's time to program the Arduino to activate the alarm when motion is detected:
-
Open the Arduino IDE software on your computer.
-
Import the Arduino tone library - This allows the buzzer to sound.
-
Set pin 2 as the input pin from the PIR sensor.
-
Set pin 3 as the output pin for the buzzer.
-
Write code to detect a HIGH signal from the PIR sensor and activate the buzzer.
-
Set the buzzer to sound in 1 second intervals to create an alarm tone.
-
Upload the code to the Arduino Uno board.
Testing and Using the Alarm
After coding, follow these steps to test and use your DIY motion sensing alarm:
-
Place the sensor and Arduino in the area you want to protect.
-
Verify the buzzer sounds when you walk in front of the PIR sensor.
-
Adjust the sensitivity and delay as needed to avoid false alarms.
-
When not in use, disconnect the battery to turn off the alarm.
-
For best performance, mount the sensor and Arduino in an enclosure.
And that's it! In 10 minutes you can assemble a motion sensing alarm with Arduino. This simple project is the perfect introduction to Arduino and building security systems. With some additional sensors and code, you can expand this into a fully-featured home alarm system. The possibilities are endless!