Skip to content

A balenaCloud Raspberry Pi app to display replica near real-time UK railway station departure data on SSD1322 screens. Fork of https://github.com/balena-io-playground/UK-Train-Departure-Display to change from Transport API to OpenLDBWS

Notifications You must be signed in to change notification settings

MatthewAscough/UK-Train-Departure-Display-NRE

 
 

Repository files navigation

Balena UK Train Departure Display (next train indicator) - OpenLDBWS version

A set of python scripts to display replica near real-time UK railway station departure data on SSD1322-based 256x64 SPI OLED screens. Uses the publicly available OpenLDBWS API by National Rail Enquiries. This project has been developed and simplified based on the work of others to run on the balenaCloud platform.

Installation

A Dockerfile template is included in order to run this project on the balenaCloud platform.

To use this project, sign up, add an application and device as per the getting started guide. Then use the balena CLI to push the project to your Pi.

This allows you to easily deploy multiple devices and configure them from the dashboard with the following variables which will then automatically generate the config.json file required.

There is also a full writeup on the balena blog.

Configuration

Sign up for the National Rail Enquiries OpenLDBWS API, and generate an API key.

These environment variables are specified using the balenaCloud dashboard, allowing you to set up mutiple signs in one application for different stations.

Key Example Value
TZ Europe/London (timezone)
departureStation PAD (station code)
destinationStation HWV (station code) [optional] Filters trains shown to only those that call at this station
timeOffset 5 [optional] (Time offset, in minutes, for the departure board. Can be used to see into the future (positive value) or past (negative value). Set 5 if you live 5 min from the station and want to hide departures that are too soon to catch)
outOfHoursName London Paddington (name shown when current time is outside the transportApi_operatingHours)
refreshTime 120 (seconds between data refresh)
screenRotation 2 (rotates the output of the OLED)
transportApi_apiKey f1ff949c-7693-49b3-8242-e3354fe91b94 (OpenLDBWS API key)
transportApi_operatingHours 8-22 (hours during which the data will refresh at the interval above)

Hardware

This project (without modification) requires the use of a SSD1322-based 256x64 SPI display, an OLED in yellow for the authentic look. I have used displays from AliExpress successfully.

The connections for one of these displays to the Raspberry Pi GPIO header are as follows, but it would be a good idea to check the connections with the datasheet of your particilar display before powering on as there's no guarantee yours will match the pinout of mine.

Display Connection Raspberry Pi
1 Ground 6 (Ground)
2 V+ (3.3V) 1 (3v3 Power)
4 D0/SCLK 23 (BCM11 SCLK)
5 D1/SDIN 19 (BCM10 MOSI)
14 DC (data/command select) 18 (BCM24)
15 RST (reset) 22 (BCM25)
16 CS (chip select) 24 (BCM8 CE0)

Case

There are .stl 3D models for a case available in the assets directory.

Credits

A big thanks to Chris Hutchinson who originally started this project. Blake and then chrisys made further improvements. This version is a fork designed for the OpenLDBWS API rather than Transport API.

The fonts used were painstakingly put together by DanielHartUK and can be found on GitHub at https://github.com/DanielHartUK/Dot-Matrix-Typeface - A huge thanks for making that resource available!

About

A balenaCloud Raspberry Pi app to display replica near real-time UK railway station departure data on SSD1322 screens. Fork of https://github.com/balena-io-playground/UK-Train-Departure-Display to change from Transport API to OpenLDBWS

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 94.8%
  • Shell 5.2%