← Back to Basic Projects
Basic · Project #10

🚪 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Ω1For LED
Breadboard + WiresStandard1

📖 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Ω) → 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
// 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);
    digitalWrite(LED, LOW);
    noTone(BUZZER);
    delay(1000);
  }
}

Reviews & Ratings

0 reviews
5★
0
4★
0
3★
0
2★
0
1★
0
💬

No reviews yet. Be the first to share your experience!