HC-SR501 PIR Sensor With Arduino
by Rachana Jain in Circuits > Arduino
164 Views, 2 Favorites, 0 Comments
HC-SR501 PIR Sensor With Arduino

A PIR sensor (Passive Infrared Sensor), also known as a Pyroelectric or PIR motion sensor, is used to detect motion and the presence of a subject within its field of view. These sensors are widely used in security alarm systems, automatic doors, and lighting automation.
The HC-SR501 is a popular and easy-to-use PIR motion sensor that can be interfaced with an Arduino. In this tutorial, we will explore how the HC-SR501 sensor works and how to connect and use it with an Arduino to detect motion.
Supplies
- Arduino UNO R3
- 16 x 2 LCD
- 10 kΩ Potentiometer
- 220 Ω Resistance
- Full Size Bread board
- HC-SR501 PIR Sensor
- Connecting Wires
How Does a PIR Sensor Work?


The PIR sensor operates by detecting infrared (IR) radiation emitted by objects. Every object with a temperature above absolute zero (-273°C) emits IR radiation. Human bodies, due to body heat, emit detectable levels of infrared radiation.
Unlike active sensors, PIR sensors do not emit any radiation; they only detect infrared radiation from their surroundings.
Key Components of a PIR Sensor
- Pyroelectric Sensor: This is the core component that senses changes in infrared radiation levels. When a warm object like a human body enters or moves within its detection range, the sensor detects the change in IR radiation.
- Fresnel Lens: This lens focuses infrared rays onto the pyroelectric sensor and increases the sensor’s coverage area. It plays a crucial role in improving detection range and sensitivity.
HC-SR501 PIR Motion Sensor Module Pinout

The HC-SR501 PIR sensor module features three pins for connection:
VCC: This pin is used to supply power to the sensor. It accepts an input voltage ranging from 4.5V to 12V, though it is most commonly powered with a 5V source.
GND: This is the ground pin and should be connected to the ground (0V) of the power supply.
OUT: This is the output pin of the sensor. It delivers a digital signal that indicates motion detection. When motion is detected, the pin outputs a HIGH signal (typically 3.3V or 5V). If no motion is detected, the output remains LOW (0V).
Wiring HC-SR501 PIR Sensor to Arduino

.jpeg)

Now, let’s learn how to interface the HC-SR501 PIR motion sensor with an Arduino UNO microcontroller.
As shown in the wiring diagram below, connecting the PIR sensor to the Arduino is quite simple. The sensor’s output pin is connected to digital pin 2 of the Arduino. Additionally, a 16×2 LCD display is connected to show messages indicating whether motion is detected or no motion is present.
Code
Upload the following code:
To learn more checkout: How to Interface HC-SR501 PIR Sensor with Arduino