Introduction
While a single PIR sensor can detect motion, multiple sensors in an array can count people, determine direction, and even track movement. This guide covers array configurations and signal processing techniques.
Why Use Arrays?
- People counting: Determine number of people passing a point
- Direction detection: Know whether someone entered or exited
- Tracking: Follow movement across a space
- Improved accuracy: Reduce false positives through sensor fusion
- Coverage: Eliminate blind spots with overlapping fields
Array Configurations
Linear Array (Direction Detection)
Two PIR sensors placed side by side with overlapping fields. The order of triggering indicates direction: left-to-right vs. right-to-left.
2×2 Grid (Basic Tracking)
Four sensors in a square pattern. Can track quadrant-level movement.
Ceiling-Mounted Circular Array
Multiple sensors arranged radially for 360° coverage. Used in room occupancy counting.
Signal Processing for Arrays
Correlation Method
Cross-correlate signals from adjacent sensors to determine time delay and thus direction/speed.
// Simplified direction detection
if (sensor1.triggered && sensor2.triggered) {
timeDiff = sensor2.triggerTime - sensor1.triggerTime;
if (abs(timeDiff) < threshold) {
if (timeDiff > 0) direction = LEFT_TO_RIGHT;
else direction = RIGHT_TO_LEFT;
}
}
Machine Learning
Train a model on multi-sensor data to classify patterns (e.g., one person vs. two people walking together).
People Counting Algorithms
Dual-Sensor Counting
Two sensors in a narrow passage. Algorithm:
- Detect trigger order
- Increment count for entry direction, decrement for exit
- Handle edge cases (people stopping, turning around)
Zone-Based Counting
Divide area into zones, each covered by a sensor. Track occupancy by monitoring which zones are active.
Hardware Implementation
Discrete Sensors
Multiple individual PIR modules, each with its own signal conditioning. Requires multiple microcontroller inputs.
Integrated Arrays
Some manufacturers offer multi-element pyroelectric arrays in a single package (e.g., 2×2 elements). These simplify design and ensure matched performance.
Case Study: Retail Store Entry Counter
A retail store installed a dual-sensor PIR array above the entrance. The system counts customers entering and exiting, updates real-time occupancy display, and triggers alerts when capacity reached. Achieved 95% accuracy after calibration.
DIY Implementation Example
// Pseudo-code for 2-sensor direction detection
const int sensorLeft = 2;
const int sensorRight = 3;
volatile unsigned long timeLeft, timeRight;
volatile bool triggeredLeft, triggeredRight;
void leftISR() {
timeLeft = millis();
triggeredLeft = true;
}
void rightISR() {
timeRight = millis();
triggeredRight = true;
}
void loop() {
if (triggeredLeft && triggeredRight) {
if (timeLeft < timeRight) {
count++;
} else {
count--;
}
triggeredLeft = triggeredRight = false;
}
}
Conclusion
PIR sensor arrays unlock advanced capabilities beyond simple motion detection. With careful design and signal processing, they can provide people counting, direction detection, and tracking for a fraction of the cost of camera-based systems.
