The standard wiring diagram for a PIR sensor (specifically the ubiquitous HC-SR501) to a 3.3V microcontroller like the ESP32 requires exactly three physical connections: VCC to a 5V source, GND to the system common ground, and OUT to a 3.3V-tolerant GPIO pin. While the physical wiring is simple, understanding the internal node trace and the specific voltage quirks of the sensor's output stage is what separates a reliable motion-triggered project from one that suffers from phantom triggers and brownouts.
This guide walks through the exact terminal mappings, traces the electrical path from source to load, and provides a strict multimeter verification protocol to ensure your connections are solid before you write a single line of firmware.
Decoding the PIR Sensor Wiring Diagram Symbols and Terminals
Before running jumper wires, you must identify the physical terminals on the module. The HC-SR501 features a 3-pin male header. Looking at the module with the pins pointing downward and the front of the Fresnel lens facing you, the pins are typically arranged as OUT (left), VCC (middle), and GND (right). However, because these modules are manufactured by various overseas fabricators, always verify the silkscreen printed on the PCB rather than relying solely on pin position.
In standard electrical schematics, these terminals are represented by specific symbols: VCC is denoted by a solid line with a + or VCC label, GND uses the standard three-line descending earth/chassis ground symbol (⏚), and the OUT pin is shown with an arrow pointing away from the sensor block, indicating a digital push-pull output.
| Terminal / Component | Schematic Symbol | Nominal Voltage / Value | Function and Internal Path |
|---|---|---|---|
| VCC (Power) | + or VCC |
4.5V to 20V (5V ideal) | Feeds the onboard AMS1117-3.3 LDO, which steps down voltage for the BISS0001 processing IC. |
| GND (Ground) | ⏚ or GND |
0V (Common) | System common ground. Must be physically bonded to the microcontroller's GND plane. |
| OUT (Signal) | → or OUT |
0V (Low) / ~3.3V (High) | Digital output driven by BISS0001 Pin 2. Goes HIGH when infrared threshold is crossed. |
| Delay Time Pot (Tx) | Variable Resistor | 0.3s to 200s | Adjusts how long the OUT pin stays HIGH after motion ceases. Set via physical screwdriver. |
| Sensitivity Pot (Sx) | Variable Resistor | 3m to 7m range | Adjusts the comparator threshold for the pyroelectric sensor. Clockwise increases range. |
A common point of confusion is why a 5V-powered sensor can connect directly to a 3.3V ESP32 GPIO. When the HC-SR501 is powered by 5V, its internal circuitry naturally clamps the HIGH output voltage to approximately 3.3V to 3.4V. While this is generally safe for ESP32 inputs, if you are powering the sensor at higher voltages (e.g., 12V), you must use a voltage divider (e.g., 10kΩ and 22kΩ) on the OUT pin to protect the ESP32 from overvoltage damage.
Node-by-Node Trace: Power, Ground, and Signal Paths
A wiring diagram is only as good as your understanding of the current path. Here is the exact node-by-node trace from the power source through the sensor and into the microcontroller.
1. The Power Path (Source to IC)
- Source: 5V rail (from ESP32
VIN/5Vpin or an external USB power supply). - Conductor: Red jumper wire.
- Module Entry: HC-SR501
VCCpin. - Internal Routing: Current flows into the input of the onboard AMS1117-3.3 linear voltage regulator.
- Load: The regulated 3.3V feeds the
VDDpin (Pin 16) of the BISS0001 analog/digital signal processing IC, powering the internal op-amps and logic gates.
2. The Ground Path (Return Loop)
- Source: Power supply GND or ESP32
GNDpin. - Conductor: Black jumper wire.
- Module Entry: HC-SR501
GNDpin. - Internal Routing: Connects to the module's copper pour ground plane.
- Load: Ties directly to the
VSSpin (Pin 8) of the BISS0001 IC and the ground reference for the pyroelectric sensor's JFET amplifier.
Critical Ground Rule: The ESP32 and the PIR sensor must share the exact same ground potential. If you power the ESP32 from your laptop USB and the PIR sensor from a separate 5V wall wart, you must run a dedicated GND wire between the two power supplies. A missing common ground is the #1 cause of erratic, floating GPIO readings in PIR circuits.
3. The Signal Path (Sensor to Microcontroller)
- Source: BISS0001 IC
OUTpin (Pin 2) goes HIGH when the internal comparator detects a valid infrared differential. - Module Exit: HC-SR501
OUTheader pin. - Conductor: Orange or Yellow jumper wire.
- Microcontroller Entry: ESP32 GPIO pin (e.g.,
GPIO 14). - Internal Routing: The signal passes through the ESP32's input mux to the GPIO matrix, triggering a digital read or hardware interrupt.
ESP32 Pin Mapping and Verification with a Multimeter
When translating the schematic to a physical breadboard, use the following mapping for a standard 30-pin ESP32 DevKit V1. For deeper integration details, refer to the official Espressif ESP32 GPIO documentation.
| ESP32 Pin | Wire Color | HC-SR501 Pin | Notes |
|---|---|---|---|
VIN or 5V |
Red | VCC | Do not use 3V3; the sensor needs ≥4.5V to operate reliably. |
GND |
Black | GND | Any of the ESP32 GND pins will work; ensure a tight breadboard fit. |
GPIO 14 |
Orange | OUT | GPIO 14 is a safe input-only capable pin. Avoid strapping pins like GPIO 0, 2, or 12. |
Multimeter Verification Protocol
Before uploading your Arduino or ESP-IDF code, verify the physical layer. Grab your digital multimeter (DMM) and follow this sequence to catch wiring faults early. For more on how PIR sensors process these signals internally, Adafruit's PIR Sensor Guide provides excellent background on the pyroelectric effect.
- Continuity Check (Power OFF): Set your DMM to continuity mode (the diode/sound symbol). Place one probe on the ESP32 GND pin metal and the other on the HC-SR501 GND pin metal. You should hear a beep and read
< 1.0 Ω. If it reads OL (Open Loop), your ground wire is broken or not seated in the breadboard. - Supply Voltage Check (Power ON, No Motion): Set DMM to DC Voltage. Place the red probe on the HC-SR501 VCC pin and the black probe on GND. You must read between
4.8V and 5.2V. If you read 3.3V, you have mistakenly plugged VCC into the ESP32's 3V3 pin, and the sensor will not trigger. - Quiescent Signal Check (Power ON, No Motion): Move the red probe to the HC-SR501 OUT pin (black stays on GND). The meter should read
0.0V to 0.1V. If it reads a floating voltage (e.g., 1.4V), your OUT wire is disconnected from the ESP32 GPIO. - Trigger Test (Power ON, Wave Hand): Keep the probes on OUT and GND. Wave your hand in front of the Fresnel lens. The DMM should jump to
3.2V - 3.4Vand hold there for the duration set by the Delay Time potentiometer. If it jumps to 5V, your specific module lacks the internal clamping diode, and you must immediately power down and install a voltage divider to prevent frying your ESP32.
If your multimeter shows the OUT pin flickering rapidly between 0V and 3.3V without any human motion, you are experiencing RF interference or a ground loop. The BISS0001 IC is highly sensitive to Wi-Fi transmission spikes. To fix this, solder a 100nF (0.1µF) ceramic capacitor directly across the VCC and GND pins on the PIR sensor PCB, and ensure your ESP32 Wi-Fi antenna is at least 5cm away from the sensor dome.
By treating the wiring diagram not just as a visual map, but as a verifiable electrical path, you eliminate the most common hardware bugs before you even open your IDE. Once your multimeter confirms a clean 0V-to-3.3V transition on GPIO 14, your hardware layer is proven, and you can confidently move on to writing your interrupt-driven motion detection firmware.






