PIR Motion Sensors Guide
Circuitkar Team ยท 18 May 2026
PIR Motion Sensors Guide
PIR (Passive Infrared) sensors detect motion by sensing changes in infrared radiation from warm bodies moving through their field of view. They are the standard for motion-activated lights, security systems, and occupancy detection. This guide covers the common modules and how to use them correctly.
How PIR Sensors Work
A PIR sensor element contains two pyroelectric sensing halves connected in opposition. When a warm object (human body radiates ~9.4 ยตm IR) moves through the sensor's field of view, one half detects the change before the other, generating a differential signal. The output IC (typically BISS0001 on HC-SR501) amplifies this and produces a digital HIGH on the output pin for a set duration.
PIR sensors detect change in IR radiation, not presence. A stationary person in a room will not be detected after a short while. This is important for occupancy use cases โ use a radar module (RCWL-0516) or multiple PIR sensors if detecting stationary occupancy.
HC-SR501: The Standard Module
The HC-SR501 is the white dome sensor with the BISS0001 IC on the back. Specs: 5โ12V supply, digital output (3.3V logic output โ safe for ESP32), detection range up to 7 m, 110ยฐ cone angle, two adjustment potentiometers.
Sensitivity potentiometer (Sx): Adjusts detection range from ~3 m to ~7 m. Turn clockwise to increase range.
Time-delay potentiometer (Tx): Adjusts how long output stays HIGH after motion detected โ from ~3 seconds to ~300 seconds. Turn clockwise for longer delay.
Jumper (H/L trigger mode): Single trigger (L) = output goes HIGH once per detection, then resets. Repeat trigger (H) = output stays HIGH as long as motion continues to be detected. Use H mode for lights that should stay on while someone is in the room. Price: โน40โ70.
HC-SR505: Mini PIR Module
Smaller than HC-SR501, designed for 3.3Vโ5V supply. Fixed sensitivity and time delay (no potentiometers). Detection range: ~3 m. Output: digital HIGH/LOW. Price: โน50โ80. Use when space is constrained or you need 3.3V native operation without the HC-SR501's higher supply voltage requirement.
AM312: Smallest Option
The AM312 is a miniature PIR module: 2.7โ12V supply, ~3 m range, 100ยฐ angle, ~2 second output time. Dimensions: ~1 cm ร 1 cm. Price: โน40โ70. Ideal for embedding in products where visibility of the sensor is undesirable.
Wiring to ESP32
HC-SR501: VCC to 5V, GND to GND, OUT to any ESP32 GPIO (3.3V output level is ESP32 compatible). Read with digitalRead(). The 2-second minimum initialization delay after power-on is important โ the sensor output is undefined during this period. Add a startup delay in your code.
False Trigger Causes and Fixes
- Air vents and fans: Moving air changes the temperature near the sensor. Position sensors away from AC vents.
- Pets: Dogs and cats trigger PIR sensors. Use dual-zone PIR sensors or raise mount height so the beam starts above pet height.
- Sunlight through windows: Direct sunlight or rapidly changing shadows from window blinds can trigger PIR. Avoid pointing sensors toward windows.
- Electrical interference: Use 100 nF decoupling capacitor on VCC. Keep signal wire away from mains wiring.
- Sensitivity too high: Reduce Sx potentiometer setting and remount at a lower angle.
ESPHome Configuration
binary_sensor:
- platform: gpio
pin: GPIO23
name: "Living Room Motion"
device_class: motion
filters:
- delayed_off: 30s
The delayed_off filter keeps the binary sensor active for 30 seconds after the last trigger โ useful for light automation that should not flicker when someone is still in the room.
Find HC-SR501 and other PIR sensors at Circuitkar โ reliable sensors for home automation and security projects.
Related Articles
Home Automation Bill of Materials: Complete Component List with Prices
Full BOM for a 3-room smart home โ every component, quantity, price range, and total cost estimate for a DIY home automation installation.
ESP32 for Small Factory Automation: A Practical Starter Guide
How small Indian manufacturers are using ESP32 for basic factory monitoring and control โ real use cases, limitations, and what it costs to get started.
Why Cheap Components Fail and What to Buy Instead
The real reasons why no-name ESP32s, clone sensors, and unbranded relay boards fail โ and how to identify quality components before buying.