Giter Site home page Giter Site logo

chrishutchinson / train-departure-screen Goto Github PK

View Code? Open in Web Editor NEW
229.0 18.0 52.0 1.94 MB

Python script to display replica real-time UK railway station departure screens for SSD13xx devices

Python 100.00%
ssd1322 python national-rail uk-rail-info departure-board

train-departure-screen's Introduction

UK train departure screen

Python script to display replica real-time UK railway station departure screens for SSD13xx devices

Sample output

Example output of the script

Requirements

To run this code, you will need Python 3.6+.

Raspbian

If you're using Raspbian Lite, you'll also need to install:

  • libopenjp2-7

with:

$ sudo apt-get install libopenjp2-7

Usage

  1. Clone this repo

  2. Install dependencies

$ pip install -r requirements.txt
  1. Sign up for the Transport API, and generate an app ID and API key

  2. Copy config.sample.json to config.json and complete the values, including your Transport API keys from step 3. Note: station names should be provided as their three-letter station code, all available here.

  3. Start the app with:

$ python ./src/main.py --display pygame --width 256 --height 64

Change the --display flag to alter the output mechanism (a list of options can be found in this README: https://github.com/rm-hull/luma.examples). Use capture to save to images, and pygame to run a visual emulator.

Remember to pass --interface spi if you are using SPI to communicate with your screen. Otherwise, the default of i2c should suffice.

$ python ./src/main.py --display ssd1322 --width 256 --height 64 --interface spi

Video demo

I've tweeted a video demo of the software running on a real device: https://twitter.com/chrishutchinson/status/1136743837244768257

Thanks

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!

train-departure-screen's People

Contributors

chrishutchinson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

train-departure-screen's Issues

Install dependencies process fails

Using latest version of Raspbian Buster (2019-09-26-raspbian-buster-lite), the documented process for installing the dependencies fails with -

Could not find a version that satisfies the requirement astroid==2.2.5 (from -r requirements.txt (line 2)) (from versions: 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 2.0.0.dev0, 2.0.0.dev1, 2.0.0.dev2, 2.0.0.dev3, 2.0.0.dev4)
No matching distribution found for astroid==2.2.5 (from -r requirements.txt (line 2))

Running with framebuffer-device

Hi there,

Took me a while to get my Spotpear LCD working (see rm-hull/luma.lcd#139) but I got there in the end.
I am trying to run with the following parameters

python3 src/main.py --interface spi --gpio-reset 25 --gpio-data-command 24 --display linux_framebuffer --width 320 --height 240 --framebuffer-device /dev/fb1

And the script is falling over here

Traceback (most recent call last):
  File "src/main.py", line 263, in <module>
    virtual.refresh()
  File "/home/pi/.local/lib/python3.7/site-packages/luma/core/virtual.py", line 123, in refresh
    im = self._backing_image.crop(box=self._crop_box())
  File "/home/pi/.local/lib/python3.7/site-packages/luma/core/virtual.py", line 135, in _crop_box
    assert(0 <= left <= right <= self.width)
AssertionError

Any clues please? I have just done a fresh install of Raspian and updated all the luma packages to their latest versions.

Many thanks

Jason

Parts list?

The train departure board looks like a great project for a beginner to Python and I wonder if there is a parts list anywhere for the build that Chris used to create his Twitter video? TIA

Readme updates

To help others get this working...

  • I suggest adding that the minimum python version is 3.6 due to f"{} {}" notation
  • libopenjp2-7 is a requirement and is not included in raspbian stretch lite
    • sudo apt-get install libopenjp2-7

OLED Display Pin Out Diagram

Chris - one of the OLED pin out diagrams you have in the assets folder must be wrong as one has pin 1 as +v and 2 as ground and the other has pin 2 as +v and pin 1 as ground. Which one is correct for the SSD 1332 purchased from AliExpress as you recommend ?

Everything is on time

Running great but every train shows 'On time' despite trains being delayed on the likes of national rail inquiries, other apps etc.

Script crashes when only one train is scheduled

If only a single train is scheduled for a given journey configuration (departure + optional destination), then the script will crash. This is because the script attempts to render a second service, but doesn't have the required data.

Output error, for reference:

Traceback (most recent call last):
  File "./src/main.py", line 254, in <module>
    height=widgetHeight, data=data)
  File "./src/main.py", line 197, in drawSignage
    departures[1]), interval=10)
IndexError: list index out of range

SyntaxError: invalid syntax

Hi,

I have the following error when I try to run the run.sh file

pi@raspberrypi:~/UK-Train-Departure-Display $ ./run.sh
File "./src/main.py", line 38
train = f"{departureTime} {destinationName}"
^
SyntaxError: invalid syntax

I have checked and rechecked my config file and I have re-cloned the GitHub files and I have checked all the requirements have been installed but I still have the problem.

Can anyone help?

Regards
James

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.