Ir directamente al contenido

All items ship from our office in Colorado USA - $5.95 Flat-Rate US shipping & free shipping on orders over $75!

HC-SR501 PIR Motion Detector Sensor Module User Guide

HC-SR501 PIR Motion Detector Sensor Module User Guide - Envistia Mall

This guide covers setup, adjustment, and use of the HC-SR501 PIR (Passive Infrared) Motion Detector Sensor Module — one of the most popular and affordable motion sensors for Arduino, Raspberry Pi, and DIY electronics projects. It detects the infrared radiation (heat) emitted by people, animals, and other warm objects, and outputs a simple HIGH/LOW digital signal when motion is detected.

Whether you're building a security alarm, automatic lighting, an occupancy detector, or a Halloween prop, this guide will walk you through everything you need to know — from basic wiring to advanced configuration and troubleshooting false triggers.


💡 How PIR Motion Detection Works

Understanding how this sensor works will help you get the best results and troubleshoot issues.

What "Passive Infrared" Means

The sensor is passive — it doesn't emit any signal. Instead, it detects the infrared (IR) radiation that all warm objects naturally emit. Humans, animals, and even warm vehicles radiate infrared energy. The sensor detects changes in this infrared radiation within its field of view.

Inside the Module

The HC-SR501 contains three key components:

  1. Pyroelectric sensor element: A small sensor behind the lens that is sensitive to infrared radiation. It actually contains two sensing elements side by side. When a warm object moves across the sensor's field of view, it passes from one element to the other, creating a differential signal — this is how the sensor distinguishes motion from a static warm background.
  2. Fresnel lens (the white dome): The large white plastic dome on top is a Fresnel lens. It focuses and concentrates infrared radiation from a wide area (~120° cone) onto the tiny sensor element, dramatically increasing the detection range and sensitivity. The lens has multiple facets, which is why the detection pattern has multiple "zones" rather than a single smooth cone.
  3. BISS0001 signal processing IC: This chip on the PCB processes the raw signal from the pyroelectric sensor, applies timing and sensitivity thresholds, and outputs a clean digital HIGH (3.3V) or LOW (0V) signal. It handles the time delay, trigger mode logic, and the 2.5-second blockage time after power-up.

What It Detects (and What It Doesn't)

  • ✅ Detects: Moving warm objects — people walking, pets, warm vehicles. The key word is moving. A person standing perfectly still will not trigger the sensor after the initial detection.
  • ✅ Detects through: Thin plastic, paper, fabric, and drywall (IR passes through many non-metallic materials).
  • ❌ Does NOT detect: Stationary warm objects, objects behind glass (glass blocks IR), or objects at the same temperature as the background.
  • ❌ Does NOT measure: Distance, direction, speed, or the number of people. It only tells you "motion detected" or "no motion detected."

⭐ Features

  • Wide detection range: Up to 7 meters (21 feet) with adjustable sensitivity down to ~3 meters (9 feet).
  • Wide detection angle: ~120° cone from the front of the Fresnel lens.
  • Adjustable sensitivity: Onboard potentiometer to set the detection range.
  • Adjustable time delay: Onboard potentiometer to set how long the output stays HIGH after detection (3 seconds to 5 minutes).
  • Selectable trigger mode: Jumper to choose between single trigger (non-repeatable) and repeatable trigger modes.
  • Simple digital output: 3.3V HIGH when motion detected, 0V LOW when no motion. Directly compatible with Arduino, ESP32, and Raspberry Pi GPIO.
  • Wide operating voltage: 5V to 20V DC — works with a wide range of power supplies.
  • Ultra-low power: Only 65µA quiescent current — ideal for battery-powered projects.
  • Compact: 32mm × 24mm PCB — fits easily in project enclosures.

📋 Specifications

Parameter Value
Sensor Type Passive Infrared (PIR), pyroelectric
Processing IC BISS0001
Operating Voltage 5V – 20V DC
Quiescent Current ~65µA
Output Signal Digital: HIGH = 3.3V, LOW = 0V
Output Current Can source up to ~10mA (enough to drive an LED directly)
Detection Range 3m – 7m (9ft – 21ft), adjustable
Detection Angle ~120° cone
Time Delay 3 seconds – 5 minutes, adjustable
Blockage Time ~2.5 seconds (after power-up and after each trigger cycle)
Trigger Modes Single (L) / Repeatable (H), jumper selectable
Sensitivity Adjustment Onboard potentiometer
Time Delay Adjustment Onboard potentiometer
Operating Temperature −15°C to +70°C
PCB Dimensions 32mm × 24mm (1.27" × 0.96")
Lens Diameter 23mm
HC-SR501 Dimensional Drawing


HC-SR501 Dimensional Drawing


📌 Pinout and Board Layout

The HC-SR501 has three pins, two adjustment potentiometers, and one trigger mode jumper. Looking at the board with the pins at the bottom and the lens on top:

Pins (3-pin header)

Pin Label Connect To Function
1 VCC 5V – 20V DC Power supply positive. Note: Although the module accepts 5V–20V, the output is always 3.3V regardless of supply voltage.
2 OUT Digital input pin (e.g., D2) Digital output. Goes HIGH (3.3V) when motion is detected, LOW (0V) when no motion.
3 GND Ground Power supply ground. Must share common ground with your microcontroller.

HC-SR501 PIR IR Passive Infrared Motion Detector Sensor Module Controls and Connectors
HC-SR501 Connectors and Jumpers

Note: Pin order may vary between manufacturers. Some modules have the pins in the order VCC-OUT-GND, while others use GND-OUT-VCC. Always check the silkscreen labels on your specific module before wiring.

Adjustment Potentiometers

Potentiometer Label Function Range
Sensitivity Often marked "Sx" or nearest to the pins Adjusts the detection range (how far away motion can be detected) ~3m (9ft) to ~7m (21ft). Clockwise = more sensitive (longer range).
Time Delay Often marked "Tx" or nearest to the lens Adjusts how long the output stays HIGH after motion is detected ~3 seconds to ~5 minutes. Clockwise = longer delay.

Trigger Mode Jumper

The jumper (or solder pads) on the board selects between two trigger modes:

Jumper Position Mode Behavior
L (Single Trigger) Non-repeatable When motion is detected, the output goes HIGH for the set time delay, then goes LOW. Additional motion during the delay period is ignored. After the delay expires, there is a ~2.5-second blockage time before the sensor can trigger again.
H (Repeatable Trigger) Repeatable When motion is detected, the output goes HIGH. If additional motion is detected during the delay period, the timer resets and the output stays HIGH. The output only goes LOW after the full delay period passes with no motion detected. This is the most common mode for lighting and alarm applications.

Which Trigger Mode Should I Use?

  • Repeatable (H) — recommended for most applications. Use this for automatic lighting, security alarms, and occupancy detection. The light/alarm stays on as long as someone is moving in the area, and turns off after they leave.
  • Single (L) — use for counting or event-based triggers. Each detection produces exactly one timed output pulse, regardless of continued motion. Useful for counting people passing through a doorway or triggering a one-shot action.

🔌 Wiring

What You'll Need

  • Arduino Uno, Mega, Nano, or compatible board
  • 3 × jumper wires (female-to-male or male-to-male with breadboard)
  • USB cable for Arduino programming
  • (Optional) LED and 220Ω resistor for visual output indicator

Basic Arduino Wiring

HC-SR501 Pin Arduino Pin
VCC 5V
OUT D2 (or any digital input pin)
GND GND

That's it — three wires. The sensor outputs 3.3V HIGH, which is above the Arduino's digital input threshold (~1.5V for a 5V Arduino), so it reads reliably as HIGH without any level shifting.

Wiring with an LED Indicator

To add a visual indicator LED that lights up when motion is detected:

  • Connect a 220Ω resistor from Arduino pin D13 (or any digital output pin) to the LED's anode (long leg).
  • Connect the LED's cathode (short leg) to GND.
  • In your code, set pin D13 HIGH when the sensor output is HIGH.

Tip: You can also connect a small LED (with a 220Ω resistor) directly to the HC-SR501's OUT pin and GND — the output can source enough current (~10mA) to drive an LED without going through the Arduino at all. This is useful for quick testing without any code.

ESP32 / ESP8266 Wiring

HC-SR501 Pin ESP32 Pin
VCC VIN or external 5V supply (do NOT use 3.3V — the module needs 5V minimum)
OUT Any GPIO pin (e.g., GPIO 13). The 3.3V output is perfect for ESP32's 3.3V logic.
GND GND (must share common ground)

Raspberry Pi Wiring

HC-SR501 Pin Raspberry Pi Pin
VCC 5V (Pin 2 or Pin 4)
OUT Any GPIO pin (e.g., GPIO 17 / Pin 11). The 3.3V output is safe for Pi's 3.3V GPIO.
GND GND (Pin 6 or any GND pin)

Important: The HC-SR501's output is 3.3V, which is safe for all common microcontrollers (Arduino 5V, ESP32 3.3V, Raspberry Pi 3.3V). No level shifting is needed for any of these platforms.


🏗️ Schematic / Circuit Diagram

HC-SR501 Schematic


HC-SR501 Schematic

💻 Arduino Example Code

Example 1: Basic Motion Detection

const int pirPin = 2;     // HC-SR501 OUT connected to digital pin 2
const int ledPin = 13;    // Built-in LED on most Arduino boards

void setup() {
  pinMode(pirPin, INPUT);
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);

  Serial.println("HC-SR501 warming up...");
  delay(30000);  // Wait 30 seconds for sensor to stabilize
  Serial.println("Sensor ready. Monitoring for motion...");
}

