Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use HC-SR501 PIR: Examples, Pinouts, and Specs

Image of HC-SR501 PIR
Cirkit Designer LogoDesign with HC-SR501 PIR in Cirkit Designer

Introduction

The HC-SR501 is a passive infrared (PIR) motion sensor designed to detect motion by sensing changes in infrared radiation emitted by objects within its detection range. This sensor is widely used in security systems, home automation, and DIY electronics projects. It is capable of detecting motion from humans or animals and can trigger actions such as turning on lights, activating alarms, or sending signals to microcontrollers like Arduino.

Explore Projects Built with HC-SR501 PIR

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
PIR Motion-Activated LED Light
Image of 0: A project utilizing HC-SR501 PIR in a practical application
This circuit is a simple motion-activated LED light system. The HC-SR505 Mini PIR Motion Sensing Module is powered by a 9V battery and detects motion, upon which it sends an output signal to turn on the red LED. The LED and the PIR sensor share a common ground with the battery, completing the circuit.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32 CAM-Based Wi-Fi Motion-Activated Smart Light
Image of ESP32 CAM: A project utilizing HC-SR501 PIR in a practical application
This circuit features an ESP32 CAM microcontroller connected to an HC-SR501 PIR motion sensor and a 2-channel relay module. The PIR sensor output is connected to a GPIO pin on the ESP32, allowing it to detect motion and signal the microcontroller. The ESP32 controls the relay, which in turn switches an AC bulb on or off, effectively creating a motion-activated light system.
Cirkit Designer LogoOpen Project in Cirkit Designer
Raspberry Pi Motion-Activated LED System with PIR Sensor
Image of Detection project: A project utilizing HC-SR501 PIR in a practical application
This circuit uses a Raspberry Pi 5 to control an LED based on input from an HC-SR501 PIR motion sensor. The motion sensor is powered by the Raspberry Pi and its output is connected to a GPIO pin, which the Raspberry Pi monitors to detect motion. When motion is detected, the Raspberry Pi can turn on the LED through another GPIO pin, with a current-limiting resistor in series with the LED.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO-Based Security System with PIR Motion Detection and Bluetooth Connectivity
Image of 아두이노 캡스톤 : A project utilizing HC-SR501 PIR in a practical application
This circuit features an Arduino UNO microcontroller interfaced with a PIR motion sensor (HC-SR501), a Bluetooth module (HC-06), a buzzer (FIT0449), and a soil moisture sensor (SEN040129). The Arduino is programmed to interact with these sensors and actuators, likely to monitor environmental conditions and provide alerts or communication via Bluetooth. Additionally, there are two LED components (JLED-START and JLED-ARROW-9) daisy-chained together, which could be used for visual signaling or status indication.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with HC-SR501 PIR

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of 0: A project utilizing HC-SR501 PIR in a practical application
PIR Motion-Activated LED Light
This circuit is a simple motion-activated LED light system. The HC-SR505 Mini PIR Motion Sensing Module is powered by a 9V battery and detects motion, upon which it sends an output signal to turn on the red LED. The LED and the PIR sensor share a common ground with the battery, completing the circuit.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of ESP32 CAM: A project utilizing HC-SR501 PIR in a practical application
ESP32 CAM-Based Wi-Fi Motion-Activated Smart Light
This circuit features an ESP32 CAM microcontroller connected to an HC-SR501 PIR motion sensor and a 2-channel relay module. The PIR sensor output is connected to a GPIO pin on the ESP32, allowing it to detect motion and signal the microcontroller. The ESP32 controls the relay, which in turn switches an AC bulb on or off, effectively creating a motion-activated light system.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Detection project: A project utilizing HC-SR501 PIR in a practical application
Raspberry Pi Motion-Activated LED System with PIR Sensor
This circuit uses a Raspberry Pi 5 to control an LED based on input from an HC-SR501 PIR motion sensor. The motion sensor is powered by the Raspberry Pi and its output is connected to a GPIO pin, which the Raspberry Pi monitors to detect motion. When motion is detected, the Raspberry Pi can turn on the LED through another GPIO pin, with a current-limiting resistor in series with the LED.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of 아두이노 캡스톤 : A project utilizing HC-SR501 PIR in a practical application
Arduino UNO-Based Security System with PIR Motion Detection and Bluetooth Connectivity
This circuit features an Arduino UNO microcontroller interfaced with a PIR motion sensor (HC-SR501), a Bluetooth module (HC-06), a buzzer (FIT0449), and a soil moisture sensor (SEN040129). The Arduino is programmed to interact with these sensors and actuators, likely to monitor environmental conditions and provide alerts or communication via Bluetooth. Additionally, there are two LED components (JLED-START and JLED-ARROW-9) daisy-chained together, which could be used for visual signaling or status indication.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Security systems for detecting intruders
  • Automatic lighting systems
  • Motion-activated cameras
  • Home automation projects
  • Robotics and interactive systems

Technical Specifications

The HC-SR501 PIR sensor is equipped with adjustable settings for sensitivity and delay time, making it versatile for various applications. Below are its key technical details:

