← All Projects

PIR Motion Alarm System

189 viewsMarch 3, 2026
ArduinoPIRSecurityBuzzerLEDBeginner

A simple but effective motion-activated alarm using a PIR sensor, buzzer, and LED. Detects human movement within a 7m range and triggers an audible and visual alert. Perfect for doorway monitoring or room intrusion detection.

Components & Supplies

×1Arduino Uno R3
×1HC-SR501 PIR Motion Sensor
×1Active Buzzer
×1Red LED (5mm)

Circuit Connections

ComponentPinPinComponent
ArduinoD2OUTPIR
Arduino5VVCCPIR
ArduinoGNDGNDPIR
ArduinoD7+Buzzer
ArduinoD13AnodeLED

How It Works

The PIR (Passive Infrared) sensor detects changes in infrared radiation caused by human body heat. When motion is detected, the sensor output goes HIGH and the Arduino activates both a buzzer alarm and a warning LED.

The sensor has adjustable sensitivity and delay potentiometers. Set the delay to minimum for instant response or maximum for a longer trigger hold time.

arduinoMotion Alarm Sketch
const int pirPin = 2;
const int buzzerPin = 7;
const int ledPin = 13;
bool armed = false;

void setup() {
  Serial.begin(9600);
  pinMode(pirPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  Serial.println("PIR Alarm - Calibrating (30s)...");
  delay(30000);
  armed = true;
  Serial.println("System ARMED");
}

void loop() {
  if (!armed) return;

  if (digitalRead(pirPin) == HIGH) {
    Serial.println("MOTION DETECTED!");
    for (int i = 0; i < 10; i++) {
      digitalWrite(ledPin, HIGH);
      digitalWrite(buzzerPin, HIGH);
      delay(150);
      digitalWrite(ledPin, LOW);
      digitalWrite(buzzerPin, LOW);
      delay(100);
    }
    delay(3000);
  }
  delay(100);
}