Raspberry Pi practice problem · Projects
Garage door
A garage door wound by a stepper. A 28BYJ-48 stepper on its ULN2003 board: IN1–IN4 on GPIO17, 18, 27, 22, powered from 5 V. Half-step sequence (IN1..IN4): 1000, 1100, 0100, 0110, 0010, 0011, 0001, 1001; walking it forwards turns the shaft clockwise (increasing angle). 4076 half-steps make one output turn; keep to at most one half-step every 2 ms. The door is closed at 0° of the output shaft and open at 90° (1019 half-steps). A button on GPIO26 operates it, a PIR sensor (OUT on GPIO4, 5 V) watches the doorway, and an amber warning LED on GPIO16 is lit while the door moves.
- A press when the door is closed opens it; a press when it is open closes it.
- While the door is closing, motion in the doorway sends it straight back up to fully open.
- Motion is ignored while the door is opening or standing still.
Step at 2 ms per half-step (about 2 s for a full open or close). The PIR keeps its output high for 5 s after the motion stops. The test presses at 1 s; presses again at 4.5 s; shows motion from 5.3 s to 6 s; presses again at 11.5 s.