Skip to content
A balenaCloud Raspberry Pi app to display replica near real-time UK railway station departure data on SSD1322 screens. Fork of
Python Shell
Branch: master
Clone or download
Pull request Compare This branch is 6 commits behind balena-io-playground:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Balena UK Train Departure Display (next train indicator)

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 Transport API. This project has been developed and simplified based on the work of others to run on the balenaCloud platform.


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.


Sign up for the Transport API, and generate an app ID and API key (note the free tier has 1000 request a day).

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)
outOfHoursName London Paddington (name shown when current time is outside the transportApi_operatingHours)
refreshTime 120 (seconds between data refresh)
transportApi_apiKey 798c7ddfdeadbeef87987e9a8e79 (transport API key)
transportApi_appId 12345678 (transport API application ID)
transportApi_operatingHours 8-22 (hours during which the data will refresh at the interval above)


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)


A big thanks to Chris Hutchinson who originally started this project and inspired me to develop it further. Blake made some further improvements and this project was forked from there.

The fonts used were painstakingly put together by DanielHartUK and can be found on GitHub at - A huge thanks for making that resource available!

You can’t perform that action at this time.