Mike: Here’s a guest post from my friend David Booth who you can find on Twitter here and on the web here. This is a great project for the current times we live in (because of the high probability of Home Schooling in the UK due to COVID-19 lockdowns) and also should come in useful for home schoolers in general.
With the rush to change everyone over to home learning, we thought it was important to retain some sort of school routine in our young kids. For that, we decided to make a clock that showed the time, but also showed a “timetable” specific to our needs. Having got Raspberry Pi’s up the wazoo in this house, and previously being lucky enough to win an Inky wHAT from a Pimoroni competition, it was obvious that I should combine these tools to create a very quick “school clock” project. All the code is available on GitHub.
What I used?
A Pi Zero. There are a plethora of online shops that sell Raspberry Pi’s. I got my Pi Zero WH from The Pi Hut for less than £14. The pre-soldered header just makes life a little easier, but you can solder that on to a normal Pi Zero W yourself if you fancy the challenge/refresher course of soldering.
An Inky wHAT: These can be bought from Pimoroni and you have a choice of colours – Black/White, Red/Black/White and Yellow/Black/White. The price varies depending on model from £45 to £52.50. As I said, I was lucky to have won one! 🙂
Other than that, all you need is an 8GB microSD card or larger, a suitable power supply for the Pi and a way of holding it all together. I used a 3D printed case from Thingiverse.
Assuming you already have a Pi Zero W with the headers already on, it is simply a matter of plugging the Raspberry Pi’s GPIO pins into the back of the Inky wHAT, inserting them both into the 3D-printed case, plugging the microSD card in (that has Raspberry Pi OS installed) and powering it on.
First thing to do on any new Raspberry Pi OS is to start a terminal session and update the OS:
sudo apt-get update sudo apt-get upgrade
After the upgrade is complete, the next step is to install the software required to make the screen work. Pimoroni have created a really quick and easy one-line-installer to get the Inky wHAT set-up:
curl https://get.pimoroni.com/inky | bash
After that is complete, try running one of the example Python scripts that comes with the installer to verify all is working on the screen front. For more information, I’d recommend looking at Pimoroni’s website.
Download the Python file from the following GitHub repository and store it in your home folder. https://github.com/worlds6440/school_clock
Make the Python file executable:
chmod +x clock.py
The code is currently set to update the clock every minute and display a new message every half hour between 8:30am and 5pm. You can obviously and easily change this by editing the contents of the get_message() method inside the clock.py file. I do intend to improve the code at some point to take its messages from a file or online location to make it easier to configure, but it’s not strictly necessary and this write-up has taken longer to do than the project itself 🙂
You can test the project now by running in the terminal:
To make the clock start at boot, run:
sudo crontab -e
And add the following line at the bottom:
@reboot /usr/bin/python /home/pi/clock.py &
And that’s it! Your very own School Clock for home schooling!