This is the source code used for building a DIY clock using Inky's wHAT e-Ink display.
poetry install
poetry shell
python clock.py debug
It shows the rendered image like this:
I used Raspberry Pi Zero W so I had to solder the header pins and then connect it to the display. There are a few tutorial for it, it's easy. I also installed a minimal Pi OS on my Raspberry Pi and connected to it using SSH but there are other ways to work with your Pi.
To load weather information you need to:
- Sign up with open weather API to get your
wather-api-key
. It's free. - Use Google map to get your location latitude and longitude.
Then deploy the script on your Raspberry Pi:
- Install Inky's:
curl https://get.pimoroni.com/inky | bash
. - Install dependencies:
sudo pip install typer
(sudo is important because we use the root crontab to schedule the script). - Copy clock.py and fonts folder (or only the used font in the script) to your Pi.
- Setup cron to run it every minute:
sudo crontab -e
- Add this line at the end of the opened file and save it:
* * * * * python {clock.py-absolute-path} -- {weather-api-key} {latitude} {longitude}
(don't forget--
, otherwise negative numbers for lat and long parameter wouldn't work)
- You've got a clock and a script that can update its display. Limitation is your imagination!