I recently purchased the tiny 1.44 inch LCD screen from Waveshare and placed it atop an Pi Zero that I had. I really wanted the screen to be a clock, so I made one below. Feel free to use and improve upon it. You can replace the numbers with your own numbers if you would like. I wanted to go for the OCR font face look, so used the images included in below install. I used the solderless GPIO connector to connect the Pi Zero to the LCD hat, but you can also do it the old fashioned way and solder the connector to the Pi Zero.
Enjoy!
After setting up the Pi with Raspian, bring up the command line and do:
sudo raspi-config
Choose Interfacing Options -> SPI -> Yes to enable SPI interface. Then, Waveshare recommends you perform the following to setup their hat. Not sure this is really needed for this project, but I followed their instructions. It certainly does not interfere in any negative way with this project:
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.tar.gz
tar zxvf bcm2835-1.68.tar.gz
cd bcm2835-1.68/
sudo ./configure && sudo make && sudo make check && sudo make install
sudo nano /boot/config.txt
Towards the end of the config.txt file, add the following line:
gpio=6,19,5,26,13,21,20,16=pu
Ctrl-X and Y to save the change. Then install the st7735s controller as follows:
git clone https://github.com/bchanudet/python-st7735s.git
cd python-st7735s
python3 setup.py install
Finally, you need to install my very short python code for the clock. You can change the numbers if you would like, as long as you make 10 separate .bmp files with an image size of 64x64 pixels for all the numbers from 0 to 9. Just replace the ones that you install below.
sudo wget https://alpserver.ch/clock.zip
sudo mkdir /home/pi/Clock
sudo unzip clock.zip -d /home/pi/Clock/
sudo rm clock.zip
sudo nano /etc/rc.local
In the rc.local file, just above where it says "Exit 0:", add the following line:
python3 /home/pi/Clock/clock.py &
Ctrl-X and Y to save the changes. Finally, it is recommended to amend the perms for the rc.local file as follows:
sudo chmod 755 /etc/rc.local
sudo reboot now
And you're done! The Pi Zero will boot up with the clock on the LCD hat, and you can still use the Pi as a computer or server or whatever you would like. Hope you enjoy it as much as I do!
Comments
Please log in or sign up to comment.