Arduino Uno HC-SR501 PIR: Industrial Motion Intelligence

Professional HC-SR501 dual-element pyroelectric infrared sensor detects human thermal signature changes across 110° FOV and 3-7m range using BISS0001 signal processor with adjustable sensitivity and timing pots. Unlike microwave sensors, PIR requires direct line-of-sight but offers superior PET immunity.

Pin 2 interrupt captures 100ms-5s HIGH pulses during motion with 40μA standby, 65μA active consumption. 30s warm-up required for pyroelectric stabilization before reliable detection.

Production Occupancy Sensing Components

  • Arduino UNO R3 interrupt capable (pin 2)
  • HC-SR501 PIR Motion Sensor Module
  • Male-to-male jumper wires (3 pieces)
  • Solderless breadboard prototyping
  • 220Ω relay driver LED/buzzer
  • Ceiling/wall mounting hardware

Minimal 3-Wire Motion Interface

VCC: Arduino 5V (3.3-5V tolerant)

GND: Arduino GND

OUT: Arduino Digital Pin 2 (HIGH = motion)

Sensitivity pot (left): 3m min → 7m max. Time pot (right): 0.5s → 200s retrigger delay.

Program: Arduino Uno HC-SR501 - Occupancy Counter with Dwell Analysis
// Arduino Uno HC-SR501 PIR - Professional Occupancy Detection
// Pin 2: HIGH=motion detected, interrupt driven
const int pirPin = 2;
const int relayPin = 8;
const int statusLed = 13;

volatile unsigned long motionStart = 0;
volatile bool occupancyActive = false;
int occupancyCount = 0;

void setup() {
  Serial.begin(9600);
  pinMode(pirPin, INPUT);
  pinMode(relayPin, OUTPUT);
  pinMode(statusLed, OUTPUT);
  
  attachInterrupt(digitalPinToInterrupt(pirPin), pirISR, RISING);
  
  Serial.println("HC-SR501 PIR Motion Sensor Active");
  Serial.println("3-7m range, 110° FOV - Walk through detection zone");
  delay(30000);  // 30s PIR warm-up
  Serial.println("Warm-up complete - Ready");
}

void loop() {
  if(occupancyActive) {
    unsigned long dwell = millis() - motionStart;
    
    Serial.print("OCCUPANCY #");
    Serial.print(++occupancyCount);
    Serial.print(" | Dwell: ");
    Serial.print(dwell/1000);
    Serial.println("s");
    
    // HVAC/lights ON during occupancy
    digitalWrite(relayPin, HIGH);
    digitalWrite(statusLed, HIGH);
    
    occupancyActive = false;
  } else {
    digitalWrite(relayPin, LOW);
    digitalWrite(statusLed, LOW);
  }
  
  delay(100);
}

void pirISR() {
  motionStart = millis();
  occupancyActive = true;
}

Interrupt-Driven Production Deployment

Upload firmware with 30s PIR stabilization delay. Sensitivity/time pots optimize room coverage.

Serial Monitor occupancy counter + relay confirms detection events with dwell timing.

Advanced Occupancy Patterns & Energy Management

Program: Arduino Uno PIR - Multi-Zone Occupancy Logic
// Timeout-based occupancy with hysteresis
const unsigned long timeout = 30000;  // 30s
const int zones[3] = {2, 3, 4};  // Multiple PIRs

void loop() {
  bool anyZoneActive = false;
  for(int i=0; i<3; i++) {
    if(digitalRead(zones[i])) anyZoneActive = true;
  }
  
  if(anyZoneActive) {
    lastMotion = millis();
  }
  
  if(millis() - lastMotion < timeout) {
    digitalWrite(relayPin, HIGH);  // Lights ON
  } else {
    digitalWrite(relayPin, LOW);   // Lights OFF
  }
}

HC-SR501 Pyroelectric Specifications

5.8μm dual pyro elements; 110°×70° FOV; 3-7m range; 100ms-5min pulse; 65μA active; -20 to +60°C.

Industrial Building Automation Applications

Conference room occupancy billing

HVAC zone demand control

Parking garage space detection

Program: Arduino Uno PIR - Energy Savings Controller
// Lights + HVAC integrated control
float energySaved = 0;

void loop() {
  if(occupancyActive) {
    digitalWrite(lightRelay, HIGH);
    digitalWrite(hvacRelay, HIGH);
    occupancyTimer = millis();
  } else if(millis() - occupancyTimer > 120000) {  // 2min
    digitalWrite(lightRelay, LOW);
    digitalWrite(hvacRelay, LOW);
    energySaved += 0.15;  // kWh estimate
  }
  
  Serial.print("Energy Saved: ");
  Serial.print(energySaved, 2);
  Serial.println(" kWh");
}

Production Sensor Performance

  • 3-7m detection radius
  • 110° horizontal FOV
  • 30s mandatory warm-up
  • 0.5-200s retrigger time
  • PET immune (no false triggers)

Installation Optimization Protocol

Ceiling mount 2.4-3m height. Avoid direct sunlight/heat sources. Sensitivity CCW=close range. False trigger elimination via dual-zone repeat confirmation.