I have built a weather clock using a Raspberry PI, a USB to Serial adapter and a second hand Point of Sale display.
When I started this project in 2014, I had just started working from home and I wanted an outdoor thermometer. Around this time, while shopping at a used book store, I noticed that they were selling their old Point of Sale equipment, having recently upgraded. So for $25, I bought one of the old POS displays to see what I could do with it. Also, I had been looking at the Raspberry Pi's and even though I was thinking "How cool!", I still couldn't figure out what to do with one. Having built the Current Weather PARFAIT API just a few years before, I realized that perhaps I could bring all of these things together into the Weather Clock. Since then, I have moved most of the logic to what is now the Weather API, vastly simplifying the code required in the clock itself. So much so, using a Raspberry Pi is definitely overkill.
- Raspberry Pi Model B+ V1.2
- Partner Tech CD7220 Vacuum Fluorescent Display
- TRENDnet TU-S9 USB to Serial Cable
Using Python3, I wrote 3 scripts:
- POS.py: This is used to house the connection and control commands for the POS Display. You will need to modify this to work with your display.
- POSClock.py: This is the main program.
- POSClockGears.py: This is used to house the functions for getting the current time from the OS and the current weather observations from the Weather API. You will need to modify this to get your weather data.
All 3 can be downloaded here. (SHA256 checksum: 041d59e10d5c02254d43e23630a041d36b2f0539571b93e7705ba0b19e41fcca)
Running the Clock
To have the clock run when the Raspberry Pi starts, I setup a
systemd service pointing to POSClock.py:
Make script executable:
chmod +x /home/pi/POS/POSClock.py
Create a new service
sudo systemctl --force --full edit POSClock.service
- In the empty editor insert these statements, save them and quit the editor
[Unit] Description=POS Clock After=multi-user.target [Service] Type=simple ExecStart=/usr/bin/python3 /home/pi/POS/POSClock.py Restart=on-abort [Install] WantedBy=multi-user.target
Enable the service:
sudo systemctl enable POSClock.service
sudo systemctl reboot
Monitoring and Controlling the Service
- Look at its status:
systemctl status POSClock.service
- Stop the service:
sudo systemctl stop POSClock.service
- Start the service:
sudo systemctl start POSClock.service
- Restart the service:
sudo systemctl restart POSClock.service