The HC-SR501 is a passive infrared (PIR) motion sensor module with a BISS0001 controller, a Fresnel lens and a simple 3-pin digital output.
It detects movement of warm bodies such as people and animals up to about 3–7 m, and sets its OUT pin HIGH (3.3 V) when it sees motion. It works with Arduino, ESP32, Raspberry Pi Pico and Raspberry Pi without a library, and has onboard controls for range, hold time and trigger mode.
Why choose it
- Three wires, no library — VCC, OUT and GND, and one digital input pin reads the result.
- Wide supply range — runs from 4.5 V to 20 V DC, so a 5 V Arduino, ESP32 or Pico USB supply works.
- Adjust it on the board — two potentiometers set the range and the hold time, and a jumper selects single or repeatable trigger.
Specifications
| Core | |
|---|---|
| Sensor type | Passive infrared (PIR), pyroelectric |
| Controller | BISS0001 |
| Lens | Fresnel dome |
| Sensing range | 3–7 m, adjustable with the sensitivity pot |
| Trigger modes | L = single trigger, H = repeatable trigger |
| Block (lockout) time | 2.5 s default |
| Warm-up time | About 1 minute after power-up |
| Power and output | |
| Supply voltage | 4.5–20 V DC |
| Output signal | Digital: HIGH 3.3 V when motion is detected, LOW 0 V otherwise |
| Hold time | Adjustable with the delay pot |
| Physical | |
| Pins | 3-pin header: VCC, OUT, GND |
| Board size | Approx. 32 × 24 mm |
Compatibility
| Platform | Works | Notes |
|---|---|---|
| Arduino UNO / Nano (5 V) | ✓ Yes | Power VCC from 5V. The 3.3 V OUT reads as HIGH on a digital pin. |
| ESP32 / ESP8266 (3.3 V) | ✓ Yes | Power VCC from the 5 V pin (the module needs at least 4.5 V). OUT is 3.3 V, safe for the GPIO. |
| Raspberry Pi (40-pin header) | ✓ Yes | Power VCC from a 5 V pin. OUT is 3.3 V, safe for the GPIO. |
| Software | No library needed | Read the OUT pin with digitalRead() or Pin.value() |
In the box
- 1 × HC-SR501 PIR motion sensor module
Applications
- Motion-activated lights, for example switching an LED or a relay module on when someone enters a room
- Simple intruder or entry alarms with a buzzer
- Presence detection for Arduino, ESP32 and Raspberry Pi Pico projects
Tutorial
What you'll build: A motion detector that prints "Motion detected!" on your computer whenever someone moves in front of the sensor. · About 15 minutes (plus about 1 minute for the sensor to warm up).
Choose your board
| Board | Logic voltage | Pins used | Language | Best for |
|---|---|---|---|---|
| Arduino UNO | 5 V | D2 | C++ (Arduino IDE) | First-timers |
| ESP32 | 3.3 V | GPIO27 | C++ (Arduino IDE) | Projects that will later add Wi-Fi |
New to this? Start with the Arduino UNO.
How it works
A PIR (passive infrared) sensor does not send anything out. It watches for changes in the infrared heat it sees through the white dome (a Fresnel lens). When a warm body such as a person moves across its view, the BISS0001 chip on the board sets the OUT pin HIGH. Your board only has to read that one pin.
- VCC — power in. This module needs 4.5–20 V, so use the 5 V pin.
- GND — the return path for the electricity. Every GND must be joined.
- OUT — the signal wire. HIGH (3.3 V) means motion, LOW (0 V) means no motion.
Adjust the module
| Control | What it does | How to use it |
|---|---|---|
| Sensitivity pot | Sets how far the sensor reaches (about 3–7 m) | Turn clockwise for a longer range. On the board diagram it is the right-hand pot with the pins facing you. |
| Delay pot | Sets how long OUT stays HIGH after motion | On the board diagram it is the left-hand pot. Turn it a little at a time and test. |
| Trigger jumper (L / H) | L = single trigger, H = repeatable trigger | H keeps OUT HIGH while motion continues. Use H for most projects. |
After you power it up, wait about 1 minute and keep still: the sensor needs this time to settle, and OUT can switch on and off a few times during it.
You need: Arduino UNO R3, USB cable, 3 jumper wires (female-to-male, or male-to-male with a breadboard)
■ Power ■ GND ■ Signal (OUT) ⌒ = wires cross, not connected
| # | Arduino UNO pin | → | Module pin | Wire colour | Notes |
|---|---|---|---|---|---|
| 1 | 5V | → | VCC | Red | Module needs 4.5–20 V, so power it from 5V |
| 2 | D2 | → | OUT | Yellow | Digital input. HIGH = motion |
| 3 | GND | → | GND | Black | Common ground |
Watch out: Check the pin labels printed on your board. The HC-SR501 labels (VCC, OUT, GND) are on the board next to the pin header. The UNO has 5 V logic and the module OUT is 3.3 V, which the UNO reads as HIGH.
Download and install the Arduino IDE (free). Plug the UNO into your computer with a data USB cable, then pick Tools → Board → Arduino UNO and Tools → Port.
Unplug the USB cable first. Connect the three wires as in the diagram and table, then plug the USB cable back in.
Paste the sketch below into a new sketch, press Upload (the arrow button), then open Tools → Serial Monitor and set it to 115200 baud.
▸ Example 1 — Motion detector (Serial Monitor)
// Wiring: VCC->5V, OUT->D2, GND->GND
const int PIR_PIN = 2; // OUT pin of the HC-SR501 (matches the pin table)
const int WARM_UP_SECONDS = 60; // you can change this (the sensor needs about a minute to settle)
int lastState = LOW;
void setup() {
Serial.begin(115200); // Serial Monitor speed
pinMode(PIR_PIN, INPUT); // OUT is a 3.3 V digital signal
Serial.println("OK - epartners.co.nz test");
Serial.println("Warming up... keep still for about 60 seconds");
delay(WARM_UP_SECONDS * 1000UL); // wait for the sensor to settle
Serial.println("Ready");
}
void loop() {
int state = digitalRead(PIR_PIN); // HIGH = motion detected
if (state != lastState) { // print only when the state changes
if (state == HIGH) {
Serial.println("Motion detected!");
} else {
Serial.println("Motion ended");
}
lastState = state;
}
delay(50); // small pause, you can change this
}
✓ Check: Serial Monitor shows "OK - epartners.co.nz test" once, then "Ready" after about 60 seconds. Wave your hand in front of the dome and you see "Motion detected!"; stay still and, after the delay, you see "Motion ended".
You need: ESP32 DevKitC V4 (or similar ESP32 board), USB cable, 3 jumper wires
■ Power ■ GND ■ Signal (OUT) ⌒ = wires cross, not connected
| # | ESP32 pin | → | Module pin | Wire colour | Notes |
|---|---|---|---|---|---|
| 1 | 5V | → | VCC | Red | 5 V from the USB-powered 5V pin. The module will not run from 3V3 (minimum 4.5 V) |
| 2 | GPIO27 | → | OUT | Yellow | Digital input. The module OUT is already 3.3 V, safe for ESP32 |
| 3 | GND | → | GND | Black | Common ground |
Watch out: ESP32 pins are 3.3 V only. Never feed a 5 V signal straight into a GPIO. Power the module from the 5V pin (it needs at least 4.5 V). Check the pin labels printed on your board.
Install the Arduino IDE. Open File → Preferences, paste
https://espressif.github.io/arduino-esp32/package_esp32_index.json into "Additional boards manager URLs" (see the official install guide). Then Tools → Board → Boards Manager, search "esp32" and install esp32 by Espressif Systems.Tools → Board → esp32 → ESP32 Dev Module, then Tools → Port. If no port appears, try another data USB cable.
Unplug the USB cable. Connect the three wires as shown, then plug the USB cable back in.
Paste the sketch below and press Upload. If the upload fails or stops part-way, set Tools → Upload Speed → 115200 and upload again. Then open Tools → Serial Monitor at 115200 baud.
▸ Example 1 — Motion detector (Serial Monitor)
// Wiring: VCC->5V (5V pin), OUT->GPIO27, GND->GND
const int PIR_PIN = 27; // OUT pin of the HC-SR501 (matches the pin table)
const int WARM_UP_SECONDS = 60; // you can change this (the sensor needs about a minute to settle)
int lastState = LOW;
void setup() {
Serial.begin(115200); // Serial Monitor speed
pinMode(PIR_PIN, INPUT); // OUT is a 3.3 V digital signal
Serial.println("OK - epartners.co.nz test");
Serial.println("Warming up... keep still for about 60 seconds");
delay(WARM_UP_SECONDS * 1000UL); // wait for the sensor to settle
Serial.println("Ready");
}
void loop() {
int state = digitalRead(PIR_PIN); // HIGH = motion detected
if (state != lastState) { // print only when the state changes
if (state == HIGH) {
Serial.println("Motion detected!");
} else {
Serial.println("Motion ended");
}
lastState = state;
}
delay(50); // small pause, you can change this
}
✓ Check: Serial Monitor shows "OK - epartners.co.nz test" once, then "Ready" after about 60 seconds. Wave your hand in front of the dome and you see "Motion detected!", then "Motion ended" after the delay.
Troubleshooting
| Board | Problem | Likely cause | Fix |
|---|---|---|---|
| All | OUT goes HIGH by itself right after power-up | The sensor is still warming up | Wait about 1 minute and keep still while it settles. |
| All | Nothing is detected | Wires on the wrong pins, or VCC not connected to 5 V | Check the three wires against the pin table. The module needs at least 4.5 V on VCC. |
| All | OUT stays HIGH for a long time | Delay pot set high, or other heat sources in view | Turn the delay pot down a little. Aim the dome away from heaters, vents and sunny windows. |
| All | It detects too far or too short | Sensitivity pot setting | Turn the sensitivity pot clockwise for longer range, anticlockwise for shorter. |
| All | Wrong reading from the pins | Pin order mixed up | Use the labels VCC, OUT and GND printed on the board, next to the pin header. |
| ESP32 | Upload fails or stops part-way | Upload speed too high for the USB cable or USB chip | Tools → Upload Speed → 115200, then upload again. |
| ESP32 | Stuck on "Connecting…" | Board not in upload mode | Hold the BOOT button until uploading starts. |
Try next: Switch a relay module or an LED when motion is detected, or add a buzzer for a simple alarm.
Spotted a problem in this tutorial? Email support@epartners.co.nz and we'll check it and update the tutorial.
- Give the sensor about 1 minute to settle after power-up before you test it.
- Power VCC with 4.5–20 V. It will not run reliably from a 3.3 V pin.
- Keep it away from heaters, vents and direct sunlight, which can trigger false detections.
Datasheet
Key figures from the manufacturer's datasheet for the BISS0001, the PIR controller IC on this module. Module-level figures such as supply voltage and sensing range are in the Specifications table above.
| BISS0001 PIR controller | |
|---|---|
| Type | Micro power PIR motion detector IC (CMOS) |
| Output (VO) | Active high |
| Output current | 10 mA at Vdd = 5 V (absolute maximum) |
| Trigger modes | Retriggerable (A = 1) and non-retriggerable |
| Output delay time | Tx ≈ 24576 × R10 × C6 |
| Blocking time | Ti ≈ 24 × R9 × C7 |
| Trigger enable (VC) | Enabled above 0.2 Vdd, disabled below 0.2 Vdd |
| Input voltage | Vss − 0.3 V to Vdd + 0.3 V (absolute maximum) |
| Operating temperature | −20 °C to +70 °C |
| Storage temperature | −40 °C to +125 °C |
Download the BISS0001 datasheet (PDF, 135 KB)
▸ Preview the datasheet
If the preview does not load on your device, use the download link above.
Source: BISS0001 Micro Power PIR Motion Detector IC datasheet (copy hosted by Makerguides).
Resources
- HC-SR501 Arduino tutorial (Makerguides)
- HC-SR501 module overview (ProtoSupplies)
- Arduino IDE
- ESP32 Arduino core install guide
Which one should I choose?
| Product | Key difference | Best for |
|---|---|---|
| This product: HC-SR501 | Adjustable range (3–7 m) and hold time, selectable trigger mode, 4.5–20 V supply | General motion projects where you want to tune the sensor |
| PIR - AM312 | Much smaller board (10 × 8 mm), 2.7–12 V supply, 3–5 m range, fixed 2 s delay (per product page) | Small, low-power builds |
| PIR - HC-SR505 | Mini board (10 × 23 mm), 3 m range, 4.5–20 V supply (per product page) | Tight spaces that still use a 4.5–20 V supply |
| RCWL-0516 Microwave Radar | Microwave Doppler radar instead of infrared, 4–28 V supply (per product page) | Detecting motion through thin non-metal covers |
FAQ
▸ Can I power the HC-SR501 from 3.3 V?
No. The module needs 4.5–20 V on VCC, so power it from 5 V. The OUT signal is still 3.3 V, so it is safe for 3.3 V boards such as the ESP32 and Raspberry Pi Pico.
▸ Why does it trigger when I first power it on?
The sensor needs about 1 minute to settle after power-up, and OUT can switch on and off a few times during that time. Wait about a minute, keeping still.
▸ What is the difference between the L and H jumper settings?
L is single trigger and H is repeatable trigger. In H mode, OUT stays HIGH while motion continues.
▸ Does it need a library?
No. OUT is a plain digital signal, so digitalRead() on Arduino and ESP32 or Pin.value() on MicroPython is all you need.
Technical question about this part? Email support@epartners.co.nz with your board and wiring, and we'll help you get it working.
Shipping: $5.99 urban, $9.99 rural. Free shipping on orders of $100 or more.
Order by 10:30am (NZT), Monday to Friday, and we dispatch the same day. Orders placed after 10:30am, on weekends or on public holidays are dispatched the next business day.
Delivery usually takes 1–2 business days after dispatch (2–3 for rural addresses). See our Shipping Policy for full details.