void loop() {
  int motionDetected = digitalRead(pirPin);

  if (motionDetected == HIGH) {
    digitalWrite(ledPin, HIGH);
    Serial.println("Motion detected!");
  } else {
    digitalWrite(ledPin, LOW);
    Serial.println("No motion.");
  }

  delay(200);  // Small delay to avoid flooding the serial monitor
}

Example 2: Motion-Activated Alarm with Cooldown

const int pirPin = 2;
const int buzzerPin = 8;    // Piezo buzzer on pin 8
const int ledPin = 13;
unsigned long lastTrigger = 0;
unsigned long cooldown = 5000;  // 5-second cooldown between alarms
bool alarmActive = false;

void setup() {
  pinMode(pirPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);

  Serial.println("Alarm system warming up (30 seconds)...");
  delay(30000);
  Serial.println("Alarm system ARMED.");
}

void loop() {
  int motionDetected = digitalRead(pirPin);

  if (motionDetected == HIGH && !alarmActive) {
    if (millis() - lastTrigger > cooldown) {
      Serial.println("*** INTRUDER DETECTED! ***");
      alarmActive = true;
      lastTrigger = millis();

      // Sound alarm: 3 short beeps
      for (int i = 0; i < 3; i++) {
        digitalWrite(buzzerPin, HIGH);
        digitalWrite(ledPin, HIGH);
        delay(200);
        digitalWrite(buzzerPin, LOW);
        digitalWrite(ledPin, LOW);
        delay(200);
      }
      alarmActive = false;
    }
  }

  delay(100);
}

Example 3: Motion Counter (Single Trigger Mode)

Set the jumper to L (Single Trigger) and the time delay to minimum (~3 seconds) for this example:

const int pirPin = 2;
int motionCount = 0;
bool lastState = LOW;

void setup() {
  pinMode(pirPin, INPUT);
  Serial.begin(9600);

  Serial.println("Motion counter warming up (30 seconds)...");
  delay(30000);
  Serial.println("Ready. Counting motion events...");
}

