Coder Social home page Coder Social logo

balena-io-playground's Introduction

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.

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 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)

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)

Credits

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 https://github.com/DanielHartUK/Dot-Matrix-Typeface - A huge thanks for making that resource available!

balena-io-playground's People

Contributors

chrishutchinson avatar ghostseven avatar chrisys avatar

Stargazers

Hai Jin avatar

Watchers

James Cloos avatar Hai Jin avatar Brent avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.