How to Make an Arduino Motion Sensor Alarm on the Cheap
Making an Arduino based motion sensor alarm is an easy and inexpensive way to add security to your home or office. With just a few common components, you can build your own DIY security system to detect intruders and sound an alarm.
What You Will Need
Here is a list of components you will need to make your own Arduino motion sensor alarm:
-
Arduino board - The brains of the alarm. An Arduino Uno or compatible board works great.
-
PIR motion sensor - This sensor detects movement and triggers the Arduino to sound the alarm. They are inexpensive and easy to connect.
-
Buzzer - This will create the audible alarm sound when motion is detected. Any small buzzer will work.
-
Jumper wires - To connect the components to the Arduino board.
-
Breadboard - Makes connecting circuits easy without soldering.
-
9V battery - To power the Arduino and other components.
-
9V battery clip - Connects the 9V battery to the power rails on the breadboard.
How a PIR Motion Sensor Works
A PIR (passive infrared) motion sensor detects movement by sensing changes in infrared radiation levels. When a warm body like a human or animal passes in front of the sensor, the infrared radiation levels change rapidly, triggering the sensor.
PIR sensors are inexpensive, easy to use, low power, and do not emit any radiation themselves, making them ideal for DIY motion sensing projects. They have a range of up to 20 feet, adjustable sensitivity, and a wide field of view.
Connecting the Motion Sensor to the Arduino
Follow these steps to connect your PIR motion sensor to the Arduino board:
-
Plug the Arduino into your computer using a USB cable. This provides power to the Arduino.
-
Place the PIR sensor on a breadboard.
-
Connect the GND pin on the PIR sensor to a GND pin on the Arduino using a jumper wire.
-
Connect the VCC pin on the PIR sensor to the 5V pin on the Arduino. This provides power to the sensor.
-
Connect the OUT pin on the PIR to any digital I/O pin on the Arduino. This sends motion detection signals to the Arduino. I used pin 7.
-
Upload the motion detection sketch (code) to your Arduino board. More on this in the next step.
Uploading the Arduino Sketch
The Arduino sketch is the program code that tells the Arduino what to do. For this motion alarm project, the sketch needs to detect signals from the PIR sensor and trigger the buzzer alarm when motion is detected.
Here are the key elements of the motion detection sketch:
- Initialize the PIR sensor pin and buzzer pin
- In the loop, continuously check the PIR sensor for motion
- If motion detected, trigger buzzer alarm
- Add short delay before checking sensor again
There are many sample sketches available online for Arduino motion alarms you can start with. Upload the sketch and open the serial monitor to see it in action.
Adding a Buzzer Alarm
An audible buzzer alarm makes your motion detection system much more effective as an alert and deterrent.
To add a buzzer alarm:
- Connect a buzzer module to any digital pin on the Arduino.
- Update the sketch to activate this pin when motion is detected.
- Set the buzzer to sound for 1-2 seconds when triggered.
Now your Arduino alarm will make a loud sound when the PIR sensor detects movement!
Powering the Motion Sensor Alarm
Once your motion detection circuit is complete on the breadboard, you need a portable power source. The easiest option is to power the Arduino alarm with a 9V battery.
To hook up a 9V battery:
- Connect a 9V battery clip adapter to the power rails on the breadboard.
- Clip on a 9V battery to the battery clip.
- The Arduino will now draw power from the battery instead of USB.
Using a battery lets you install your DIY security system anywhere without being tethered to a power outlet.
Installing and Testing the Sensor
When you are ready to deploy your Arduino motion alarm:
- Mount the PIR sensor and Arduino enclosure in the location you want to monitor.
- Make sure the PIR sensor has a clear field of view to detect intruders.
- Adjust the sensor orientation or sensitivity as needed.
- Test that motion is reliably detected at the ranges you expect.
Try walking in front of the sensor at various distances and angles to ensure it works as expected. Adjustments can be made to the sensor positioning, sensitivity and sketch as needed.
Some additional calibration may be required if you have any false alarms. But after that it will serve as a sensitive tripwire for motion!
Conclusion
Building your own Arduino motion detector alarm is an inexpensive DIY security project using common components. The key elements are an Arduino board, PIR motion sensor, buzzer, battery, and sensor sketch. With some basic wiring and coding, you can set up an effective tripwire alarm system to detect intruders. This is a great beginner-friendly project to learn Arduino and useful for real world security applications.