A Raspberry Pi--based traffic light that helps kids know when it's okay to come out of their room.
- Red -- go back to bed
- Yellow -- play quietly in your room
- Green -- it's okay to come out
- Off -- before the configured start time and after noon
- Web UI to configure daily schedule
- Configurable "start lighting at" time (default 05:00)
- Automatically turns off after 12:00 PM
- Manual override buttons (Red / Yellow / Green / Off / Auto)
- Timed overrides (e.g., force green for 30 minutes)
- Persistent configuration across reboots
- Runs as a systemd service
- mDNS support (
http://bedlight.local) - Uses
gpiozerowithlgpio(noRPi.GPIOissues)
- Raspberry Pi (any 40-pin model)
- 3 LEDs (red, yellow, green)
- 3 resistors (220--330Ω)
- Wiring:
- Red LED → BCM 17 (physical pin 11)
- Yellow LED → BCM 18 (physical pin 12)
- Green LED → BCM 27 (physical pin 13)
- Common ground
sudo apt update
sudo apt install -y git
git clone <YOUR_REPO_URL> bedlight
cd bedlight
sudo ./deploy.sh bedlightThen open: - http://bedlight.local - or http://<pi-ip>
Configuration is stored at:
/etc/bedlight/config.json
Example:
{
"start_at": "05:00",
"red_until": "07:00",
"yellow_until": "08:30",
"green_until": "11:00",
"enabled": true,
"override_state": "auto",
"override_until": ""
}Edits made via the web UI are saved automatically.
Check status:
sudo systemctl status bedlight.serviceRestart:
sudo systemctl restart bedlight.serviceLogs:
sudo journalctl -u bedlight.service -fgit pull
sudo ./deploy.sh bedlightYour configuration will be preserved.
LED doesn't turn on - Check wiring and resistors - Verify BCM pin
numbers - Check logs with journalctl
Can't reach bedlight.local - Ensure avahi is running:
sudo systemctl status avahi-daemon- Try using the Pi's IP address instead
MIT