electronics

Elegoo Pir Sensor Pinout: Wiring And Setup Guide

Getting motion detection working in your DIY electronics project shouldn't require guessing which pin goes where. If you're looking at an Elegoo starter kit and holding an HC SR501 passive infrared se

Elegoo Pir Sensor Pinout: Wiring And Setup Guide
In this story

Getting motion detection working in your DIY electronics project shouldn't require guessing which pin goes where. If you're looking at an Elegoo starter kit and holding an HC-SR501 passive infrared sensor, you'll find a compact board featuring a white Fresnel lens, two orange adjustment potentiometers, and a tiny three-pin header tucked underneath.

The layout is simple once you know the exact pin designations. The sensor exposes three main pins: VCC (power input), OUT (digital signal output), and GND (ground). Supplying 5 volts to the board allows the internal pyroelectric element to track infrared signature changes whenever a warm body crosses its field of view.


Pinout Identification and Board Layout

Pin mapping mistakes can cause silent failures or erratic behavior. Turning the sensor so the plastic dome faces away and looking at the bottom pin header reveals the standard layout, which is typically labeled directly on the PCB silkscreen.

  • VCC (Left Pin): Connects to the positive supply voltage. While the onboard regulator handles an input range from 4.5V up to 20V, running it on the 5V output from an Arduino board ensures stable logic levels.
  • OUT (Center Pin): Delivers a digital signal. It outputs 3.3V (HIGH) when motion is flagged and drops to 0V (LOW) during idle periods. Because the output logic is 3.3V, it interfaces safely with both 5V and 3.3V microcontrollers like the ESP32.
  • GND (Right Pin): Completes the circuit by tying back to the common ground rail of your microcontroller.

Peeling back the white plastic Fresnel lens reveals the dual-element infrared sensor. These two slots alternate balancing ambient room heat. When a warm object moves past, it triggers an electrical imbalance that the onboard BISS0001 controller chip amplifies into a clean digital pulse.


Wiring the Elegoo PIR Sensor to a Microcontroller

Hooking the module up to an Arduino Uno or similar development board requires just three jumper wires.

  1. Run a wire from the sensor's VCC pin to the 5V pin on your board.
  2. Connect the GND pin directly to a GND pin on your microcontroller.
  3. Route the center OUT pin to any available digital input pin, such as Digital Pin 2.

For reliable operation, keep your jumper wires short to minimize electrical noise pick-up. If you're building a wider automated system, you can also check out integration guidelines via official hardware references like the Elegoo Documentation Wiki.


Configuring Sensitivity, Delay, and Trigger Modes

Hardware adjustments on the sensor board alter how long signals stay active and how far the sensor can "see". Two orange dials and a tiny jumper header control these parameters.

Sensitivity Potentiometer

Located closer to the edge of the circuit board, this dial adjusts the physical detection range. Rotating it clockwise increases range up to roughly 7 meters, while turning it counter-clockwise shrinks the coverage down to about 3 meters.

Time Delay Potentiometer

The inner dial controls how long the output pin remains HIGH after motion stops. This duration can be dialed anywhere from roughly 3 seconds up to 5 minutes. Short delays work well for fast diagnostic testing, while longer delays suit automated hallway lighting.

Trigger Mode Jumper

A small black jumper cap sits next to the pins, allowing you to choose between two operational behaviors:

  • Single Trigger (L-Mode): The output goes high for the preset delay period, then drops low. It ignores ongoing motion until that cycle finishes and a brief 3-second blocking period passes.
  • Repeatable Trigger (H-Mode): Every new movement detected resets the timer, keeping the output HIGH continuously as long as activity persists. This mode is the standard choice for security alarms and occupancy lights.

Sample Arduino Code for Motion Detection

Writing code for the sensor is straightforward because it behaves like a standard digital button input. The script below reads the digital state and prints notifications to the serial monitor.

const int pirPin = 2; // Digital pin connected to PIR output
const int ledPin = 13; // Built-in LED for visual feedback

void setup() {
  pinMode(pirPin, INPUT);
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int motionState = digitalRead(pirPin);
  
  if (motionState == HIGH) {
    digitalWrite(ledPin, HIGH);
    Serial.println("Motion detected!");
  } else {
    digitalWrite(ledPin, HIGH ? LOW : LOW); // Keep LED off cleanly
    digitalWrite(ledPin, LOW);
    Serial.println("Area clear.");
  }
  
  delay(200);
}

Troubleshooting Common Issues

Even with correct wiring, PIR sensors can occasionally misbehave. Reviewing these common pitfalls saves hours of debugging:

  • Random False Triggers: Air conditioning vents, direct sunlight hitting the lens, or nearby heating elements will cause false alarms. Position the sensor away from moving air and windows.
  • No Response on Startup: The module requires a 30 to 60-second warm-up phase upon initial power-up to calibrate to ambient room temperatures. Expect erratic signals during this initial window.
  • Output Stuck HIGH: Check if your trigger jumper is set to H-Mode in a busy room, or if your time delay potentiometer is cranked to maximum, which keeps the pin active for minutes at a time.

Frequently Asked Questions

Can this PIR sensor work directly with a 3.3V microcontroller like an ESP8266?

Yes, the output signal is 3.3V, making it logically compatible with 3.3V boards. However, powering the VCC pin with 3.3V instead of 5V can occasionally cause unstable readings because the internal regulator prefers a higher input drop.

Why does the sensor trigger when nobody is in the room?

Infrared sensors detect thermal shifts, not physical bodies. Pets, curtains blowing near a draft, or sudden changes in sunlight can trick the pyroelectric element.

How do I bypass the internal voltage regulator?

Advanced users sometimes solder a wire directly past the onboard regulator to run the module on a strict 3.3V rail, but standard projects should stick to using the 5V input pin as intended.

Can I connect multiple PIR sensors to a single Arduino pin?

Because these sensors use an active output stage, wiring multiple OUT pins directly together can cause signal conflicts. Instead, connect each sensor to its own separate digital input pin or use a diode-OR configuration.

CR

Written by

Chloe Ramirez

Chloe Ramirez excels at making complicated information accessible, turning dense research into clear narratives that engage diverse audiences.

More from electronics