Skip to content

Weather Clock

I have built a weather clock using a Raspberry PI, a USB to Serial adapter and a second hand Point of Sale display.

Weather Clock

History

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.

Hardware

  • Raspberry Pi Model B+ V1.2
  • Partner Tech CD7220 Vacuum Fluorescent Display
  • TRENDnet TU-S9 USB to Serial Cable

Python3 Scripts

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. (SHA1 check sum: A8679E583EE884450F0C10BAA74865582251C533)

Running the Clock

To have the clock run when the Raspberry Pi starts, I setup a systemd service pointing to POSClock.py:

  1. Make script executable: rpi ~ $ chmod +x /home/pi/POS/POSClock.py

  2. Create a new service

    1. rpi ~ $ sudo systemctl --force --full edit POSClock.service

      1. 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
      
    2. Enable the service: rpi ~ $ sudo systemctl enable POSClock.service

    3. Reboot: rpi ~ $ sudo systemctl reboot

Monitoring and Controlling the Service

  • Look at its status: rpi ~ $ systemctl status POSClock.service
  • Stop the service: rpi ~ $ sudo systemctl stop POSClock.service
  • Start the service: rpi ~ $ sudo systemctl start POSClock.service
  • Restart the service: rpi ~ $ sudo systemctl restart POSClock.service