{"id":27284479,"url":"https://github.com/jonmorrissmith/rpitraindisplay","last_synced_at":"2026-05-01T16:36:20.512Z","repository":{"id":277053842,"uuid":"930528527","full_name":"jonmorrissmith/RpiTrainDisplay","owner":"jonmorrissmith","description":"A Raspberry Pi powered HUB75-Matrix real-time UK train departure board with UI. Supports up to 3x3 matrix panels.","archived":false,"fork":false,"pushed_at":"2025-07-06T20:47:33.000Z","size":3541,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-06T21:38:53.976Z","etag":null,"topics":["cpp","hub75","hub75e","python","railway-information-portal","raspberry-pi","rgb-matrix","rgb-matrix-bonnet","rgb-matrix-led-panel","train-running-status"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonmorrissmith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-10T19:25:38.000Z","updated_at":"2025-07-06T20:47:37.000Z","dependencies_parsed_at":"2025-02-11T22:26:16.437Z","dependency_job_id":"c3561512-c1aa-42cb-b83e-46dabfa6cbbb","html_url":"https://github.com/jonmorrissmith/RpiTrainDisplay","commit_stats":null,"previous_names":["jonmorrissmith/rgb_matrix_train_departure_board","jonmorrissmith/rpitraindisplay"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonmorrissmith/RpiTrainDisplay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmorrissmith%2FRpiTrainDisplay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmorrissmith%2FRpiTrainDisplay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmorrissmith%2FRpiTrainDisplay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmorrissmith%2FRpiTrainDisplay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonmorrissmith","download_url":"https://codeload.github.com/jonmorrissmith/RpiTrainDisplay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonmorrissmith%2FRpiTrainDisplay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32505109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","hub75","hub75e","python","railway-information-portal","raspberry-pi","rgb-matrix","rgb-matrix-bonnet","rgb-matrix-led-panel","train-running-status"],"created_at":"2025-04-11T18:58:31.454Z","updated_at":"2026-05-01T16:36:20.496Z","avatar_url":"https://github.com/jonmorrissmith.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RpiTrainDisplay - LED Matrix Train Departure Board\n\n## Current Status\n**NOTE** This project has been parked and won't be developed further (bar fixes).  \n\n**Go to [The new version using Staff Data](https://github.com/jonmorrissmith/RPi_DepartureBoard).**\n\n**Why is this being parked?** A great first iteration, however limited by the data available via the Public Departure Board API and required a re-write to optimise performance so the Staff API (which provides much more detail) could be used.\n\n**However** Do try this out - it works and is great fun.  And you can run this instead of or alongside the new version.\n\n## Try this version out and have fun!\n\nA way to build your own HUB75 RGB matrix train departure board powered by a Raspberry Pi.\n\nConfigurable via a light-weight web-page or the command line.\n\nYou can select:\n* All trains from a station\n* All trains from a station on a specified platform\n* All trains from a station to a specified destination\n* Or combinations of the above\n* Whether to show message.\n* Frequency of display update\n* Many other options...\n  \nDefault display:\n* The next train with calling points, operator and formation\n* The following two departures - destination and departure times\n* Any delay-related messages and cancellation reasons\n* Operator and number of coaches for 1st departure\n  \nOptions to display\n* Location\n* Departure platform\n* Estinated departure time for calling points\n* Any National Rail messages for the station\n\nComponents are a Raspberry Pi 4, a matrix-adapter (Adafruit RGB matrix bonnet), some RGB matrices and a power-supply.\n\nThere are some limitations with using this hardware which I suspect don't apply to commercially-available units.\n\nHowever for the cost it's a great result!\n\n# Motivation\nBeing a life-long train fan I've always wanted my own departure board, and as a regular commuter one which shows my usual route.\n\nOver the years I've looked at flip-dot displays and various other types and saw LED dot-matrix displays become available for purchase.\n\nThese look amazing... however the price is offputting, as is the monthly-subscription some require.\n\nMy thought -  _\"How hard can it be\"_.\n\nAnd here we are.\n\n# Hardware\n## The TL:DR\n* [Three P2, 5V, 128*64 pixel colour modules with a HUB75E interface from Ali Express](https://www.aliexpress.com/item/32913063042.html)\n* [A 1GB Raspberry Pi 4 from Pimoroni](https://shop.pimoroni.com/products/raspberry-pi-4?variant=31856486416467)\n* [Adafruit RGB Matrix Bonnet for Raspberry Pi from Pimoroni](https://shop.pimoroni.com/products/adafruit-rgb-matrix-bonnet-for-raspberry-pi?variant=2257849155594)\n* A 5V power-supply capable of delivering at least 5 Amps\n\n## Some RGB matrix boards.\nI purchased [three P2, 5V, 128*64 pixel colour modules with a HUB75E interface from Ali Express](https://www.aliexpress.com/item/32913063042.html).\n\nThree is a good size and three is limit for a chain of panels with the matrix library I used.  However you could have up to three rows of three.\n\nThere are a myriad sellers on Ali Express and elsewhere. I suspect there's little to differentiate between offerings.\n\n## A Raspberry Pi\nYou could purchase [a 1GB Raspberry Pi 4 from Pimoroni](https://shop.pimoroni.com/products/raspberry-pi-4?variant=31856486416467) - I'm not plugging Pimoroni, it's just they also stock the Bonnet.\n\nI used a Raspberry Pi 4 which was unloved and needed a new purpose. \n\n**Note** that the RGB matrix library doesn't yet work with a Pi 5. I'll update when it does as the increased power of the Pi 5 will be welcome!\n\n## An RGB matrix-driver \nThis project was built with an [Adafruit RGB Matrix Bonnet for Raspberry Pi from Pimoroni](https://shop.pimoroni.com/products/adafruit-rgb-matrix-bonnet-for-raspberry-pi?variant=2257849155594)\n\nSpecification on the [Adafruit site](https://learn.adafruit.com/adafruit-rgb-matrix-bonnet-for-raspberry-pi).  \n\nIf there are other mechanisms which folk can recommend then let me know!  \n\n## 16 way ribbon cable\nMost sellers provide these with the matrix panels. If you're making your own then your mantra has to be \"Short Is Good\".\n\n## Some power!\nI used a bench-top adjustable power supply to provide 5v and up to 5A for the matrix boards and the Raspberry Pi.\n\nThe nature of the panels means that current can vary quite wildly.  For the departure board with three panels it runs at about 1.5A to 2.0A.\n\nI'd recommend getting something substantial as the \"all pixels on\" power is just around 3.5A with my configuration... and let's face it, you're going to want to play about with it!\n\nThe [Words about power](https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/wiring.md#a-word-about-power) in the RGB Matrix documentation is worth a read.\n\n## Anything else on hardware?\nI'd highly recommend reading the detail on the [hzeller rpi-rgb-led-matrix - Let's Do It!](https://github.com/hzeller/rpi-rgb-led-matrix?tab=readme-ov-file#lets-do-it) documentation as it answers every question you can think of.\nIt's an awesome resource and fabulous software. More of that below!\n\n## Putting it all together\nDetails below are for the Adafruit Bonnet\n\nFor other adapters see the [RGB Matrix - wiring](https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/wiring.md) documentation.\n\n### Improving Flicker ###\nAs highlighted [here](https://github.com/hzeller/rpi-rgb-led-matrix?tab=readme-ov-file#improving-flicker) in the RGB documentation, an optional change to connect pins 4 and 18 on the hat/bonnet.\n\nI did this by soldering a row of pins to the bonnet and using a modified connector to make it easy to add/remove the modification.\n![Picture of pins and connector](https://github.com/jonmorrissmith/RGB_Matrix_Train_Departure_Board/blob/main/Images/Bonnet_Jumpers.jpg)\n\n### Address E pad modification ###\nAs highlighted [here](https://github.com/hzeller/rpi-rgb-led-matrix?tab=readme-ov-file#new-adafruit-rgb-matrix-hat-with-address-e-pads) in the RBG documentation, a change required for the size and type of panels I used.\n![Picture of soldere blob connecting the two pads](https://github.com/jonmorrissmith/RGB_Matrix_Train_Departure_Board/blob/main/Images/Bonnet_Soldering.jpg)\n\nAs a side note, I had to chop some pins off a connector on the Pi as they hit the bonnet - I suspect I may regret that at some point when the Pi gets used for something else.\n\n### Connecting to the panels ###\n\nOnly thing to watch for is to make sure that your ribbon cables are short and connect from 'Outputs' to 'Inputs' (should be labelled or have an arrow on the matrix boards\n\n### Connecting the power ###\n\nNoting the [advice about power](https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/wiring.md#a-word-about-power) in the RGB Matrix documentation.\n\nConnect to the panels and the 5v screw-connectors on the Adafruit bonnet to power to the Raspberry Pi.\n\nAs noted in the documentation, the Raspberry Pi doesn't have enough juice to power the panels.\n\n### Joining the panels together ###\n\nA chance to be creative!  \n\nTo get you started I've provided a very basic solution to 3D print joiners.\n\nYou can set the key parameters to create a joiner specific to your panels.\n\nMore detail in the [Joiner Directory](https://github.com/jonmorrissmith/RGB_Matrix_Train_Departure_Board/blob/main/Joiner/Readme.md)\n\n# Setting up the Raspberry Pi #\n\n## Install the OS ##\n\nThere are more tutorials than you can shake a stick at on how to install an OS on a Raspberry Pi.\n\nUse the 'OS Lite (64bit)' to maximise CPU cycles the matrix driver can use. Set up ssh and Wifi in the Raspberry Pi Imager tool.\n\nOnce installed there was the usual upgrade/update and disable/uninstall anything unecessary.\n\nI would strongly recommend following [using a minimal raspbian distribution](https://github.com/hzeller/rpi-rgb-led-matrix?tab=readme-ov-file#use-minimal-raspbian-distribution) for more detail.\n\nWhat is described what I did in March 2025. Detail in the rpi-rgb-matrix repository will be the most recent recommendations.\n\n* Set `dtparam=audio=off` in `/boot/firmware/config.txt`\n* Add `isolcpus=3` **to the end** of the parameters in `/boot/firmware/cmdline.txt` to isolate a CPU.\n* Example - `console=serial0,115200 console=tty1 root=PARTUUID=9f23843a-02 rootfstype=ext4 fsck.repair=yes rootwait cfg80211.ieee80211_regdom=GB isolcpus=3`\n* Remove unecessary services with `sudo apt-get remove bluez bluez-firmware pi-bluetooth triggerhappy pigpio`\n\nrun `lsmod` and to check for the snd_bcm2835 module.\n\nExample:\n```\n$lsmod | grep snd_bcm2835\nsnd_bcm2835            24576  0\nsnd_pcm               139264  5 snd_bcm2835,snd_soc_hdmi_codec,snd_compress,snd_soc_core,snd_pcm_dmaengine\nsnd                   110592  6 snd_bcm2835,snd_soc_hdmi_codec,snd_timer,snd_compress,snd_soc_core,snd_pcm\n```\nIf it's there then blacklist it:\n```\ncat \u003c\u003cEOF | sudo tee /etc/modprobe.d/blacklist-rgb-matrix.conf\nblacklist snd_bcm2835\nEOF\n\nsudo update-initramfs -u\n```\nThen reboot - `sudo reboot` to get a nice clean and sparkly install.\n\n**Note** At the rsk of stating the obvious, when adding options to `cmdline.txt` put them on the same line as the existing arguments. No newlines allowed.\n\n## Installing packages you'll need\nIn no particular order:\n* Git - `sudo apt install git`.\n* JSON for modern C++ - `sudo apt install nlohmann-json3-dev`.\n* curl (should be there already) - `sudo apt install libcurl4`.\n* curl C++ wrappers - `sudo apt install libcurlpp-dev`.\n\n\n## Install the RGB Matrix Software ##\n\nTake a clone of the RPI RGB Matrix repository - `git clone https://github.com/hzeller/rpi-rgb-led-matrix`.\n\nCompile the library\n```\ncd rpi-rgb-matrix\nmake\n```\nA pre-emptive read of the [Troubleshooting section](https://github.com/hzeller/rpi-rgb-led-matrix?tab=readme-ov-file#troubleshooting) will help you get ahead of issues.\n\nEnjoy the demos in the `examples-api-use` directory.\nIf you've got the configuration described here then you can start with this:\n```\nsudo ./demo -D9 --led-rows=64 --led-cols=128 --led-chain=3 --led-gpio-mapping=adafruit-hat\n```\nHave fun!\n\n# So what about the train data? #\nThere are two options - as far as I can tell the data available via both feeds is the same.\n\n# Rail Data Marketplace\nThis is the easiest of the two options. \n\n## Sign up \nGo to [raildata.org.uk](https://raildata.org.uk) and [register](https://raildata.org.uk/registerPartner).  \n\nIt's likely you'll fall into the **Individual not affiliated with a company** category.\n\nOnce you've got your acccount set up you need to subscribe to the data feed.\n\n## Subscribe to Live Departure Board data\nThe easiest way to find this is via the [Data Products Catalogue](https://raildata.org.uk/dashboard/dataProducts).  From here search for **Live Departure Board**.\n\nThe one you need is published by the Rail Delivery Group.  \n\nDon't use the 'Staff Version' as that isn't compatible with this software.\n\n## Get your API Key\nThe landing page for the Live Departure Board data has a **Specifications tab**.\n\nOn that tab you'll find the **API access credentials** - you need the **Consumer key**.  \n\nPress the `Copy` button and drop it into the `APIKey` field in `config.txt`.\n\n**Note** Make sure there are no spaces in the configuration - `APIkey=123456aVeryLongString`.\n\n**Note** Be sure to set `Rail_Data_Marketplace=Yes` in the configuration file. \n\n# Network Rail\nThis is more complex as the API uses SOAP - not ideal for C++ - so a proxy is required.\n\n[Huxley2](https://github.com/jpsingleton/Huxley2) is a cross-platform JSON proxy for the GB railway Live Departure Boards SOAP API. \n\nMore detail on [this site which includes a demo server](https://huxley2.azurewebsites.net).\n\nI've created a fork of Huxley2 for running locally on a raspberry Pi - [Huxley 2 for Raspberry Pi](https://github.com/jonmorrissmith/jonms-Huxley2) - or you can run [on Azure](https://unop.uk/huxley-2-release).\n\nWith the monochrome configuration below a install on the Raspberry Pi used for the RGB matrix doesn't affect performance.\n\n# The final Steps #\n\n## Installing the RGB Matrix Train Departure Board software ##\nDownload and build from this repository\n```\ngit clone https://github.com/jonmorrissmith/RpiTrainDisplay\ncd RpiTrainDisplay\nchmod 755 setup.sh\n./setup.sh\n```\nThis will build the software, create config files and ensure permissions are correctly set on directories.\n\n### And finally Cyril... and finally Esther ###\nStart the UI server\n```\n./run.sh\n```\nYou should see:\n```\nStarting server on port 80...\n```\nWhich means you can go to `http://\u003cIP address of your Raspberry Pi\u003e` and start using your display!\n\n# First Time Use - Basic Configuration\nSet the following in the UI\n\n## Location and Destination\n```\nfrom       \\\\ The station whose departures you want to show\nto         \\\\ Leave blank for all departures or populate for a specific destination\nplatform   \\\\ Leave blank for all platforms or populate for a specific platform\n```\n## Additional Information\n```\nShowCallingPointETD   \\\\ If set to Yes will display departure times after each calling point\nShowMessages          \\\\ If set to Yes will display Network Rail message for your departure station\nShowPlatforms         \\\\ If set to Yes will display the platform for the departures\nShowLocation          \\\\ If set ('from') will display at the bottom (alternate with Messages)\n```\n## API and Font Configuration\n```\nAPIURL                   \\\\ full URL for Network Rail data (i.e with the https:// header)\nAPIkey                   \\\\ Any API key you need to use (applied using x-apikey:)\nRail_Data_Marketplace    \\\\ If set to Yes will use the Rail Data Marketplace URL (and over-ride APIURL).\n```\n## Font configuration\n```\nfontPath  \\\\ Path to fonts - you can use the matrix package (/home/\u003cyour username\u003e/rpi-rgb-led-matrix/fonts/7x14.bdf)\n```\n## Timing Configuration\n```\nscroll_slowdown_sleep_ms=15     \\\\ Lower the number, the faster the scroll\nrefresh_interval_seconds=60     \\\\ How often the API is called to refresh the train data\nthird_line_refresh_seconds=10   \\\\ How often the third line switches between 2nd and 3rd departure\nMessage_Refresh_interval=20     \\\\ How often any Network Rail messages are shown\nETD_coach_refresh_seconds=4     \\\\ How often the top right switches between ETD and number of coaches\n```\n\n## Hardware Configuration\n```\nmatrixcols=128                             \\\\ Number of columns in an LED matrix panel\nmatrixrows=64                              \\\\ Number of rows in an LED matrix panel\nmatrixchain_length=3                       \\\\ Number of panels you've got chained together\nmatrixparallel=1                           \\\\ Number of chains you've got running in parallel\nmatrixhardware_mapping=adafruit-hat-pwm    \\\\ The hardware adapter you're using to connect the Pi to the LED matrix\ngpio_slowdown=2                            \\\\ Sometimes the Pi is too fast for the matrix.  Fiddle with this to get the right setting.\n```\n\n## Display layout configuration (vertical positions)\n```\nfirst_line_y=12     \\\\ pixel-row for the first line of text\nsecond_line_y=29    \\\\ pixel-row for the second line of text\nthird_line_y=46     \\\\ pixel-row for the third line of text\nfourth_line_y=62    \\\\ pixel-row for the fourth line of text\n```\n\n## Once you're happy with your configuration\nScroll to the bottom and click on **Save and Restart**.\n\nThis saves your configuration (to 'config.txt') and (re)starts the display.\n\nYou can **Save as Default** and **Rest to Default** to allow you to revert changes.\n\n# Advanced Configuration\nIt's unlikely that you'll need to change these, but they're available if you need to.\n\nDetail of the parameters is available [in the RGB Matrix documentation](https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/README.md#changing-parameters-via-command-line-flags).\n```\nled-multiplexing\nled-pixel-mapper\nled-pwm-bits\nled-brightness\nled-scan-mode\nled-row-addr-type\nled-show-refresh\nled-limit-refresh\nled-inverse\nled-rgb-sequence\nled-pwm-lsb-nanoseconds\nled-pwm-dither-bits\nled-no-hardware-pulse\nled-panel-type\nled-daemon\nled-no-drop-privs\nled-drop-priv-user\nled-drop-priv-group\n```\n\n# Additional Information\n\n## Making output less verbose\n\nSimply remove the `-d` option from the `Executable_command_line` line in `ui-config.txt`\n\n## Running on another port\n\nChange the port in `ui-config.txt`.\n\nNote that the executable needs root to access the RGB matrix.\n\n## Setting your configuration in the code \n\nYou can edit `config.h` to hard-code values for parameters which are in `config.txt`\n\nIf you do this then it's easiest to run\n```\nmake clean\nmake\n```\nwhich will recompile the executable with your defaults.\n\n## Command Line Operation ##\n\nFive options all of which also support a '-d' option for debugging information\n\nUse the hard-coded configuration in the executable\n\n`sudo ./traindisplay`\n\nUse the hard-coded configuration in the executable and specify origin\n\n`sudo ./traindisplay SAC`\n\nUse the hard-coded configuration in the executable and specify origin and destination\n\n`sudo ./traindisplay SAC STP`\n\nUse the configuration file\n\n`sudo ./traindisplay -f \u003cconfig file\u003e`\n\nCombination of the above\n\n`sudo ./traindisplay SAC STP -f \u003cconfig file\u003e -d`\n\n# Troubleshooting #\n**RGB Matrix Issues**\n* [Changing parameters](https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/README.md#changing-parameters-via-command-line-flags)\n* [Troubleshooting](https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/README.md#troubleshooting)\n\n**Software Issues**\n\nThe most fragile part of the software is the parser.  \n\nYou can test this using software included in the distribution built using `make parser_test`.\n\nRunning `traindisplay` with the debug flag dumps results from API calls into the tmp directory.\n\nYou can test the parser against this data using `./parser_test -data /tmp/traindisplay_payload.json`.\n\nOther options are available:\n```\nUsage: ./parser_test -data \u003cstring\u003e [-platform \u003cstring\u003e] [-clean \u003cstring\u003e] [-f \u003cstring\u003e] [-debug \u003cstring\u003e]\n-data \u003cfilename.json\u003e   json data file\n-platform \u003cstring\u003e      select a platform\n-clean \u003cy/n\u003e            remove whitespace\n-f \u003cfilename.txt\u003e       file (not currently in use)\n-debug \u003cy/n\u003e            switch on debug info in the parser code\n```\nFeel free to raise an Issue here and I'll try to help - attach your `config.txt` and `debug.txt` created using \n```\n./parser_test -data /tmp/traindisplay_payload.json -debug y \u003e debug.txt\n```\n\n\n# Huge thanks to... #\n\n[James Singleton's Huxley2](https://github.com/jpsingleton/Huxley2)\n\n[Hzeller RPI RGB LED Matrix](https://github.com/hzeller/rpi-rgb-led-matrix)\n\n[Nlohmann JSON for modern C++](https://github.com/nlohmann/json)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonmorrissmith%2Frpitraindisplay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonmorrissmith%2Frpitraindisplay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonmorrissmith%2Frpitraindisplay/lists"}