Intermediate
3 hours
PIR Motion-Activated Burglar Alarm with Arduino
PIR (Passive Infrared) sensors detect infrared radiation emitted by warm bodies — humans and animals. When motion is detected, they output a HIGH signal that you can read with any microcontroller. This alarm adds a 10-second arming delay, a 30-second alarm siren, an LED status indicator, and a key-switch style arm/disarm button.
What You’ll Need
- Arduino Uno or Nano
- HC-SR501 PIR sensor module
- Active piezo buzzer (5 V)
- Green LED (status) + red LED (alarm) + two 220 Ω resistors
- Push button for arm/disarm + 10 kΩ pull-down resistor
- 9 V power supply or battery
- Project box for mounting
Step-by-Step Instructions
- Set up the PIR: Connect PIR VCC to 5 V, GND to GND, OUT to Arduino pin 2. The HC-SR501 has two onboard potentiometers: one for sensitivity (range), one for hold time — set both to minimum for testing.
- Wire outputs: Green LED (armed status) through 220 Ω to pin 4. Red LED (alarm) through 220 Ω to pin 5. Buzzer positive to pin 6, negative to GND.
- Wire the button: Button between pin 7 and 5 V, 10 kΩ from pin 7 to GND.
- State machine logic: Implement four states: DISARMED (green LED off), ARMING (green LED blinks for 10 s), ARMED (green LED steady), ALARM (red LED + buzzer for 30 s). Button transitions DISARMED → ARMING → ARMED; alarm auto-resets after 30 s back to ARMED.
- PIR warm-up: PIR needs 30–60 seconds to stabilise after power-on — add a startup delay and flash the green LED during this period.
- Test and calibrate: Adjust sensitivity potentiometer until the detection range suits your room. Adjust hold-time pot so each trigger lasts 3–5 seconds.
Safety Notes
- This is a demonstration project, not a substitute for a certified security system.
- Piezo buzzers at close range are uncomfortably loud — keep volume in mind when testing indoors.
Tips & Troubleshooting
- False triggers often come from sunlight shifting, air conditioning vents, or pets — reposition the sensor to avoid these.
- Add a GSM module (SIM800L) to send an SMS when the alarm triggers for a real remote-notification system.
- Store arm/disarm events in EEPROM to create an event log.