The standard hobbyist PIR (Passive Infrared) sensor, such as the HC-SR501 or AM312, uses a simple 3-pin layout: VCC, OUT, and GND. Commercial hardwired security PIRs (like the Bosch DS938Z or Honeywell IS335) expand this to 4-6 pins, adding normally-closed (NC) relay contacts for the alarm loop and a tamper switch. Below is the master reference table for identifying these pins, their logic levels, and the wire color conventions across different standards.

Master PIR Sensor Pinout & Color Code Reference
Pin Label Function Typical Voltage / Logic Hobbyist Wire Color (Dupont) Commercial Wire Color (NEC / IEC)
VCC / +12V Power Supply Input 5V (Hobby) / 12VDC (Commercial) Red Red (NEC) / Brown (IEC)
GND / 0V Ground / Common Return 0V Black Black (NEC) / Blue (IEC)
OUT / Alarm Motion Trigger Signal (Active HIGH or NC Relay) 3.3V or 5V Digital / Dry Contact Yellow, White, or Orange White or Yellow (NEC) / Black (IEC)
TAMPER (NC) Anti-tamper switch (opens if cover removed) Dry Contact (12V loop) N/A (Not on hobby boards) Green or Violet (NEC) / Green/Yellow (IEC)
COM (Relay) Common pin for Form C relay (Commercial only) Dry Contact N/A Spliced with Alarm or Tamper return
SDA / SCL I2C Data/Clock (Smart PIRs like Panasonic PaPIRs) 3.3V Logic Blue (SDA) / Green (SCL) N/A

Decoding the Standards: Hobbyist vs. Commercial Wiring

When wiring a PIR sensor, the physical pinout is only half the battle; the color of the wire you pull through the wall or breadboard dictates how the next technician (or you, six months later) will interpret the circuit. The conventions split sharply between low-voltage DC hobbyist setups and hardwired security installations.

Hobbyist & Maker Standard (Dupont/Breadboard):
In the Arduino and ESP32 ecosystem, the de facto standard follows generic jumper wire coloring: Red for VCC, Black for GND, and Yellow/Orange/White for signal (OUT). This is universally understood on the bench but holds zero legal or code weight in a building installation.

US NEC Article 725 (Class 2 / Class 3 Low Voltage):
For commercial alarm panels in the United States, the National Electrical Code (NFPA 70) governs low-voltage power-limited circuits. Standard 4-to-6 conductor alarm cable (often 22 AWG stranded) uses a specific color sequence: Red (+12V), Black (Ground), White/Yellow (Data or Alarm Relay), and Green/Blue (Tamper or secondary zone). If you are wiring a commercial PIR to a DSC or Honeywell Vista panel, the White wire typically carries the Alarm loop return, and Green carries the Tamper loop.

IEC 60446 & Old UK Alarm Standards:
In the EU, IEC 60446 dictates Brown for line/positive and Blue for neutral/ground in AC, which often translates to Brown (+12V) and Blue (0V) in DC security panels. However, legacy UK alarm installations frequently used a 6-core cable with a different schema: Red (+12V), Black (0V), Yellow and Blue for the Alarm pair, and White and Green for the Tamper pair. If you are retrofitting a PIR in an older European or UK property, always trace the pairs back to the alarm control panel's zone terminal block rather than trusting the jacket colors blindly.

The 'Rows People Get Wrong' Troubleshooting Notes

Even with the table above, three specific PIR pinout misinterpretations cause 90% of the fried microcontrollers and false alarms we see on the bench.

WARNING: The 3.3V vs 5V Logic Trap (HC-SR501 & ESP32)
The HC-SR501 module includes an onboard LDO (low-dropout regulator, typically a 7133) that steps the 5V input down to 3.3V for the BISS0001 timing chip. On paper, this means the OUT pin outputs a 3.3V HIGH signal, making it 'ESP32 safe'. However, many cheap clone boards bypass this LDO or use a 5V regulator. If you feed the module 5V and the OUT pin pushes 5V into an ESP32 GPIO, you will degrade or destroy the pin. Always measure the OUT pin voltage with a multimeter relative to GND while triggering the sensor before connecting it to a 3.3V microcontroller. If it reads >3.6V, use a simple voltage divider (e.g., 2kΩ and 3.3kΩ) or a logic level converter.

1. Assuming 'OUT' is an Analog Proximity Signal
The OUT pin on almost all standard PIR modules (including the miniature AM312 and SR602) is strictly digital. It outputs either VCC (or the LDO voltage) when motion is detected, and 0V when clear. It does not output a varying voltage based on how close the person is. If you need proximity scaling, you must use a Time-of-Flight (ToF) sensor or mmWave radar, not a PIR.

2. Miswiring the Tamper Switch on Commercial Units
On commercial PIRs, the Tamper pins are a Normally Closed (NC) dry contact loop. Beginners often wire the Tamper switch in parallel with the Alarm relay, or try to feed 12V directly into the Tamper terminal expecting a voltage output. The Tamper pins are just a mechanical switch. You must wire them in series with the alarm panel's dedicated 24-hour Tamper zone loop, which supplies its own pull-up voltage and monitors for an open circuit (which triggers an immediate tamper alarm).

3. Ignoring the Timing Potentiometers (HC-SR501)
While not strictly 'pins', the two orange trimpots on the HC-SR501 dictate the OUT pin's behavior. The Tx pot sets the delay time (how long OUT stays HIGH after motion stops, from ~0.3s to 200s). The Ti pot sets the blocking time (how long the sensor ignores motion after the delay ends, ~0.2s to 3s). If your ESP32 is logging motion events continuously without clearing, your Tx pot is likely turned to the maximum delay.

Safe Interpretation When Markings Are Faded or Missing

Salvaged PIR modules, commercial sensors exposed to attic heat, or cheap unbranded boards often have silkscreen pin labels that are rubbed off or entirely missing. Never guess the pinout and apply power; a reversed VCC/GND on a commercial PIR will instantly blow the onboard transient voltage suppression (TVS) diode or fry the BISS0001 IC. Use this multimeter decision path to safely identify the pins.

Step 1: Identify Ground (GND / 0V)
Set your multimeter to continuity mode (the diode/beep setting). Place one probe on the metal shielding can of the pyroelectric sensor element (the silver dome under the plastic Fresnel lens) or the USB connector shield if present. Probe the header pins. The pin that reads < 1 ohm (a solid beep) is your Ground. In commercial units, GND will also show continuity to the negative terminal of the main power input screw block.

Step 2: Identify VCC (Power Input)
Look for the voltage regulator (a 3-pin SOT-89 or SOT-223 package) or the main input filtering capacitor (usually a 100µF electrolytic). The positive leg of the input capacitor connects directly to the VCC pin. On commercial boards, trace the red wire from the screw terminal block; it will pass through a fuse or TVS diode before hitting the VCC plane.

Step 3: Identify the OUT / Alarm Pin
Once GND and VCC are isolated, you are left with the signal pins. Set your multimeter to Diode Test mode. Place the black probe on your identified GND pin, and touch the red probe to the remaining unknown pins. The OUT pin will typically show a forward voltage drop of 0.4V to 0.7V because it is tied to the collector or drain of an output transistor (like a 2N7000 MOSFET or an NPN BJT). The Tamper pins (on commercial units) will read as an open circuit (OL) in the resting state, because they are isolated mechanical relay contacts.

By relying on component-level tracing rather than faded silkscreen, you can safely integrate any salvaged PIR sensor into a modern ESP32 or Raspberry Pi project without risking your microcontroller's GPIO bank.