HC-SR501 Pir Motion Sensor Module with Arduino

Introduction

In this tutorial, we learn how to In interfacing HC-SR501 Pir Motion Sensor Module with Arduino, Motion sensors have become an essential component in numerous applications, enabling devices to detect and respond to movement. Among these sensors, the HC-SR501 PIR (Passive Infrared) Motion Sensor Module stands out for its simplicity and effectiveness. In this article, we will explore the capabilities of the HC-SR501 PIR Motion Sensor Module, how it works, and its specifications, and delve into the diverse range of applications it finds itself.

Hardware Required

To utilize the HC-SR501 PIR Motion Sensor Module, you will need the following components:

Components#Buy From Amazon
Arduino UNO1Buy Now
HC-SR501 PIR Motion Sensor Module1Buy Now
Jumper Wires3Buy Now
Breadboard1Buy Now

Understanding PIR Motion Sensor Module

The HC-SR501 PIR Motion Sensor Module is a compact and affordable module that detects infrared radiation emitted by humans or animals in its detection range. It is equipped with a pyroelectric sensor, which converts the infrared energy into an electrical signal that can be processed by a microcontroller or Arduino board. This module is widely used in security systems, automation projects, and energy-saving applications.

Pinout

HC-SR501-Pir-Motion-Sensor-Module-Pinout

Pin Configuration

Pin NamePin Type
VCCPositive supply Pin
GNGGround Pin
OUTData OUT

Specifications

The HC-SR501 PIR Motion Sensor Module typically possesses the following specifications:

  1. Detection range: The module can detect motion within a range of approximately 7-9 meters.
  2. Detection angle: It has a wide-angle lens that allows for a detection range of approximately 120 degrees.
  3. Operating voltage: The module typically operates within a voltage range of 4.5V to 20V.
  4. Adjustable settings: Some versions of the module offer adjustable sensitivity and delay time settings to customize its behavior.

Circuit Setup and Programming:

To use the HC-SR501 PIR Motion Sensor Module with an Arduino Uno, follow these steps:

  1. Connect the VCC pin of the module to the 5V pin on the Arduino Uno.
  2. Connect the GND pin of the module to the GND pin on the Arduino Uno.
  3. Connect the OUT pin of the module to any digital input pin on the Arduino Uno.
  4. Upload a simple Arduino sketch to read the state of the digital input pin connected to the module.
  5. In the sketch, use conditional statements to perform specific actions when motion is detected.

Circuit Diagram

How-HC-SR501-PIR-Sensor-Works-&-Interface-It-With-Arduino-circuit

Circuit Connections

ArduinoModule
+5VVCC Pin
GNDGND Pin
D2OUT

Working Principle

The HC-SR501 PIR Motion Sensor Module utilizes the principle of passive infrared sensing to detect motion. It contains a pyroelectric sensor that can detect changes in the infrared radiation emitted by warm-blooded beings, such as humans or animals, within its range. When motion is detected, the sensor generates an electrical signal, triggering the module’s output pin to switch from low to high, indicating the presence of motion.

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow

Code

//For more Projects: www.arduinocircuit.com

 
int inputPin = 2;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status
 
void setup() {
  pinMode(inputPin, INPUT);     // declare sensor as input
  Serial.begin(9600);
}
 
void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected!");
      // We only want to print on the output change, not state
      pirState = HIGH;
    }
  } else {
    if (pirState == HIGH){
      // we have just turned of
      Serial.println("Motion ended!");
      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }
}

Applications

The HC-SR501 PIR Motion Sensor Module finds its application in various projects, including:

  1. Security systems: It can be used to trigger alarms, notifications, or camera recordings when unauthorized motion is detected.
  2. Home automation: The module can be integrated into lighting or HVAC systems to automatically turn on or adjust settings when someone enters a room.
  3. Energy-saving applications: It can be employed to control lighting or power supply to conserve energy by automatically turning off devices when no motion is detected.
  4. Robotics: The module can be used as a motion detection mechanism in robotics projects, enabling robots to respond to the presence of humans or objects.
  5. Wildlife monitoring: It finds use in wildlife studies and monitoring to detect the movement of animals in their natural habitat.

Conclusion

The HC-SR501 PIR Motion Sensor Module offers a simple and cost-effective solution for motion detection in various projects. With its compact size, adjustable settings, and compatibility with Arduino boards, it opens up a world of possibilities for security, automation, energy-saving, and robotics applications. By incorporating this module into your projects, you can add an extra layer of intelligence and interactivity, making them more efficient and responsive to their surroundings.

Leave a Comment


error: