How to Create a PIR Sensor-Based Motion Alarm Using Arduino
Here's a step-by-step guide to creating a PIR sensor-based motion alarm using Arduino.
Description:
In this project, we will build a motion alarm using a PIR (Passive Infrared) sensor and an Arduino. This simple alarm system can detect motion and trigger an alarm, making it ideal for basic security applications. Follow these steps to create your own motion alarm.
Materials Needed:
- Arduino Uno
- PIR Sensor (HC-SR501)
- Piezo Buzzer
- Breadboard
- Jumper Wires
- Resistor (220 ohms)
- LED (optional for visual indication)
Step 1: Gather Your Components
Ensure you have all the necessary components listed above. The PIR sensor will detect motion, and the buzzer will serve as the alarm.
Step 2: Connect the PIR Sensor to Arduino
1. Power and Ground:
- 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.
2. Signal Pin:
- Connect the OUT pin of the PIR sensor to digital pin 2 on the Arduino.
Step 3: Connect the Buzzer
1. Positive Pin:
- Connect the positive pin of the buzzer to digital pin 8 on the Arduino.
2. Negative Pin:
- Connect the negative pin of the buzzer to the GND pin on the Arduino.
Step 4: Optional LED Indicator
1. Anode (Longer Leg):
- Connect the anode of the LED to digital pin 13 on the Arduino through a 220-ohm resistor.
2. Cathode (Shorter Leg):
- Connect the cathode of the LED to the GND pin on the Arduino.
Step 5: Upload the Code
1. Connect your Arduino to your computer using a USB cable.
2. Open the Arduino IDE and paste the code above into a new sketch.
3. Select the correct board and port from the Tools menu.
4. Upload the code to your Arduino by clicking the upload button.
Step 6: Test Your Motion Alarm
1. Once the code is uploaded, position the PIR sensor to monitor the area where you want to detect motion.
2. When motion is detected, the buzzer should sound, and the LED should light up (if connected).
3. If no motion is detected, the buzzer and LED should remain off.
Project Gallery
Video Tutorial :
Conclusion :
You've successfully built a motion alarm using a PIR sensor and Arduino! This project is a great introduction to working with sensors and can be expanded for more advanced security applications. Explore more projects on our website and visit Skill-Hub by EmbeddedBrew to further develop your skills in embedded systems.