Parameter Specification
Operating Voltage 4.5V to 20V DC
Operating Current < 60 µA
Detection Range Up to 7 meters (adjustable)
Detection Angle Approximately 120°
Trigger Modes Repeatable (H) and Non-repeatable (L)
Delay Time Adjustable (0.3 seconds to 5 minutes)
Sensitivity Adjustment Adjustable via onboard potentiometer
Output Voltage (High) 3.3V
Output Voltage (Low) 0V
Dimensions 32mm x 24mm

Pin Configuration

The HC-SR501 PIR sensor has three pins for interfacing:

Pin Name Description
1 VCC Power supply input (4.5V to 20V DC)
2 OUT Digital output pin (HIGH when motion is detected)
3 GND Ground connection

Usage Instructions

Connecting the HC-SR501 to a Circuit

  1. Power Supply: Connect the VCC pin to a 5V or 12V power source (depending on your setup) and the GND pin to the ground.
  2. Output Signal: Connect the OUT pin to a microcontroller's digital input pin or directly to a device (e.g., an LED or buzzer) for motion detection output.
  3. Adjust Settings:
    • Use the sensitivity potentiometer to adjust the detection range.
    • Use the delay potentiometer to set the duration for which the output remains HIGH after motion is detected.
    • Set the trigger mode using the onboard jumper:
      • H (Repeatable): The output remains HIGH as long as motion is detected.
      • L (Non-repeatable): The output goes LOW after the delay time, even if motion is still present.

Example: Using HC-SR501 with Arduino UNO

Below is an example of how to connect and program the HC-SR501 PIR sensor with an Arduino UNO to control an LED:

Circuit Diagram

  • Connect the VCC pin of the HC-SR501 to the 5V pin on the Arduino.
  • Connect the GND pin of the HC-SR501 to the GND pin on the Arduino.
  • Connect the OUT pin of the HC-SR501 to digital pin 2 on the Arduino.
  • Connect an LED to digital pin 13 on the Arduino (with a 220-ohm resistor in series).

Arduino Code

// HC-SR501 PIR Motion Sensor with Arduino
// This code turns on an LED when motion is detected.

#define PIR_PIN 2       // HC-SR501 OUT pin connected to digital pin 2
#define LED_PIN 13      // LED connected to digital pin 13

void setup() {
  pinMode(PIR_PIN, INPUT);  // Set PIR sensor pin as input
  pinMode(LED_PIN, OUTPUT); // Set LED pin as output
  Serial.begin(9600);       // Initialize serial communication for debugging
}

void loop() {
  int motionDetected = digitalRead(PIR_PIN); // Read PIR sensor output

  if (motionDetected == HIGH) { // If motion is detected
    digitalWrite(LED_PIN, HIGH); // Turn on the LED
    Serial.println("Motion detected!"); // Print message to serial monitor
  } else {
    digitalWrite(LED_PIN, LOW); // Turn off the LED
  }

  delay(100); // Small delay to stabilize readings
}

Best Practices

  • Place the sensor at an appropriate height (e.g., 2-3 meters) for optimal motion detection.
  • Avoid placing the sensor near heat sources, such as radiators or direct sunlight, as they may interfere with its operation.
  • Use decoupling capacitors (e.g., 10µF and 0.1µF) across the power supply pins to reduce noise and ensure stable operation.
  • Allow the sensor to stabilize for 30-60 seconds after powering it on before it starts detecting motion.

Troubleshooting and FAQs

Common Issues and Solutions

  1. The sensor does not detect motion:

    • Ensure the power supply voltage is within the specified range (4.5V to 20V).
    • Check the connections to the VCC, GND, and OUT pins.
    • Verify that the sensor has completed its stabilization period after powering on.
  2. False triggers or inconsistent detection:

    • Reduce sensitivity using the onboard potentiometer.
    • Ensure the sensor is not exposed to direct sunlight or heat sources.
    • Use a shield or enclosure to minimize interference from environmental factors.
  3. Output remains HIGH even when no motion is present:

    • Check the trigger mode setting (H or L) and adjust as needed.
    • Verify that the delay time is not set too high.
  4. Output signal is weak or unstable:

    • Use a pull-down resistor (e.g., 10kΩ) on the OUT pin to stabilize the signal.
    • Ensure proper grounding and minimize noise in the circuit.

FAQs

Q: Can the HC-SR501 detect motion through glass or walls?
A: No, the HC-SR501 cannot detect motion through glass or walls as they block infrared radiation.

Q: How do I increase the detection range?
A: Turn the sensitivity potentiometer clockwise to increase the detection range. However, be cautious of false triggers at higher sensitivity levels.

Q: Can I power the HC-SR501 with a 3.3V supply?
A: No, the minimum operating voltage is 4.5V. Use a power supply within the 4.5V to 20V range.

Q: How long does the sensor take to stabilize after powering on?
A: The sensor typically requires 30-60 seconds to stabilize before it starts detecting motion.

By following this documentation, you can effectively integrate the HC-SR501 PIR sensor into your projects and troubleshoot common issues with ease.