PIR Motion Sensor

HC-SR501 PIR motion sensor module illustration

What is an HC-SR501 PIR Sensor?

A PIR motion sensor detects movement from people, animals, and warm objects by watching changes in infrared radiation. The HC-SR501 module is popular in Arduino security alarms, automatic lights, room-occupancy projects, and low-power wake-up circuits.

Unlike distance sensors, a PIR sensor does not measure range precisely. It reports motion inside a detection cone, usually around 3 to 7 meters depending on the lens, sensitivity setting, temperature contrast, and mounting position.

Key Features

๐Ÿšถ

Human Motion Detection

Detects moving warm bodies for alarms, automatic lighting, door triggers, and occupancy sensing.

โš™๏ธ

Adjustable Sensitivity

Onboard potentiometers set detection distance and output hold time without code changes.

๐Ÿ”‹

Low Current Module

Suitable for battery-assisted projects because the sensor output can wake a sleeping microcontroller.

๐Ÿ“

Wide Fresnel Lens

The dome lens splits the field of view into zones so movement produces a clear changing signal.

๐Ÿ”Œ

Simple Digital Output

Connects to one digital input pin and returns HIGH when motion is detected.

๐Ÿ 

Smart Home Ready

Useful for hallway lights, entry alerts, energy-saving systems, and IoT notifications.

Pin Configuration

VCC

Power input, typically 5V on HC-SR501 modules. Many boards accept 5-12V through the onboard regulator.

OUT

Digital motion output. Goes HIGH during the configured hold time after motion is detected.

GND

Ground reference. Connect to the same ground as Arduino, ESP32, or the external power supply.

How It Works

๐Ÿงช

The Science Behind It

PIR means passive infrared. The sensor contains pyroelectric elements that generate tiny signals when infrared energy changes across the lens zones.

The white Fresnel lens breaks the view into alternating hot and cold zones. When a warm body moves across those zones, the signal changes fast enough for the onboard comparator to trigger a digital output.

Detection Logic:

Stable IR pattern = OUT LOW
Changing IR pattern = OUT HIGH
Hold time = delay potentiometer setting

A PIR sensor detects change, not a stationary person. Mounting angle and temperature contrast matter as much as code.

Wiring Tips & Best Practices

โฑ๏ธ

Allow Warm-up Time

Wait 30-60 seconds after power-up before trusting readings; the amplifier needs time to stabilize.

๐ŸŒก๏ธ

Avoid Heat Sources

Keep the sensor away from heaters, sunlight, AC vents, and windows to reduce false triggers.

๐Ÿ“

Mount Across Motion

Detection is strongest when people move across the lens zones, not directly toward the sensor.

๐Ÿ”ง

Tune Delay First

Set a short hold time during testing, then increase it once the project logic works.

โšก

Use Stable Power

Noisy USB supplies can cause random triggers. Add decoupling near the module for long wires.

๐Ÿ”•

Debounce in Code

Ignore repeated triggers for a short lockout period if your alarm or relay chatters.

Related Resources

Motion Alarm Project

Build a PIR-based alarm with Arduino.

Arduino Uno Guide

Connect PIR output to digital input pins.

PIR Deep Dive

Understand the HC-SR501 module in more detail.