My complete github project (https://github.com/texadactyl/rpi_clock) provides a Raspberry Pi Clock & Weather display (rpi_clock), based on the Quimat 3.5" TFT Touch Screen with a 320x480 resolution.
Github subfolders:
- bin - rpi_clock.py (Python 3 source code)
- docs - preparation_notes.txt (how-to do everything required - really! - after following Quimat hardware installation instructions).
Quimat stores their Linux drivers and more at https://github.com/goodtft/LCD-show
To build,
- Follow Quimat's instructions included with their product to physically interface the Raspberry Pi 2/3 to the TFT LCD. No wires required. Just press the TFT LCD onto the Raspberry Pi's GPIO pins.
- Watch out for the Quimat supplied clear plastic case! Very brittle.
- Follow docs/preparation_notes.txt to fully prepare the Raspberry Pi 2/3, install Quimat's Linux drivers, install rpi_clock.py, and set-up the pi login user to automatically bring up the primary Tk window after power-up or reboot.
The primary Tk window displays date, time, and current weather conditions outside according to the Richardson Texas USA station of the Weather Underground.
You can see that I set up the primary window presentation for an American-formatted date & time presentation. Modifying this for other locales is very simple by editing bin/rpi_clock.py constants FORMAT_DATE and FORMAT_TIME. You can easily modify colors, fonts, widths, button sizes, etc. as you wish as they are also capitalized constants.
The weather data comes in a response from the Weather Underground using a JSON-oriented API for current weather conditions. I chose to show temperature in both Celsius and Fahrenheit. The conditions string ("partlycloudy" in the image above) was returned by the Weather Underground as part of its JSON response message; it probably formatted for American English due to the station parameters (Richardson).
If you touch the primary Tk window, it will bring up a secondary Tk window which offers the user to go back to the primary window, reboot, or shutdown.
Had I purchased a larger screen (E.g. 7") I could have employed graphic images and other data which would have been more aesthetically-pleasing.
Sorry but I did not show the usual unboxing of the display hardware etc. as I only thought about sharing this experience after construction finished (oops!).
Note that the directions from Quimat (TFT supplier) were quite sparse (I am being generous). You can see my complete review of the Quimat product at Amazon: (https://www.amazon.com/gp/customer-reviews/RXAU7YNHXRTIP/ref=cm_cr_getr_d_rvw_ttl?ie=UTF8&ASIN=B06W55HBTX).
There are probably better hardware solutions although this worked fine for a persistent old hacker like me (=: In their defense, I'll say that the Quimat display hardware pushed onto the Pi's GPIO connectors without issues; no wiring required. However, watch out for the supplied plastic case because it is very brittle - mine broke [)-:] so I slapped together a semi-protective solution (bottom of a clear case in my bottom desk drawer) that covers the bottom of the Pi. If the TFT (protecting the front of the Pi) dies because there is nothing protecting it or some other unfortunate event, I'll look for another hardware vendor product.
I used my existing Raspberry Pi 2 and passed along its USB drive to my new Raspberry Pi 3. It would not be terribly difficult to modify the rpi_clock.py Python 3 script to employ:
- A different touch-screen display product which interfaces with the Raspberry Pi 2 or 3.
- Execute in another Linux distribution or under any O.S. which supports Python 3, JSON, and Tk.
View from the top:
View from the bottom:
AFTERTHOUGHTS
Admittedly, there seems to be other 3.5" TFT display products which claim to NOT require special drivers as of the latest Raspbian during 2017 (more desirable IMO). In fact, the Quimat product might too. I just got caught in the middle! Some time in the future, I might try it without the Quimat-supplied driver software. If that effort is successful, I will update this blog and the github project.
Will this work on a Pi Zero? Older Pi A or B?
How well did I test preparation_notes.txt? I speak Linux/Unix so I might have dones something subconsciously without noting it down.
Find any bugs?
Suggestions for improvement?
The Weather Underground seems to be world-wide. Alternate international weather data provider?
Richard Elkins Dallas, Texas, USA, 3rd Rock, Sol
Comments