LCDClock – My First Github Project

I’ve used Github quite a bit to source either partial or complete code for many of my Raspberry Pi projects. Github is a code sharing platform that makes it easy to get and keep software updated on devices like Raspberry Pi’s.

When I first created my Pi-clocks I made one with an LCD display that showed local and UTC time. You can see it in this leap second video from 2015.

Five years later that clock has been long out of commission as I do upgrades and other clock projects, but I missed having the LCD clock. So as I worked on the Chrony project I decided to rebuild one as an LCD clock. This has taken me deep into the world of Python and I am sure when someone looks at it there will be comments like “it’s clunky” or “why didn’t you do it this way.” All valid I am sure, but I made it work and even built in some error handling so I feel pretty good for a start.

Starting with the basic Chrony build, the LCD screen gets added from Adafruit. In the last 5 years they have evolved to a version of python called “Circuit Python” to drive many of their devices, so I went with this as the base code to drive the display.

sudo pip3 install adafruit-circuitpython-charlcd

As part of the new design, instead of using this to be a UTC clock (i have plenty of those), I wanted the clock to display variables. The first one I chose was to display the Stratum of the clock. This assures me if I see “Stratum: 1” that I am getting the time from the satellite data. I get that by running a CRON job to output that data to a text file, then I read that from the text file with the Python program. The CRON line that runs every 2 minutes is:

/2 * * * * chronyc tracking > /home/pi/lcdclock/tracking.txt

The second variable is the current IP address of the clock. Always helpful if you want to do some quick editing. That’s a standard python variable, so no additional libraries were needed.

The third variable is the current GPS position. To grab that data I use the gps3 python client to pick up the location of the clock. While this generally won’t change, I might take this on the road in the future to a ham fest or Field Day. There are a bunch of variables I could have pulled, but Lat/Long is just what I needed.

sudo pip3 install gps3

The last variable is a vanity card. I created a file called “msg4.txt” that can be used to display any message in the last 14 second window. Maybe in the future I might make it a YouTube follower counter.

You can grab the code from GitHub here:

https://github.com/n4bfr/lcdclock.git

Here’s how it all comes together:

I’m eager for feedback! Here’s where you can give me notes:
– The N4BFR Vision YouTube Channel
– My Facebook Page: https://www.facebook.com/N4BFRVision
– My Twitter: https://twitter.com/N4BFR_Vision

Follow Friday – YouTube Edition – April 24

Time to share what I am watching, hope it inspires you to watch something new.

Simone Giertz
The queen of shitty robots is awesome. In her most recent video she makes a “proud parent” machine and uses a bunch of dirty words. Which is awesome in so many ways.



Fran Lab
Fran has a very similar taste in projects to me. I found a Heathkit GC1005 clock to refurbish at the Orlando Hamcation, back before we had to social distance. Come to find out Fran had recently refurbished one which really helped me. Mine is still in progress but check out Fran’s here.



Mythbusters Jr.
I didn’t really jump into this because I was put off by the non-Adam version that they tried to reboot through a reality show. Lots of fun builds here. I was really hyped to find a Breaking Bad episode.

https://youtu.be/qWfqy3frAac


Whose Line Is It Anyway Cocktail Hour
Every Monday the cast from Whose Line gets together to preview the show and basically talk s#!t. It’s fun to watch with your feet up. Here’s the video from Monday 4/20.


I have a YouTube Channel too
I talk about clocks, ham radio and other nerdy stuff. I just added a video of the Chronometer Raspberry Pi clock I built this week. As they say, please Like, Comment and Subscribe!

https://youtu.be/KfmjLBSGXOs

Chronometer – Quick Pi Project

I came across a Reddit post by u/rothman857 that made a Raspberry Pi Clock he calls Chronometer with a really unique view of time. They bring in a bunch of different formats like Solar Time and Metric Time. Since I like time and I’m interested in those views, I thought this would be a fun build.

As a net time to make this, it only took me a few hours to get going. I recommend using the screen he specified which is a quick Amazon order. I tried this with another screen I had and it just didn’t work out. Most of that time was learning two functions I haven’t explored before, changing the video settings and console fonts. A few notes on those items if you are building.

Setting Pi Screen Resolution
The display uses a unique setting of 480×320 which I couldn’t seem to drive with a default setup. So using the Raspberry Pi Documentation, I made a custom configuration.

sudo nano /boot/config.txt

I commented out all the existing video settings and added these to the end, which worked for me:

#custom for Chronometer
hdmi_force_mode=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt=480 320 60 1 0 0 0
hdmi_drive=2

Setting a fixed console font
My first try was to use this article at stevencombs.com which in hindsight may have worked if I had specified the Latin and VGA font I wanted, but when I went with the instructions as written it didn’t take the way I wanted. As a follow-up I experimented with several of the suggestions in this StackExchange thread. The “.profile” change didn’t work for me, so I tried Eric Woodward’s suggestion of changing in console-setup.

sudo nano /etc/default/console-setup

#custom for Chronometer
CODESET="Lat15"
FONTFACE="VGA"
FONTSIZE="8x14"

That’s it. Install and run the chronometer.py program and run it. You’re good to go.

Final thoughts. I like this kind of project because I learn more about the inner workings of Pi and I feel like it’s something I can go in and tweak later. For instance, I would like to make one of the time displays be similar to the Union Square Metronome. I will share progress if I get there on my project list. Obligatory video below.

Raspberry Pi with Chrony

I’ve been a fan of having a Stratum 1 time server on my LAN ever since I first read GM8ARV’s page. One of my first ones can be seen in the background on my YouTube video about Leap Second tracking.

I found an article last week where Facebook has been doing analysis on time server software and has come to the recommendation that the Chrony software is better than NTP for performance. I’ve actually been using NTPSEC for a couple of years now, but I am open to change so I’m setting up a Chrony server.