How to Build a Low-Cost Motion Sensor Alarm with an Arduino and PIR Sensor
Introduction
Building a motion sensor alarm with an Arduino and a passive infrared (PIR) sensor is an easy and affordable way to add motion detection to your home security system. The components are readily available, and with just a bit of coding, you can have a fully functional motion alarm up and running in no time.
In this guide, I will walk through the entire process step-by-step, from gathering materials to uploading code, to help you build your own low-cost motion sensor alarm.
Gather the Required Components
To build the motion sensor alarm, you will need the following components:
-
Arduino Uno - The brain of the alarm that processes input from the sensor and controls the alarm. The Uno is inexpensive but powerful.
-
PIR motion sensor - Detects motion based on changes in infrared levels. We will connect it to the Arduino digital pin.
-
Buzzer - The alarm sounder that will activate when motion is detected. Connects to Arduino digital pin.
-
Jumper wires - For making connections between components.
-
Breadboard - To easily prototype and connect the circuit without soldering.
-
9V battery - Powers the Arduino.
-
9V battery clip - Connects battery to Arduino Vin pin.
Optionally, you can also add an LED, resistors, a switch, and a prototyping shield to expand the capabilities of the alarm.
Assemble the Circuit
Here are the steps to assemble the motion sensor alarm circuit:
-
Connect the PIR sensor to Arduino pin 2 and ground.
-
Connect the positive lead of the buzzer to Arduino pin 3. Connect negative lead to ground.
-
Connect the 9V battery to the Arduino using the battery clip, paying attention to polarity.
-
Optionally, connect an LED and resistor from pin 13 to ground to use the built-in LED.
-
Use a switch to connect from Arduino reset to ground to turn on/off.
-
If using a prototyping shield, simply plug into Arduino.
Refer to the circuit diagram and make sure all components are securely connected. Double check polarity when using the battery.
Load and Test the Code
With the hardware ready, it is time to load the Arduino sketch. This is the code that controls the alarm:
-
Download the motion sensor alarm code from this link.
-
Open the sketch in the Arduino IDE.
-
Verify and upload the code to the Arduino board.
-
Open the Serial Monitor at 115200 baud to see sensor readings.
-
Wave your hand in front of the PIR to trigger the alarm and LED. Adjust sensitivity as needed.
-
Once satisfied, disconnect USB and power Arduino via the 9V battery.
The PIR motion sensor alarm is now ready for installation and use!
Install and Use the Motion Sensor Alarm
To install your DIY motion sensor alarm:
-
Mount the PIR sensor and Arduino enclosure in the desired location with the sensor lens pointing outward.
-
Make sure the Arduino and wiring are hidden and secure.
-
Power on the battery switch to activate the alarm.
-
Use the serial monitor to view live motion detection data for testing.
-
When motion is detected, the buzzer will sound and LED will flash as an alarm.
-
Adjust PIR sensitivity and delay as needed to reduce false alarms.
-
Consider adding wireless connectivity to integrate with home automation systems.
With this simple Arduino motion sensor alarm, you can inexpensively monitor areas like driveways, sheds, and corridors for unexpected activity.
Conclusion
Building your own motion sensor alarm with Arduino provides a customizable and budget-friendly solution for enhanced home security. This guide covers how to assemble the circuit, install code, and configure the PIR sensor for optimal motion detection. With just a few components, you can now monitor your property and possessions for unexpected intruders. Be sure to check out the links below for more ideas on enhancing this project. The possibilities are endless when leveraging the versatility of Arduino!