Overview
The pir node detects motion using PIR (Passive Infrared) sensors like the HC-SR501.
These sensors detect changes in infrared radiation caused by warm bodies (humans, animals), making them
ideal for security systems, occupancy detection, and automatic lighting.
Wiring (HC-SR501)
Connection
VCC → 5V (or 3.3V for some models)
OUT → GPIO 17 (any digital pin)
GND → GND
Output is 3.3V even when powered with 5V - safe for Pi GPIO
Adjustment Pots
Sensitivity: Adjust detection range (3-7m)
Time Delay: How long output stays HIGH (5s-300s)
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| pin | number | 17 | GPIO pin connected to sensor |
| output | string | "motion" | "motion", "all", or "state" |
| debounce | number | 2000 | Minimum time between triggers (ms) |
| initialDelay | number | 30000 | Warmup delay before first reading (ms) |
Output Modes
"motion"
Only outputs when motion detected
{ "payload": true } "all"
Outputs on motion start and end
{ "payload": true/false } "state"
Outputs continuous state
{ "payload": 0/1 } Example: Motion-Activated Light with Timeout
Turn on light when motion detected, automatically turn off after 5 minutes of no motion.
[
{
"id": "pir-sensor",
"type": "pir",
"pin": 17,
"output": "motion"
},
{
"id": "light-timer",
"type": "trigger",
"extend": true,
"duration": "5",
"units": "min",
"reset": "",
"op1": "1",
"op2": "0"
},
{
"id": "light-relay",
"type": "gpio-out",
"pin": 18
}
]