(note: it’s quite hard to photograph neopixels, I tried)
The basic idea is that the colour in the middle changes with the hour, and the white lights around the outside indicate sort of approximate areas on the clock. This way, I avoid staring at the clock reading
03:32 but can still tell that it is time to go back to sleep!
The code is python; run the script
python3 clock.py and the script will check the time on the pi, set the lights and exit. To keep the clock running, try setting up a cron job that does this every minute:
* * * * * /usr/bin/python ~/night-clock/clock.py
It’s much simpler than trying to keep a long-running process going.
Pro-tip: Neopixels are really bright – much too bright to have anywhere near you in the dark! Look for a variable called
on that serves as the basic light level (everything else works off that setting). The max is 255 but I’m working off about 80 and even that is plenty bright enough :)
The code is on GitHub: https://github.com/lornajane/sensehat-night-clock and you’re more than welcome to try it, amend it, let me know how you go!
Also published on Medium.