Raspberry Pi practice problem · Projects
Fridge door alarm
MediumBudget $4Python · gpiozero
A fridge that complains: a slide switch is the door sensor: COM to GPIO27, pin 1 to ground, pin 2 to 3.3 V (lever right = door open = GPIO27 high). An active buzzer on GPIO25 (it may draw up to 25 mA from the pin).
- When the door has been open for 3 s, the buzzer sounds, and keeps sounding until the door closes.
- A door opened briefly (under 3 s) never sounds the alarm, and closing it always silences the buzzer.
The test opens the door at 1 s, closes it at 2.5 s, opens it again at 4 s and closes it at 9 s.