TecnoMate logo
PIR Motion Sensor Alarm: Build a Simple Security System
Back to Guides
SecurityPIRArduinoAlarm

PIR Motion Sensor Alarm: Build a Simple Security System

Jan 2, 2026
6 min read

PIR Motion Sensor Alarm: DIY Home Security

A PIR (Passive Infrared) Sensor detects changes in infrared radiation, which occurs when a warm body (like a human) moves in its field of view. It's the same technology used in commercial motion-activated lights and alarms.

How PIR Sensors Work

The sensor contains a pyroelectric crystal that generates voltage when heated or cooled. A Fresnel lens in front focuses IR energy onto the sensor. When a person walks by, the sudden change in IR triggers an output signal.

Components

  • Arduino Uno
  • HC-SR501 PIR Sensor Module
  • Buzzer
  • LED
  • (Optional) GSM Module for SMS alerts

Wiring

| PIR Pin | Arduino Pin | | :--- | :--- | | VCC | 5V | | GND | GND | | OUT | D2 |

Code

```cpp int pirPin = 2; int buzzerPin = 8;

void setup() { pinMode(pirPin, INPUT); pinMode(buzzerPin, OUTPUT); delay(30000); // Allow PIR to calibrate (30 seconds) }

void loop() { if (digitalRead(pirPin) == HIGH) { digitalWrite(buzzerPin, HIGH); delay(5000); // Alarm for 5 seconds digitalWrite(buzzerPin, LOW); } } ```

Adjustments

The HC-SR501 has two potentiometers:

  • Sensitivity: How far it can detect motion.
  • Time Delay: How long the output stays HIGH after detection.

Our Kit

Get started with the PIR Motion Sensor Alarm Using Arduino kit!


Ready to start building?

Explore our collection of DIY kits and components. All project components mentioned in this guide are available in our store.

Browse All Projects