HC SR501 PIR Sensor : PinOut, Specifications, Hardware, Differences, Interfacing & Its Applications

The PIR sensor is a low-cost passive infrared sensor that detects the motion of animals or humans within the sensor range. This sensor is used frequently in automatic lighting systems, security systems, etc. It is frequently referred to as a pyroelectric, PIR, IR motion sensor, and passive infrared. This sensor module has a dome-shaped Fresnel lens, conditioning circuitry, and an onboard pyroelectric sensor. Examples of PIR sensors are HC SR501, HC SR505, AM312, ZRD-09, RD-624, RD-623, etc. This article provides an overview of the HC SR501 PIR sensor, its working, and its applications.


What is the HCSR501 PIR Sensor?

The HC SR501 is a low-cost passive infrared sensor module that can detect the existence of animals or Human beings. The PIR sensor relies on obtaining IR radiation from the existing human body to activate an alarm. This module works with 5V DC and provides a TTL output, which can be given directly to a relay or a microcontroller through a transistor. It includes a pyroelectric sensor & Fresnel lens, which detects the movement of human beings by measuring changes in the IR levels produced by the objects. This sensor’s motion detection range is up to 20ft.

This sensor’s output connects directly to one of the digital pins on the Arduino microcontroller. When the PIR sensor detects motion, it sets the digital pin value to high. Additionally, the two potentiometers on the board let you adjust the sensitivity and delay time for movement detection.

HC SR501 PIR Sensor Pin Configuration:

HC SR501 PIR sensor includes three pins, which are discussed below.

PIR Sensor Pin Configuration
PIR Sensor Pin Configuration
  • Pin-1 (Vcc): This is an input voltage pin that is connected to the positive voltage source of the power supply. This voltage ranges from 4.5 volts to 12 volts.
  • Pin-2 (Low/High Output): This is a low or high-output pin of a module that provides a digital signal as an output. Whenever motion is detected, the output will go HIGH, and it goes LOW whenever there is no motion.
  • Pin-3 (GND): It is connected to the GND terminal of the circuit to provide a common return lane for the power supply.

Features and Specifications:

The features and specifications of the HC SR501 PIR sensor include the following.

  • The HC-SR501 is a passive infrared motion detection module.
  • Its detection range is from 3 to 7 meters.
  • Its detection angle is 120 degrees.
  • This sensor operates with a DC voltage that ranges from 4.5V to 20V.
  • Its quiescent current is <50µA.
  • The output signal is 3.3V when motion is detected and 0V when it is idle.
  • This sensor’s adjustable delay time is from 5 to 200 seconds, whereas the blocking time is 2.5 seconds.
  • The lens size is 23mm in diameter.
  • Board dimensions are: 32mm x 24mm.
  • Sensitivity & holding time can be changed.
  • The current drain is <60uA
  • The detection range is <140°
  • Delay time ranges from 5 to 200s.
  • Blockade time by default is 2.5.
  • Its operating temperature ranges from -15°C to +70°C.

Equivalents & Alternatives

The equivalent to the HC SR501 PIR sensor is the SB312A high-sensitivity motion sensor. Alternatives to HC SR501 PIR sensors are; Generic KG001, HC SR505, ZRD-09, AM312, RD-624, RD-623 ultrasonic sensors, mmWave radar, etc.

HC SR501 PIR Sensor Hardware

The HC SR501 PIR sensor module includes different components which are discussed below.

HC SR501 PIR Sensor Hardware
HC SR501 PIR Sensor Hardware

BISS0001 Controller

BSS0001 IC is the signal processing controller that uses the sensor’s raw data and processes it to sense motion to provide a digital output. So it can also amplify and filter the signals to eliminate noise & interference.

RT & RL

The PIR motion sensor includes two solder pads on the backside of the board and is labeled as RT & RL. These pads help in soldering the LDR and thermistor to enhance the sensor’s adaptability.

Protection Diode

A protection diode in this sensor helps protect the electronic circuit from reverse voltage & current.

3.3V Voltage Regulator

This voltage regulator enables the sensor to operate with various microcontrollers that have different logic levels. Thanks to the voltage regulator, you can supply DC voltage ranging from 4.5V to 12V to power the sensor.

Trigger Selection Jumper

The trigger selection jumper of the sensor decides whether the PIR sensor will constantly trigger on motion or trigger only once for a set duration after early motion detection. The HC-SR501 PIR sensor works in two trigger modes: single trigger mode & multiple trigger modes, which are discussed below.

