HC-SR505 PIR Sensor : Pin Configuration & Its Applications

HC-SR505 PIR sensor module is a pyroelectric motion sensor. This kind of module is normally used in different applications where the motion of a body needs to be detected which generates IR radiations. This PIR sensor module is mostly applicable in battery-operated systems because it consumes very low power.


This module is available in small size which can be used in applications where the size of a system is the main concern. Generally, all the objects have a temperature that generates heat energy in the IR radiation form. Even human bodies also generate radiations of IR light. This article discusses an overview of an HC-SR505 PIR sensor and its working.

What is HC-SR505 PIR Sensor?

HC-SR505 PIR sensor is a module that works on infrared technology. This sensor is mainly used to sense the object’s motion by measuring the changes within the IR light radiation level which radiates from different objects.

The controlling of this sensor can be done automatically by itself through high reliability and sensitivity. This PIR sensor is used in various automatic electronic devices particularly automatic devices which operate with a battery.

HC-SR505 PIR Sensor
HC-SR505 PIR Sensor

The working principle of the PIR sensor is, once any object approaches the PIR sensor within the detecting range then it gets activated automatically. The output pin of this is connected to GND with the help of a diode in between them. A resistor can also be connected with the LED in series.

Once the PIR sensor senses an object, then the output pin generates 3.3V to make the LED ON. Alternatively, if the PIR sensor does not discover any object, then the output pin will stay at 0 V, so LED will automatically be turned OFF.

Pin Configuration

The pin configuration of the HC – SR505 PIR sensor module is shown below. This sensor includes three pins which are discussed below.

HC - SR505 PIR Sensor Pin Configuration
HC – SR505 PIR Sensor Pin Configuration
  • Pin1 (Ground): To operate this sensor module, pin1 is grounded
  • Pin2 (Signal Output): This pin is used to provide o/p signal
  • Pin3 (Positive power supply): The supply voltage provided to the device is +5V.

Features & Specifications

The features & specifications of the HC – SR505 PIR sensor module include the following.

  • Small size
  • Automatic controlling
  • Trigger is repeatable
  • The operating voltage range is wide
  • Uses less power
  • Automatic induction
  • Generates high signal output
  • The operating voltage range is 4.5V – 20V.
  • The Quiescent current (IQ) is below 60µA.
  • The maximum detecting range is 3 meters
  • The diameter is 10mm
  • The required temperature range is -20 °C to 80 °C.
  • Reusable trigger
  • Default delay time is 8Sec + -30%
  • It gives automatic control through continuous triggering by default.
  • The induction angle is below 100 degrees.
  • Board dimensions are 10 * 23 * 5mm
  • The diameter of a sensor lens is 10mm

The equivalent HC – SR505 PIR sensor is HC-SR01

How to use HC-SR505 PIR Sensor/Circuit Diagram

The interfacing diagram of HC-SR505 PIR Sensor to Arduino UNO is shown below. The required electronic components to use in this circuit mainly include HC-SR501 PIR motion sensor, Arduino Uno Rev3, Breadboard, 10 jumper wires, resistor, LED, passive buzzer, and USB cable.

Interfacing HC-SR505 PIR Sensor with Arduino UNO
Interfacing HC-SR505 PIR Sensor with Arduino UNO

Once the PIN motion sensor is connected to the Arduino UNO then we can control different loads like motors, buzzers, relays, LEDs, and many more. In the following wiring diagram, the connections of interfacing can be observed. Here, the sensor data can be read through one of the GPIO pins of the Arduino board like digital pine2. The pins like VCC & GND are simply connected to 5V & GND correspondingly.

The connections in the above interfacing are as follows”

  • The VCC pin of the PIR sensor is connected to a 5V pin of Arduino UNO board
  • The OUT pin of the PIR sensor is connected to pin2 of the Arduino UNO board
  • The GND pin of the PIR sensor is connected to the GND pin of the Arduino UNO board

Once the connections are made, the following example code needs to be uploaded to the Arduino board. By using the following example code, you can read out the sensor & control the LED on the Arduino board by connecting it to pin 13. The following sample code is simply used to control relays for switching ON/OFF the light.

// Define connection pins:
#define pirPin 2
#define ledPin 13
// Create variables:
int value = 0;
bool motionState = false; // We start with no motion detected.
void setup() {
// Configure the pins as input or output:

pinMode(ledPin, OUTPUT);

pinMode(pirPin, INPUT);
// Begin serial communication at a baud rate of 9600:

Serial.begin(9600);
}
void loop() {
// Read out the pirPin and store as val:
val = digitalRead(pirPin);
// If motion is detected (pirPin = HIGH), do the following:
if (val == HIGH) {

digitalWrite(ledPin, HIGH); // Turn on the on-board LED.
// Change the motion state to true (motion detected):
if (motionState == false) {

Serial.println(“Motion detected!”);

motionState = true;
}
}
// If no motion is detected (pirPin = LOW), do the following:
else {

digitalWrite(ledPin, LOW); // Turn off the on-board LED.
// Change the motion state to false (no motion):
if (motionState == true) {

Serial.println(“Motion ended!”);

motionState = false;
}
}
}

The above code can be uploaded through the Arduino IDE tool. To work this code accurately, the trigger mode jumper needs to be set to ‘H’ by repeating many times. In addition, change the time-delay potentiometer value to the lowest value.

This Arduino code will read the condition of the PIR sensor & control the LED on-board accordingly. Finally, it will print a message on the serial monitor which can be accessed below tools, or press the Ctrl+Shift+M key.

Where to use HC-SR505 PIR Sensor/Applications

The applications of the HC-SR505 PIR sensor module include the following.

  • HC-SR505 PIR sensor module is used in various devices which operate with a battery because of its less power utilization.
  • This sensor is used to detect the motion of an object through IR light radiation
  • These sensors use IR technology to use in light-activated systems & also for safety purposes.
  • Used in motion alarm systems
  • Automatic lighting systems
  • Body induction lamps
  • Used for protection from theft
  • Security devices
  • Beginner projects
  • Automatic control through a battery
  • Automation control in industries
  • Security devices
  • Auto detecting of electrical devices

Please refer to this link to know more about HC-SR505 PIR Sensor Module Datasheet

Thus, PIR modules mainly include two parts like PIR sensor & lens where the sensor used in this module detects IR signals. This sensor module also includes a regulator which is connected to 4.5V to 20V volts. This module is available in small size, inexpensive and reliable, so it can be used in any kind of electrical device. Here is a question for you, what is the full form of a PIR sensor?