I recently upgraded my smartwatch and the new model needs charging daily (whether that’s really an upgrade is a separate discussion!) so I drop it on the charger by my bed overnight. As a result, I can’t tell the time if I wake up in the night which is only annoying because I don’t know if it’s midnight or if the alarm is going to go off in ten minutes! So I made myself a colourful fuzzy time clock with a raspberry pi and a SenseHat that were lying around in my office.
(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!
Originally published at LornaJane.