What it is: The HC-SR501 is the classic passive infrared (PIR) motion sensor — the white-dome sensor in burglar alarms and automatic lights. It detects the moving body heat of people and animals up to ~7 m.
How it works: It watches for changes in infrared across its lens. When a warm body moves, OUT goes HIGH for a set hold time. It's purely digital — no analog reading.
Wiring:
PIR OUT -> GPIO10 (digital)
PIR VCC -> 5V (needs 5V for its regulator)
PIR GND -> GND
OLED VCC=3V3, GND=GND, SDA=GPIO4, SCL=GPIO5
Libraries: only "Adafruit SSD1306" and "Adafruit GFX Library".
On screen / Serial: "MOTION!" while triggered, "idle" otherwise. Walk in front of it to trip it.
Gotchas: The two orange trimmers set sensitivity (range) and time-delay (how long OUT stays HIGH); start both around mid-travel. Give it 30–60 seconds to settle after power-on. Its OUT is a clean 3.3V-safe HIGH. Set the jumper to "repeat/H" mode so it re-triggers while motion continues.