A real-time LED transit arrival board for Clevelanders
This project is a modded Cleveland version of the dc-metro transit board. It uses the same hardware and general display, with capability to poll the Greater Cleveland Regional Transit Authority live trip updates and ⌚.
It uses a friendly version of Micropython (which is Python meant for embedded devices) called CircuitPython. CP is developed by the makers of the hardware, Adafruit, who makes and sells educational and hobby electronics/coding products, provides great resources and is woman-owned in NYC. Check em out.
- An Adafruit Matrix Portal - $24.95
- This is a single board microcontroller, a.k.a. a small computer
- A 64x32 RGB LED matrix compatible with the Matrix Portal - $39.99 to $84.99
- 64x32 RGB LED Matrix - 3mm pitch Smallest, finer grid
- 64x32 RGB LED Matrix - 4mm pitch
- 64x32 RGB LED Matrix - 5mm pitch
- 64x32 RGB LED Matrix - 6mm pitch Less dense pixels, but bigger (15" x 7.5")
- A USB-C power supply (15w phone adapters should work fine for this code, but the panels can theoretically pull 20w if every pixel is on white)
- A USB-C cable that can connect your computer/power supply to the board
- Prep the MatrixPortal and LED board using Adafruit's guide.
- Install CircuitPython. This project works for Circuit Python 8.X. and will not work on the 9+
- Click Browse Previous Versions and download a copy of CircuitPython 8.X. You can also use the .UF2 file in the root of this repo for 8.2.7.
- Set your board into bootloader mode (double-tap reset), and drag the file onto the mounted drive. (see instructions on Adafruit for details)
- Drag (copy) the
src/lib
folder from this repository onto CIRCUITPY drive. - Drag (copy) all the individual Python files inside
/src
onto CIRCUITPY drive. Do not copy the folder itself.
At this point your CIRCUITPY drive should look like:
I:\
│ api.py
| code.py
│ config.py
│ secrets.py
│ time_set.py
│ train_board.py
│
└───\lib folder, including all files in it
- To connect to internet, you need to open secrets.py and add your wifi ssid and password to respective
secrets
dict keys that say"enter_your_info"
. - Register for an adafruitio account and get a username and API key. The board needs to regularly synchronize its onboard clock using a free time service through adafruit io. It's free and intended to support hobby projects.
- Add your aio username and API key to the
secrets
dict in secrets.py.
The board will reload and start showing you default routes! You now need to configure it to show your desired stops/routes.
- Each route/stop/direction combination requires a Python dict with these 3 key:values. The 3rd key, params, is a nested dictionary object with 6 key-values.
- route_name: str, what will display, like "26" or "HL"
- route_color: int, hex color for bar (e.g. 0xff0000 for red)
- params: dict, GCRTA's Live Departure service request parameters, explained below
- 'routeID': ⚠ Get from Live Departures
- 'directionID': ⚠ Get from Live Departures
- 'stopID': ⚠ Get from Live Departures
- 'cutoff': int Trips arriving sooner than this time will be tossed out because they are impossible to reach the stop in time
- 'tpID': 0,
- 'useArrivalTimes': 'false'
The board can only fit 3 rows on it. If you are fetching more than 3 routes, it will display the 3 soonest arrivals in order of their arrival
-
Go to Live Departures on GCRTA homepage. This service is powered by web service that delivers live departure updates from RTA's TransitMaster system, which is the central brain of RTA's operations, scheduling, and serving the RTA real time feed. This board essentially simulates using the RTA website. You need collect 2 lists of route config entries: one for each direction of the route.
-
For each route/direction/stop combo, you need to:
- Enter the desired route, direction, and stop on Live Departures.
- Open devtools for your browser (Ctrl + Shift + I) --Chrome is recommended if you aren't familiar with this
- Go to "Network" tab
- Wait up to 15 seconds for the browser to fetch the update again (it automatically does this)
- You should see a network action appear called getStopTimes. Click on it
- Click on Payload
- Use the parameters from that payload to fill out the
params
dict in the desired route dict.
Store the first set of config entries in
routes_in
list.Collect the same information for the opposite direction in
routes_out
list. Seeconfig.py
for details.
- Upon saving your
config.py
with your desired routes, the board will reboot and populate with your configured route/direction/stops.