Single Trigger Mode

The PIR sensor triggers only once whenever motion is detected. So the output goes high mainly for the set duration through the time delay knob. Again, this sensor will not trigger until the time delay phase has ended, even if the motion continues. So this mode is helpful for projects where a single and uninterrupted activation for every motion event is preferred.

Multiple Trigger Mode

The PIR sensor triggers each time it detects motion, keeping the output high for a set time delay after each detection. This mode is particularly useful for projects that require continuous activation based on motion. Each time the sensor detects movement, it resets the time delay, ensuring consistent responsiveness.

Sensitivity Adjustment

You can adjust the PIR sensor’s sensitivity by turning the variable resistor or potentiometer located on the sensor. This adjustment allows you to change the motion detection range from 3 meters to 7 meters. Rotating the potentiometer clockwise increases the sensitivity, while turning it counterclockwise decreases it.

Time-Delay Adjustment

The sensor’s other potentiometer allows us to change the period for which the output will stay high whenever motion is detected. So turning the potentiometer in a clockwise direction increases the delay, and decreases the delay when it is in an anticlockwise direction.

How HC SR501 PIR Sensor Work?

The HC-SR501 PIR sensor’s working principle is to detect changes in IR radiation from objects in its field of view. These changes can be converted into a digital output signal. This PIR sensor is responsive to changes in the amount of IR radiation it gets. The Fresnel lens of this sensor concentrates the IR radiation onto the pyroelectric sensor. This sensor’s output pin provides a signal when motion is detected.

Difference between HC SR501 and HC SR505 PIR Sensors

The HC-SR501 and HC-SR505 PIR motion sensors differ in functionality, size, and range as detailed below.

HC SR501

HC SR505

The HC-SR501 sensor has a broader detection range of around 7 meters. The HC-SR505 sensor has a shorter range, around 3 to 4 meters.
This sensor allows adjustable triggering modes. This sensor defaults to frequent triggering.
It allows for adjustable delay times in between triggers. This sensor has a fixed delay.
This sensor potentially needs more power. It has less power consumption.
These are more expensive. These are less expensive.
The HC-SR501 sensor is the better choice if you require a wider detection range & the capacity to change delay time and sensitivity. The HC-SR505 sensor is suitable if you require a tiny, simple-to-use sensor with fixed settings and a shorter range.

HC SR501 PIR Sensor Interfacing with Arduino & Buzzer

The diagram below illustrates how to interface the HC-SR501 PIR sensor with an Arduino UNO. Here, the HC-SR501 sensor detects motion through emitted IR signals by human beings or animals to make it perfect for applications like automated lighting, motion-activated devices, and security systems.

This setup covers the fundamental concepts of connecting the HC-SR501 sensor to the Arduino UNO board. The code processes the PIR sensor’s signals, activating a buzzer and an LED whenever it detects motion. In this way, the PIR sensor serves as the core component of a motion-triggered alarm system.

Components & Connections

The required components to make this interfacing include an Arduino UNO board, an HC-SR501 PIR sensor, a 5V buzzer, an LED, a 220-ohm resistor, a Type C USB cable, a breadboard, and connecting wires. The connection of the HC-SR501 sensor with an Arduino board is a straightforward procedure that involves basic connections and easy programming.

HC SR501 PIR Sensor Interfacing with Arduino & Buzzer
HC SR501 PIR Sensor Interfacing with Arduino & Buzzer

The connections of this interfacing follow as;

  • Connect the HC-SR501 sensor’s VCC pin to the 5Volts pin of the Arduino.
  • The GND pin of the sensor is connected to the GND pin of the Arduino.
  • Connect the sensor’s OUT pin to a digital input pin of the Arduino board.
  • Connect one of the LED terminals to Arduino’s GND and buzzer terminal.
  • LED’s other terminal is connected to digital pin 3 of Arduino through a resistor.
  • Connect another terminal of the buzzer to the digital pin 4 of the Arduino board.

Code:

The required code for this interfacing includes the following.