void loop() {
  int currentState = digitalRead(pirPin);

  // Detect rising edge (LOW to HIGH transition)
  if (currentState == HIGH && lastState == LOW) {
    motionCount++;
    Serial.print("Motion event #");
    Serial.println(motionCount);
  }

  lastState = currentState;
  delay(100);
}

🔧 Adjusting Sensitivity and Time Delay

Sensitivity Adjustment

  1. Locate the sensitivity potentiometer (usually the one closest to the pins, sometimes labeled "Sx").
  2. Use a small screwdriver to turn it:
    • Clockwise = increase sensitivity (longer detection range, up to ~7m / 21ft)
    • Counter-clockwise = decrease sensitivity (shorter detection range, down to ~3m / 9ft)
  3. Start with the sensitivity at mid-range and test. Walk toward the sensor from various distances to find the right setting for your application.

Time Delay Adjustment

  1. Locate the time delay potentiometer (usually the one closest to the lens, sometimes labeled "Tx").
  2. Use a small screwdriver to turn it:
    • Clockwise = longer delay (up to ~5 minutes)
    • Counter-clockwise = shorter delay (down to ~3 seconds)
  3. For most applications, start with a short delay (counter-clockwise) and increase as needed.

Recommended Settings by Application

Application Sensitivity Time Delay Trigger Mode
Hallway light Medium-high 30–60 seconds Repeatable (H)
Bathroom light Medium 2–3 minutes Repeatable (H)
Security alarm Maximum Minimum (3s) Single (L)
People counter Medium Minimum (3s) Single (L)
Pet detector Low-medium 5–10 seconds Repeatable (H)
Halloween prop Medium-high 5–10 seconds Single (L)
Room occupancy High 3–5 minutes Repeatable (H)

⏱️ Understanding the Timing Behavior

The HC-SR501 has specific timing behaviors that are important to understand:

Power-Up Warm-Up Period

When first powered on, the sensor needs approximately 30–60 seconds to stabilize. During this time, it may output random HIGH/LOW signals as the pyroelectric element adjusts to the ambient infrared environment. Always include a warm-up delay in your code (30 seconds minimum) before reading the sensor.

Blockage Time

After each trigger cycle (when the output goes from HIGH back to LOW), there is a ~2.5-second blockage period during which the sensor cannot trigger again. This is a hardware limitation of the BISS0001 IC and cannot be changed. This means the fastest the sensor can re-trigger is approximately every 2.5 seconds after the time delay expires.

Timing Diagram

Single Trigger (L):
Motion detected → Output HIGH → [Time Delay] → Output LOW → [2.5s Block] → Ready
                  (motion during delay is ignored)

Repeatable Trigger (H):
Motion detected → Output HIGH → [Time Delay resets on each new motion]
                                → No motion for full delay → Output LOW → [2.5s Block] → Ready

🚫 Reducing False Triggers

False triggers are the #1 issue users experience with the HC-SR501. Here's a comprehensive guide to eliminating them:

Common Causes and Solutions

Cause Why It Happens Solution
Power supply noise Voltage spikes or ripple on the power rail cause the sensor to trigger Add a 10µF electrolytic capacitor and a 0.1µF ceramic capacitor across VCC and GND directly at the sensor. This is the single most effective fix for false triggers.
Long wire runs Long wires between the sensor and microcontroller act as antennas, picking up electromagnetic interference (EMI) Keep wires as short as possible. Use shielded cable for runs over 30cm. Add decoupling capacitors at the sensor end.
WiFi/RF interference ESP32, ESP8266, and other WiFi-enabled boards emit RF that can trigger the sensor Mount the sensor at least 10cm away from the WiFi antenna. Add a 10µF capacitor across VCC/GND. Consider wrapping the sensor PCB (not the lens) in aluminum foil connected to ground.
Air currents / HVAC Moving warm air from heaters, AC vents, or fans creates infrared changes Position the sensor away from HVAC vents, heaters, and fans. Reduce sensitivity. Add a narrow tube or baffle over the lens to restrict the field of view.
Direct sunlight Sunlight contains strong infrared radiation. Moving clouds or shadows cause rapid IR changes. Avoid placing the sensor where direct sunlight hits the lens. Use indoors or in shaded areas.
Pets / small animals Pets emit infrared radiation and trigger the sensor Reduce sensitivity. Mount the sensor higher and angle it downward so pets pass below the detection zone. Add a narrow tube over the lens to restrict the vertical field of view.
Vibration Physical vibration of the sensor can cause the pyroelectric element to generate false signals Mount the sensor on a stable, vibration-free surface. Use rubber standoffs or foam padding.
Warm-up period not observed The sensor outputs random signals for 30–60 seconds after power-up Always include a 30-second delay in your code before reading the sensor.

