← Back to Basic Projects

πŸšͺ IR Motion Door Alarm

A PIR sensor watches your door. The moment someone walks in, a loud buzzer triggers β€” your first home security system.

πŸ“‹ Overview

PIR (Passive Infrared) sensors detect changes in infrared radiation caused by warm bodies moving through their field of view. They output a simple HIGH/LOW digital signal β€” easy to wire and read.

What you'll learn: PIR sensor usage, digital input reading, buzzer alarm, and LED warning indicators.

Estimated time: 25–35 minutes. Difficulty: ⭐ Beginner-friendly.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino Uno R35V1
PIR Sensor (HC-SR501)5???20V, adjustable1Most common PIR sensor
Piezo BuzzerPassive 5V1
Red LED5mm1Alarm indicator
Resistor220 Ohm1For LED
Breadboard + WiresStandard1

πŸ—ΊοΈ Component Pin Mapping

IR Motion Door Alarm Component Pin Mapping Infographic

πŸ“– Step-by-Step Tutorial

1

Connect the PIR

PIR has 3 pins: VCC -> 5V, GND -> GND, OUT -> Arduino pin 2.
2

Add Buzzer and LED

Buzzer+ -> pin 8, LED (with 220 Ohm) -> pin 9, both negatives to GND.
3

Calibration Wait

The HC-SR501 needs 30???60 seconds to calibrate when first powered. Don't move during this time!
4

Test the Alarm

Walk past the sensor from 3???5m away. Buzzer and LED should trigger for a few seconds.
5

Adjust Sensitivity

The PIR has two potentiometers: one for sensitivity (range), one for delay (how long it stays triggered). Adjust with a screwdriver.
πŸ’‘
Mount the PIR at 2–2.5m height, angled slightly downward. This gives the widest detection zone and minimizes false triggers from pets on the floor.

πŸ’» Arduino Code

motion_alarm.ino
INO
// Motion Door Alarm β€” Volt X
const int PIR = 2;
const int BUZZER = 8;
const int LED = 9;

void setup() {
  pinMode(PIR, INPUT);
  pinMode(BUZZER, OUTPUT);
  pinMode(LED, OUTPUT);
  Serial.begin(9600);
  Serial.println("Calibrating PIR... wait 30s");
  delay(30000);
  Serial.println("Ready! Watching for motion...");
}

void loop() {
  if (digitalRead(PIR) == HIGH) {
    Serial.println("MOTION DETECTED!");
    digitalWrite(LED, HIGH);
    tone(BUZZER, 2000, 200);
    delay(300);
    tone(BUZZER, 1500, 200);
    delay(300);
    tone(BUZZER, 2000, 200);
    delay(300);

⭐Reviews & Ratings

β€”0 reviews
5β˜…
0
4β˜…
0
3β˜…
0
2β˜…
0
1β˜…
0
...

Loading reviews...

volt-X / IR Motion Door Alarm β€” Arduino Tutorial