Beginner to Intermediate

Build a Motion Sensor Alarm

A motion sensor alarm detects movement within a protected area and activates an alarm, light or notification. Motion sensors are widely used in home security systems, automatic lighting, industrial automation and smart home applications. This project demonstrates how to build a reliable motion detection system using a Passive Infrared (PIR) sensor and an Arduino or ESP32 microcontroller.

Motion Sensor Alarm

Project Overview

The PIR sensor continuously monitors infrared radiation emitted by people and animals.

When movement is detected, the sensor output changes state. The microcontroller receives this signal and activates a buzzer, siren, relay or notification system.

Additional features such as adjustable sensitivity, alarm delay and Wi-Fi alerts can easily be incorporated.

Project Difficulty

ItemValue
Difficulty⭐⭐ Beginner–Intermediate
Build Time2–4 Hours
Supply Voltage5 V DC
Detection Range3–7 metres (Typical)
Detection AngleApproximately 120°

Main Sections

Section Function
PIR Sensor Detects movement using infrared radiation.
Microcontroller Processes the sensor output.
Buzzer or Siren Provides an audible alarm.
Relay Module (Optional) Controls external devices.
Status LEDs Show system status.
Power Supply Powers the complete system.

Typical Components

QuantityComponent
1Arduino Nano or ESP32
1HC-SR501 PIR Motion Sensor
1Piezo Buzzer or 12 V Siren
1Relay Module (Optional)
2LEDs (Power and Alarm)
SeveralResistors and Connecting Wires
15 V Power Supply
1Project Enclosure

How the PIR Sensor Works

A PIR (Passive Infrared) sensor does not emit any energy. Instead, it detects changes in infrared radiation produced by warm objects such as people and animals.

When a person moves across the sensor's field of view, the infrared energy falling on the sensing elements changes. The PIR module processes this change and generates a digital output signal.

The microcontroller detects this output and activates the required alarm or automation function.

Typical PIR Specifications

Parameter Typical Value
Operating Voltage 5–20 V DC
Current Consumption Less than 100 µA (Sensor Element)
Detection Distance 3–7 m
Viewing Angle 110–120°
Output Digital HIGH/LOW
Delay Adjustment Typically 3–300 Seconds

Applications

  • Home security systems.
  • Intruder alarms.
  • Automatic lighting.
  • Smart home automation.
  • Office security.
  • Garage monitoring.
  • Warehouse surveillance.
  • Energy-saving lighting control.

Testing

  1. Verify the power supply voltage.
  2. Allow the PIR sensor to stabilise for about one minute after power-up.
  3. Walk slowly across the sensor's field of view.
  4. Verify the alarm activates.
  5. Adjust sensitivity if necessary.
  6. Adjust the delay timer.
  7. Test detection at different distances.
  8. Confirm reliable operation over several minutes.

Troubleshooting

Problem Possible Cause
No motion detected Incorrect wiring or insufficient warm-up time.
False alarms Heat sources, sunlight or incorrect sensitivity setting.
Alarm stays on Delay time set too long.
Short detection range Poor sensor positioning or obstructed field of view.
Unstable operation Unstable power supply or electrical interference.

Project Improvements

  • Send alerts via Wi-Fi using an ESP32.
  • Add SMS or email notifications.
  • Include a camera module for image capture.
  • Store detection events on a MicroSD card.
  • Add battery backup.
  • Support multiple PIR sensors.
  • Display activity logs on an OLED screen.
  • Integrate with Home Assistant using MQTT.

Skills Learned

  • PIR sensor operation.
  • Digital input programming.
  • Alarm system design.
  • Microcontroller programming.
  • Relay control.
  • Home automation.

Safety Notes

  • Install the sensor away from heaters, air conditioners and direct sunlight.
  • Use relay modules correctly when switching mains-powered equipment.
  • Provide adequate protection for outdoor installations.
  • Use stable power supplies for reliable operation.
  • Test the alarm regularly to ensure dependable performance.

Key Points

  • PIR sensors detect changes in infrared radiation caused by moving warm objects.
  • Motion sensor alarms are widely used in security and automation.
  • Adjustable sensitivity and delay improve system performance.
  • ESP32-based designs can send alerts over Wi-Fi.
  • A motion sensor project is an excellent introduction to security electronics and smart home technology.

Next Project

Continue by building a Smart Door Alarm System, combining magnetic door sensors, motion detection, a keypad and Wi-Fi notifications for complete home security.

Next Project → Smart Door Alarm System