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
- Arduino Uno board - The brain of our alarm system.
- PIR motion sensor - Detects movement and triggers the alarm. They are inexpensive and widely available.
- Buzzer - Sounds the alarm when motion is detected. A small active or passive buzzer will work.
- Breadboard - Used to easily connect the components.
- Jumper wires - For making connections.
- 9V battery - Power source for the Arduino.
- 9V battery clip - To connect the 9V battery to the Arduino.
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
- Connect the components on the breadboard as per the circuit diagram.
- Connect the Arduino to your computer using a USB cable.
- Open the Arduino IDE.
- 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
}
else
{
noTone(buzzer);
}
}
```
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!
- Power the Arduino with the 9V battery.
- When the PIR sensor detects motion, the buzzer will sound.
- Walk in front of the PIR sensor to trigger the alarm.
- 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:
- Add an LED that blinks when motion is detected.
- Connect it to WiFi to send you alerts on your phone.
- Add a camera to capture photos when the alarm triggers.
- Use a sound sensor to also detect loud noises.
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!