7:30 AM - 7:30 PM
Monday to Saturday

HC-sr505: A Complete Guide

Introduction to the HC-sr505 PIR Motion Sensor

The HC-sr505 is a passive infrared (PIR) motion sensor commonly used in electronics projects to detect the presence or movement of people, animals, or objects. It offers an inexpensive and easy-to-use solution for adding motion sensing capabilities to a wide range of applications, such as security systems, automatic lighting controls, and interactive projects.

Key Features of the HC-sr505

  • PIR (Passive Infrared) sensing technology
  • Adjustable sensing distance and delay time
  • Low power consumption
  • Easy to interface with microcontrollers like Arduino
  • Compact size and convenient mounting options

How the HC-sr505 Works

PIR Sensing Principle

The HC-sr505 sensor detects motion by measuring changes in the infrared radiation emitted by objects within its field of view. It consists of a pyroelectric sensor that is sensitive to the infrared spectrum. When an object (such as a person or animal) with a different temperature than the background environment moves in front of the sensor, it causes a change in the infrared levels detected by the sensor. The sensor then processes this change and triggers an output signal to indicate motion.

Sensor Components

The HC-sr505 module contains the following main components:

  1. Fresnel Lens: A multi-faceted lens that focuses the infrared radiation onto the pyroelectric sensor.
  2. PIR Sensor: The pyroelectric sensor that detects changes in infrared radiation.
  3. Signal Processing Circuitry: Electronics that amplify and filter the sensor’s output signal.
  4. Potentiometers: Adjustable resistors used to set the sensing distance and delay time.
  5. Output Pin: The pin that provides the motion detection output signal.

Using the HC-sr505 with Arduino

Wiring the HC-sr505 to Arduino

To use the HC-sr505 with an Arduino, follow these wiring connections:

HC-sr505 Pin Arduino Pin
OUT Digital Pin

Arduino Code Example

Here’s a simple Arduino sketch that demonstrates how to use the HC-sr505 to detect motion and turn on an LED when motion is detected:

const int PIR_PIN = 2;
const int LED_PIN = 13;

void setup() {
  pinMode(PIR_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);

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

  if (motionDetected == HIGH) {
    digitalWrite(LED_PIN, HIGH);
    delay(1000); // Keep the LED on for 1 second
    digitalWrite(LED_PIN, LOW);

In this example, the HC-sr505’s output pin is connected to digital pin 2 of the Arduino, and an LED is connected to pin 13. When motion is detected, the LED turns on for 1 second and then turns off.

Adjusting the HC-sr505 Settings

The HC-sr505 has two potentiometers that allow you to adjust the sensing distance and delay time:

  1. Sensitivity Adjustment: This potentiometer controls the sensing distance of the HC-sr505. Turning it clockwise increases the sensitivity and extends the sensing range, while turning it counterclockwise reduces the sensitivity and shortens the sensing range.

  2. Time Delay Adjustment: This potentiometer sets the delay time, which is the duration for which the sensor’s output remains high after motion is detected. Turning it clockwise increases the delay time, while turning it counterclockwise decreases the delay time.

To adjust these settings, gently turn the potentiometers using a small screwdriver until you achieve the desired sensitivity and delay time for your application.

Applications of the HC-sr505

The HC-sr505 PIR motion sensor can be used in a variety of projects and applications, such as:

  1. Security Systems: Detect unauthorized entry or movement in a specific area.
  2. Automatic Lighting Control: Turn lights on automatically when someone enters a room and turn them off after a period of inactivity.
  3. Energy Saving: Control appliances or devices based on the presence of people in a room to save energy.
  4. Robotics: Use motion detection to trigger actions or behaviors in robotic projects.
  5. Interactive Installations: Create interactive art installations or displays that respond to the presence or movement of viewers.
  6. Wildlife Monitoring: Detect the presence of animals in a particular area for research or conservation purposes.

HC-sr505 vs. Other PIR Sensors

There are several other PIR motion sensors available in the market, such as the HC-sr501 and the AM312. Here’s a comparison table highlighting some key differences:

Feature HC-sr505 HC-sr501 AM312
Sensing Range Up to 7m Up to 7m Up to 8m
Delay Time 2-200s 2-300s 2-200s
Trigger Mode Single Repeatable Single
Operating Voltage 4.5-20V DC 5-20V DC 2.7-12V DC
Size 32x24mm 32x24mm 28x23mm

While these sensors share similar basic functionality, they may have slight differences in their specifications, such as sensing range, delay time, and operating voltage. Choose the sensor that best fits your project requirements.

Troubleshooting Common Issues

False Triggering

If your HC-sr505 is triggering motion detection even when there is no movement, it could be due to the following reasons:

  • High sensitivity setting: Try reducing the sensitivity by adjusting the potentiometer.
  • Interference from other sources: Ensure the sensor is not pointing towards heat sources, air conditioners, or direct sunlight.
  • Electrical noise: Use decoupling capacitors and shielded cables to minimize electrical interference.

No Detection

If your HC-sr505 is not detecting motion when it should, consider the following:

  • Low sensitivity setting: Increase the sensitivity by adjusting the potentiometer.
  • Obstructed field of view: Make sure there are no objects blocking the sensor’s view.
  • Insufficient warmup time: Allow the sensor to warm up for a few minutes after power-on before expecting accurate detection.
  • Wiring issues: Double-check the wiring connections between the sensor and the microcontroller.


  1. What is the detection range of the HC-sr505?
    The HC-sr505 has an adjustable detection range of up to 7 meters. The actual range may vary depending on the environment and the sensitivity setting.

  2. Can the HC-sr505 detect motion through walls?
    No, the HC-sr505 cannot detect motion through walls or other solid obstacles. It requires a direct line of sight to detect infrared radiation emitted by moving objects.

  3. How do I adjust the sensitivity and delay time of the HC-sr505?
    The HC-sr505 has two potentiometers, one for adjusting the sensitivity (sensing distance) and another for adjusting the delay time. Use a small screwdriver to gently turn the potentiometers clockwise to increase sensitivity or delay time, and counterclockwise to decrease them.

  4. What is the output of the HC-sr505 when motion is detected?
    When motion is detected, the HC-sr505’s output pin goes HIGH (3.3V or 5V, depending on the operating voltage). When no motion is detected, the output pin remains LOW (0V).

  5. Can I use the HC-sr505 with other microcontrollers besides Arduino?
    Yes, the HC-sr505 can be used with any microcontroller or development board that has digital input/output pins and operates within the sensor’s voltage range. The wiring and code may need to be adapted accordingly.


The HC-sr505 PIR motion sensor is a versatile and affordable solution for adding motion detection capabilities to your electronics projects. With its adjustable sensitivity and delay time, compact size, and easy integration with microcontrollers like Arduino, the HC-sr505 is suitable for a wide range of applications, from security systems to interactive installations.

By understanding how the sensor works, properly wiring it to your microcontroller, and adjusting its settings to suit your needs, you can effectively utilize the HC-sr505 in your projects. Remember to consider factors such as the sensor’s field of view, environmental conditions, and potential sources of interference to ensure optimal performance.

As you explore the possibilities of motion detection with the HC-sr505, feel free to experiment with different configurations, combine it with other sensors or actuators, and unleash your creativity in building innovative projects. Happy tinkering!