The Capacitor Fix (Most Important)

If you're experiencing false triggers, the first thing to try is adding filtering capacitors:

  1. Solder a 10uF to 100µF electrolytic capacitor across the VCC and GND pins on the HC-SR501 module (observe polarity — positive leg to VCC).
  2. Solder a 0.1µF (100nF) ceramic capacitor across the same VCC and GND pins (no polarity).
  3. If you can't solder, use a breadboard and place the capacitors as close to the sensor's pins as possible.

This combination filters both low-frequency power supply ripple (electrolytic) and high-frequency noise spikes (ceramic), and resolves the majority of false trigger issues.


🔌 Compatibility

  • Arduino (Uno, Mega, Nano, Leonardo) — direct connection. Power from 5V pin, read from any digital pin.
  • ESP32 / ESP8266 — power from VIN or external 5V (not 3.3V). Output is 3.3V, safe for ESP32 GPIO. Note: WiFi interference may cause false triggers — see the False Triggers section.
  • Raspberry Pi — power from 5V pin (Pin 2/4). Output is 3.3V, safe for Pi GPIO. Read with any GPIO pin.
  • STM32, AVR, PIC — compatible with any microcontroller that has a digital input pin. Output is 3.3V.
  • Standalone (no microcontroller) — the output can directly drive a small LED (with resistor), a relay module, or a buzzer. No microcontroller required for simple on/off applications.

🎯 Project Ideas & Applications

  • Automatic lighting: Turn on hallway, bathroom, closet, or porch lights when someone enters. Use repeatable trigger mode with a 1–3 minute delay.
  • Security alarm: Trigger a buzzer, siren, or notification when motion is detected in a protected area.
  • Smart home / Home Assistant: Connect via ESP32 or Raspberry Pi to trigger automations — turn on lights, adjust thermostat, send notifications.
  • Occupancy detection: Detect whether a room is occupied for HVAC control, energy saving, or meeting room availability.
  • People counter: Use single trigger mode to count people passing through a doorway (approximate — PIR cannot distinguish individuals).
  • Pet detector: Detect pet activity for automatic feeders, pet doors, or monitoring.
  • Halloween props: Trigger animatronics, sound effects, or lighting when trick-or-treaters approach.
  • Wildlife camera trigger: Activate a camera when an animal passes by.
  • Energy saving: Turn off monitors, displays, or equipment when no one is present.
  • Automatic fan control: Turn on a ventilation fan when someone enters a bathroom or workshop.

🛠️ Troubleshooting

