I actually completed a couple of small projects this month! For someone who absolutely hates DIY I really enjoy it when I get the chance to physically make something. I think the pressure gets to me when it’s a DIY job, with any mistake immediately obvious to anyone else in the house and potentially very expensive to fix. But if I’m just making something creative for myself or as a gift then I can relax and enjoy it a bit more. It was with this in mind that I approached a gift for my wedding anniversary.
After some extensive idea browsing I settled on a decorative mile marker signpost. I mulled it over for a few days and figured all it would need was a nice 3D frame to present in and some small cuts of balsa wood to make the sign post. The sign itself would have the towns where we’ve lived and a couple of important holiday locations (where we got engaged and where we spent our honeymoon), along with the distance in miles from our current home.
Unusually for one of my projects, it turned out to be as simple as I hoped and I was pretty pleased with the end result. A sharp knife cut the balsa into shape, a fine liner worked for the sign writing, and some wargaming texture grass for decorating figures added a bit of colour.
All was going really well until the week before our anniversary when my wife mentioned it was six years since our wedding, not the five I’d been certain it was. Which meant this year’s theme should have been iron, not wood. We laughed. Well, I laughed then had to explain what was so funny.
Thankfully despite my failure to count to six, the sentiment was very much appreciated and my wife loved the present in the end!
The second project I managed to finish used a completely different maker discipline, a bit more in my comfort zone. I’ve been playing with the Raspberry Pi computer for a year or two now and while I’ve had a lot of fun I haven’t finished a useful project for it yet. However a couple of weeks of frustrating poor service from Scotrail inspired me to finally put a Raspberry Pi Zero and a Pimoroni Inkyphat eInk screen to good use.
My plan was to have a small screen on my desk at work which would refresh periodically through the day with any service updates from the train operator, specifically for trains on my route home.
Scotrail operate a Journey Check website which lists all service updates in a fairly basic view. I could try and strip the data directly from there, but there is a better way. They also have the same page available as an RSS feed.
I knocked up a short Python script using the Feedparser library to pull the RSS feed for my commuting route and then throw the page title, number of train updates, and the train details into some variables. These are then displayed together on the Inkyphat.
The result is pretty good, though the limited screen estate of the Inkyphat means I lose some details off the edge. This is a fair trade for readability of the important train times though.
Lastly I set a crontab to run the script every fifteen minutes and then placed it on my desk when I got to the office.
Not to miss an opportunity, Scotrail duly cancelled various trains through the day including the one I had planned to take home. It was a bittersweet moment when I came back from lunch to see the screen had updated and my normal train was listed.
For those that might be interested in doing something similar, the code for the Python script is posted below.
import inkyphat from PIL import ImageFont import feedparser #Set font to use on the Inkyphat font = ImageFont.truetype("/usr/lib/python3/dist-packages/inkyphat/fonts/Montserrat-Regular.ttf", 12) #set the URL for the RSS feed - Scotrail's journey check between Aberdeen and Stonehaven in this case scotrail_rss="http://rss.journeycheck.com/scotrail/route?action=search&from=ABD&to=STN&period=today&formTubeUpdateLocation=&formTubeUpdatePeriod=&savedRoute=" #parse the RSS feed with feedparser f=feedparser.parse(scotrail_rss) #pack variables with the feed tag data head=f.feed.title updates= str(len(f.entries)) + " updates" service = "" for train in f.entries: service=service + train.title + "\n" last_update=str(f.feed.published) #uncomment two lines below to print output to screen for debugging #message = head+updates+service+last_update #print message #prepare lines for inkyphat inkyphat.text((1, 1), head, inkyphat.RED, font) inkyphat.text((1,10), updates, inkyphat.RED, font) inkyphat.text((1,20), service, inkyphat.BLACK, font) inkyphat.text((1,80), last_update, inkyphat.RED, font) #write to Inkyphat inkyphat.show()