Power the PIR from 5 V; its output is about 3.3 V, safe for an ESP32 pin.
What the message means
The module needs more than 3.3 V to run, but its output is a 3.3 V logic level. The hold time keeps the output high for a while after motion.
Fix it in this order
- Connect VCC to 5 V and GND to ground.
- Connect OUT to a normal input pin.
- Let it settle after power-up.
- Set the hold time trimmer short while testing.
- Debounce the output in code.
- Use the repeat trigger jumper setting that suits your project.
Why it happens
The HC-SR501 needs a supply of about 5 V, but its output signal is 3.3 V when active, which an ESP32 input can read safely. Powering it from 3.3 V often makes it unreliable.
Connect VCC to 5 V, GND to ground and OUT to a GPIO pin, and allow a minute for warm-up before trusting the output.
If you see this, do this
| You see | Do this |
|---|---|
| Never goes low | Hold time too long or repeat mode. |
| Does not start on 3.3 V | Needs 5 V. |
Related
PIR false triggers, 5 V sensor on ESP32.
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.
Why this happens
The HC-SR501 has a small regulator and an op-amp stage on the board. The regulator needs more input than 3.3 V to work, which is why the module is specified for roughly 5 V upwards (check your datasheet), while the output pin itself swings to about 3.3 V when motion is detected. That makes the output safe for an ESP32 input, but the VCC pin must come from 5 V (the VIN or 5V pin of the dev board).
Two trimmers and a jumper set the behaviour. One trimmer sets sensitivity, the other the hold time during which the output stays high after a trigger. The jumper selects single trigger or repeat trigger. In repeat mode, every new movement restarts the hold time, so the output may look stuck high.
How to confirm the cause
- Measure VCC at the module with a multimeter. It should be near 5 V, not 3.3 V or 4 V.
- Measure OUT with no motion (about 0 V) and during motion (about 3.3 V).
- Turn the hold trimmer to its shortest setting and see whether the output pulse shortens. If it does, the long high time was settings, not a fault.
- Wait about a minute after power-up. The module is unstable while it settles.
- Check the jumper position. Repeat mode keeps the output high while anything moves.
Worked example
This prints a message each time the output changes, so you can see the hold time directly.
const int PIR = 27; // GPIO27, output of the PIR
void setup() {
Serial.begin(115200);
pinMode(PIR, INPUT);
}
void loop() {
static int last = -1;
int v = digitalRead(PIR);
if (v != last) {
Serial.println(v ? "motion" : "clear");
last = v;
}
delay(50);
}Common mistakes
- Powering VCC from the 3V3 pin because the output is 3.3 V.
- Forgetting the common ground between the module and the ESP32.
- Testing on a desk next to a heater, monitor, or window, where heat changes trigger it.
- Reading the pin once at start-up, before the module has settled.
If this did not fix it
- Check the supply for noise when Wi-Fi transmits; add a capacitor near the module.
- Check sensitivity: too high triggers on air movement.
- Check the lens dome, which must face the area you want to watch.
- Check that the pin you use is not a boot pin that is pulled high or low at start-up.