Problem Possible Cause Solution
Sensor always reads HIGH Still in warm-up period, or sensitivity too high Wait at least 30–60 seconds after power-up. Reduce sensitivity (turn potentiometer counter-clockwise). Check for heat sources in the field of view.
Sensor always reads LOW Wiring error, wrong pin, or sensor not powered Verify VCC is connected to 5V (not 3.3V). Check pin order — it varies between manufacturers. Verify GND is connected. Test the output with a multimeter.
False triggers (random activations) Power supply noise, EMI, air currents, or sunlight See the comprehensive "Reducing False Triggers" section above. Start with adding capacitors across VCC/GND.
Sensor doesn't re-trigger In single trigger mode, or blockage time not elapsed Check the jumper — set to H for repeatable trigger. Wait for the 2.5-second blockage time to pass after each cycle.
Detection range is too short Sensitivity set too low, or lens obstructed Turn the sensitivity potentiometer clockwise. Ensure the Fresnel lens is clean and unobstructed. Remove any enclosure material that blocks IR (glass blocks IR; thin plastic does not).
Detection range is too long (detects through walls) Sensitivity set too high Turn the sensitivity potentiometer counter-clockwise. Add a tube or baffle over the lens to narrow the field of view.
Sensor works but output is only ~3.3V, not 5V Normal behavior The HC-SR501 always outputs 3.3V HIGH regardless of supply voltage. This is by design and is compatible with all common microcontrollers.
Erratic behavior with ESP32/ESP8266 WiFi RF interference Add 10µF + 0.1µF capacitors. Move sensor away from the WiFi antenna. Shield the sensor PCB with grounded foil.
Sensor triggers when no one is present Pets, HVAC, sunlight, or vibration Identify the source. Reduce sensitivity. Reposition the sensor. Add a lens tube to narrow the field of view. See False Triggers section.
Random triggers after working fine for a while Temperature changes (day/night transition) or power supply degradation Add capacitors if not already present. Check power supply voltage stability. Reduce sensitivity slightly.

⚠️ Important Notes & Safety

  • 30-second warm-up required. Always wait at least 30 seconds after power-up before reading the sensor. Include a delay in your code.
  • Output is always 3.3V regardless of supply voltage. This is normal and compatible with all common microcontrollers.
  • Minimum supply voltage is 5V. The module will not work reliably at 3.3V. Use the 5V rail from your Arduino or an external 5V supply.
  • The sensor detects motion, not presence. A person standing perfectly still will not continue to trigger the sensor. For true presence detection, consider combining with other sensors (ultrasonic, mmWave).
  • Glass blocks infrared. The sensor cannot detect motion through glass windows. Thin plastic, paper, and fabric are generally transparent to IR.
  • Not suitable for outdoor use without an enclosure. The module is not weatherproof. Use a weatherproof enclosure with an IR-transparent window if mounting outdoors.
  • The Fresnel lens is fragile. Handle the white dome carefully — it's made of soft plastic and scratches easily. Scratches can reduce sensitivity and create blind spots.
  • Do not use for life-safety applications. This is a hobby-grade sensor. Do not rely on it as the sole sensor for fire detection, medical monitoring, or security systems protecting life or high-value property.

📋 Quick Reference Card

Parameter Value
Supply Voltage 5V – 20V DC
Output 3.3V HIGH / 0V LOW (digital)
Detection Range 3m – 7m (adjustable)
Detection Angle ~120°
Time Delay 3s – 5min (adjustable)
Warm-Up Time 30–60 seconds (mandatory)
Blockage Time ~2.5 seconds
Trigger Mode Jumper L = Single, H = Repeatable
Arduino Wiring VCC→5V, OUT→D2, GND→GND
False Trigger Fix #1 Add 10µF + 0.1µF caps across VCC/GND

🛒 Where to Buy the HC-SR501

HC-SR501 PIR Motion Detector Sensor Module (1 Piece) at Envistia Mall →

HC-SR501 PIR Motion Detector Sensor Module (5 Pieces) at Envistia Mall →


📚 Additional Resources


This guide is provided by Envistia Mall for educational and technical reference purposes. The manufacturer and Envistia LLC (dba Envistia Mall) are not responsible for any damages or losses resulting from the use of this product. Always follow proper electrical safety practices when working with electronic components. Specifications are based on manufacturer data and may vary between production batches. 

Share this guide:
in

🛒 Related Products

Find the components mentioned in this guide in our store.

Browse Products →