After getting my clock server running I decided to box it up and add a display to it.
I found everything I needed at Abra Electronics.
As a first time customer it was a disappointing experience. Turns out their web site is really just a “mail order catalogue”. I placed my order on September 2 at 11:32 and received the automatic response. The response was in the wrong currency. On the 4th I get an email saying the display and box are not in stock and would take about a week to get them and would I like them to ship what they have and back order the non-stock items. I asked about the other two models of the display (yellow & green) to which I received a response of not in stock. So I replied saying to ship short and back order the others. That was all on the morning of the 4th. I did not hear back until the 16th when they had trouble with my credit card. I fixed that and let them know to go ahead. Next morning Purolator is at my door at 09:30. At 12:45 I received an email from Abra with the tracking number, meanwhile I’ve had the package for 3 hours already. Everything but 1 display and 1 box were in the package with 1 of each being back ordered. So did they only have 1 in stock originally or did they not get enough from the manufacturer? And why 14 days to ship what they had in stock? They even marked the order as complete online.
In the package, the only piece of paper was the packing slip. Not a single item had documentation beyond a part number label.
So I put the display on the backpack board in what looked right but was actually backwards. It took me almost 2 hours to desolder it.
I found a couple leaning pages on Adafruit’s web site that used this display and got it hooked up to my Raspberry Pi.
I used a “Slice of Pi” board to attach a 5 pin connector for the display and another 5 pin connector for the GPS. The GPS unit has 9 pins but I’m only using the first 5 of them. If I wanted the FIX pin I would have used a 6 pin connector.
Using the examples provided by Adafruit I managed to get the display to show the time via a Python script.
So now it is just a matter of assembling a second “Slice of Pi” for this configuration, cloning the SD card, and mounting everything in the box.
When it comes to mounting, the only issue I have with the Adafruit display and GPS breakout boards is that they have 2mm holes where most of my hardware (bolts, stand offs) is 3mm.
[Unit] Description=Show time on Seven Segment display After=ntpd.service [Service] Type=simple ExecStart=/usr/bin/python /usr/sbin/sevensegment_clock.py RemainAfterExit=true ExecStopPost=/usr/bin/python /usr/sbin/sevensegment_clock_clear.py [Install] WantedBy=multi-user.target
import time import datetime from Adafruit_LED_Backpack import SevenSegment # Create display instance on default I2C address (0x70) and bus number. display = SevenSegment.SevenSegment() # Alternatively, create a display with a specific I2C address and/or bus. # display = SevenSegment.SevenSegment(address=0x74, busnum=1) # Initialize the display. Must be called once before using the display. display.begin() display.set_brightness(10) # Keep track of the colon being turned on or off. colon = False # do we show the date? showdate = True; def display_time(): global colon global showdate now = datetime.datetime.now() hour = now.hour minute = now.minute second = now.second display.clear() # set hours display.set_digit(0, int(hour / 10)) # tens display.set_digit(1, hour % 10) # ones # set minutes display.set_digit(2, int(minute / 10)) # tens display.set_digit(3, minute % 10) # ones # toggle colon display.set_colon(colon) colon = not colon display.write_display() while True: display_time() time.sleep(0.5)
This script is based on the example code from Adafruit.
from Adafruit_LED_Backpack import SevenSegment display = SevenSegment.SevenSegment() display.begin() display.clear() display.write_display()
This script is called when systemd stops the clock service. All it does is clear the display, otherwise the display shows the last value until it is powered off. This way if the display is blank I know something is wrong.
yum install git yum install python-imaging yum install i2c-tools-python yum install python-devel
systemctl enable clock.service
Now I got to thinking about the clocks used in the operations department at the office. They have three clocks showing three different time zones. I could replace these clocks with a digital version