// Define PINs for the PIR sensor, LED, and Buzzer
const int pirPin = 2;
const int ledPin = 3;
const int buzzerPin = 4;
// Declare and initialize a variable to hold the state of the PIR sensor
int state = 0;
// Setup function to initialize pin modes and start serial communication
void setup()
{
pinMode(pirPin, INPUT); // Set the PIR sensor pin as an input
pinMode(ledPin, OUTPUT); // Set the LED pin as an output
pinMode(buzzerPin, OUTPUT); // Set the Buzzer pin as an output
Serial.begin(9600); // Initialize serial communication at 9600 baud rate
// Initialize LED and Buzzer in the OFF state
digitalWrite(ledPin, LOW);
digitalWrite(buzzerPin, LOW);
}
// Function to play a melody
void playMelody() {
// Melody notes: frequencies in Hz (example: C4, D4, E4, …)
int melody[] = {262, 294, 330, 349, 392, 440, 494};
int noteDurations = 200; // Duration for each note

// Play each note in the melody array
for (int thisNote = 0; thisNote < 7; thisNote++) {
tone(buzzerPin, melody[thisNote]);
delay(noteDurations);
noTone(buzzerPin); // Stop playing the note
}
}
// Main loop function
void loop()
{
state = digitalRead(pirPin); // Read and update the state of the PIR sensor

if (state == HIGH) // Check if the PIR sensor detects movement
{
Serial.println(“Somebody here!”); // Output a message to the serial monitor
digitalWrite(ledPin, HIGH); // Turn ON the LED
playMelody(); // Play melody on the Buzzer
delay(50); // Brief delay for stability
}
else // No movement detected
{
Serial.println(“Monitoring…”); // Output a monitoring message to the serial monitor
digitalWrite(ledPin, LOW); // Turn OFF the LED
noTone(buzzerPin); // Ensure the Buzzer is OFF
delay(100); // Longer delay during idle state
}
}

Working

The code above reads the digital input pin state connected to the sensor’s output and prints a message on the serial monitor when it detects motion. After uploading this code to the Arduino UNO, the device is ready for testing. When no object is in front of the PIR sensor, it displays the monitoring position. To test motion detection, simply place an object or wave a hand in front of the sensor, and the serial monitor will indicate the motion status.

In addition to testing the HC-SR501 PIR sensor, you can design a motion-triggered alarm by connecting an LED and a buzzer. When the sensor detects motion, it sends a signal to the Arduino board, activating both the LED and the buzzer. These will remain active for a short period, even after the motion stops.

Advantages & Disadvantages

The advantages of the HC SR501 PIR sensor include the following.

  • The HC-SR501 sensor is affordable and simple to use.
  • Its motion detection is effective.
  • This sensor is used in versatile applications.
  • This PIR sensor contains integrated signal processing circuitry that filters out noise and ensures constant motion detection output.
  • It has adjustable parameters like sensitivity & delay.
  • This sensor operates in a wide range of temperatures.
  • It draws < 2mA of current supply.
  • Motion detection is reliable.
  • It can be used as a standalone unit or integrated into bigger systems for superior functionalities.

The disadvantages of the HC SR501 PIR sensor include the following.

  • PIR sensors detect changes in IR radiation, thus, they are not perfect for detecting immobile objects or extremely slow movements.
  • Environmental factors can cause false triggers.
  • High ambient temperature reduces the sensitivity of the sensor.
  • This sensor might not detect movement in some cases, which leads to missed detections.
  • Its effective operation depends on a clear line of sight.
  • This sensor can be defective because of sunlight, RF interference, and temperature changes, which lead to false alarms.
  • These sensors have less coverage and lower sensitivity.
  • These sensors struggle to detect extremely slow-moving objects.
  • PIR sensors can be ineffective at >35 degrees Celsius.

Applications

The applications of the HC SR501 PIR sensor include the following.

  • You can incorporate the HC SR501 PIR sensor into alarm systems to detect unauthorized movement or intruders.
  • It also fits seamlessly into various home automation systems, enabling functions like opening doors, adjusting environmental settings, or controlling appliances.
  •  This sensor in robotics projects detects human presence or movement for various tasks.
  • Additionally, industries use this PIR sensor to control different processes based on motion detection.
  • This sensor automatically turns on and off lights based on motion detection to save energy & provide convenience.
  • Its applications involve entryway lighting, automatic ticket gates, and even hand dryers or automated sinks.

Please refer to this link for the HC SR501 PIR sensor Datasheet.

This is an overview of the HC SR501 PIR sensor, its working, and its applications. These sensors are affordable, versatile, and reliable; thus, they provide outstanding performance for different motion detection applications. Here is a question for you: What is the HC SR501 PIR sensor detection range?