Introduction
Motion detectors are useful devices that can alert you when something moves in a certain area. While commercial motion detectors can be expensive, you can actually build your own using common electronic components for a fraction of the cost.
In this guide, I'll walk you through step-by-step how to build a low cost motion detector from scratch using parts you can easily find online. I'll also share some tips and tricks nobody else knows to optimize the sensor and make it as sensitive as possible.
Gather the Required Electronic Components
The great thing about this project is that it only requires a few low cost parts. Here's what you'll need:
Passive Infrared Sensor
This is the key component that allows the motion detector to actually sense movement. It works by detecting infrared radiation emitted by warm bodies as they move within its field of view. You can find these for $2-5 on eBay or AliExpress. Just search for "PIR motion sensor".
Arduino Nano
The Arduino microcontroller acts as the brain of the motion detector. It processes the signal from the sensor and triggers the alarm. An Arduino Nano can be found for around $2-3 on eBay.
Breadboard
A breadboard allows you to easily connect components without soldering. Get a 400 point sreadboard for $5 or less.
Jumper wires
You'll need male-to-male jumper wires to connect the components on the breadboard. A pack of 120 jumper wires costs $3-5 on Amazon.
Buzzer
The buzzer produces the alarm sound when motion is detected. Any 5V or 12V piezo buzzer that plugs into a breadboard will work. Cost is $1-2 on eBay.
9V Battery Clip
This clips onto a 9V battery to provide power to the circuit. $1 on eBay.
9V Battery
A 9V alkaline battery will power the detector. $1-2 at local store.
Assemble the Motion Detector Circuit
With all the parts gathered, it's time to assemble the motion detector circuit on the breadboard. Follow these steps closely:
-
Insert the Arduino Nano into the breadboard. Make sure it straddles the center channel.
-
Connect the VCC and GND pins on the PIR sensor to power rails on the breadboard.
-
Connect the signal pin on the PIR sensor to pin 2 on the Arduino.
-
Connect the positive lead of the buzzer to a power rail. Connect the negative lead to pin 3 on the Arduino.
-
Clip the 9V battery to the battery clip, connect red lead to power rail, black lead to ground rail.
-
Double check all connections match the wiring diagram before powering on.
Here is a wiring diagram showing how everything connects together:
Program the Arduino Motion Detector Code
With the hardware assembled, now you need to program the Arduino to activate the buzzer when motion is detected.
-
Download the Arduino IDE software on your computer
-
Connect the Arduino to your computer via USB
-
Copy the following code into a new sketch:
```c++
const int pirPin = 2; //PIR connected to pin 2
const int buzzer = 3; //Buzzer connected to pin 3
void setup() {
pinMode(pirPin, INPUT); //Set PIR pin as input
pinMode(buzzer, OUTPUT); //Set buzzer pin as output
}
void loop(){
if(digitalRead(pirPin) == HIGH) { //If motion detected
digitalWrite(buzzer, HIGH); //Activate buzzer
}
else {
digitalWrite(buzzer, LOW); //Deactivate buzzer
}
}
```
-
Upload the sketch to the Arduino
-
Disconnect the Arduino from your computer
The motion detector will now activate the buzzer anytime movement is detected by the PIR sensor.
Tips to Optimize Sensitivity
To make your motion detector as sensitive as possible, follow these pro tips:
- Place the PIR sensor in a corner pointing outward for widest coverage
- Avoid pointing at windows or objects with temperature fluctuations
- Adjust PIR sensor mode switch for longer or shorter detection range
- Add a lens to focus the PIR sensor's field of view
- Experiment with different resistor values on the PIR sensor output
- Increase Arduino sensor reading delay to prevent false triggers
With some tweaking using these tips, you can fine tune the detector to pick up even small motions.
Conclusion
Building your own low cost motion detector is simple with the right components and code. The entire project can be completed for under $20! With a DIY motion sensor, you can monitor areas inside or outside your home and get alerted to any unexpected motion. Just follow along with this guide and you'll have your own fully functional motion detector that nobody else knows how to build!