HC-SR501 Pinout
The output pin is easy to spot since it's right in the middle.
If you're unsure which pin is Ground and which is VCC, you can remove the white dome to check. You can also identify it by looking for the pin next to the protection diode-that's the VCC pin.
Connecting PIR Sensor with ESP32
The sensor operates at 5V, but the ESP32 GPIO pins are 3.3V tolerant. The PIR sensor module outputs 3.3V when motion is detected, so it can be directly connected to the GPIO without any issues. Otherwise, you will need a voltage divider to reduce the voltage to 3.3V.
ESP32 Pin | Wire | PIR Sensor Pin |
---|---|---|
GPIO 33 |
|
OUT (middle pin) |
5V |
|
VCC |
GND |
|
GND |
