- Display times for arriving trains at any NYC subway station
- Rotate through time displays for multiple stations
- Image of display
- Video of display
- Disruptions Screen
- Raspberry Pi (Pi 3 Model B or later recommended) with internet access over ethernet or WiFi
- Do not overclock it (can cause screen issues)
- SD Card (8GB Class 10 or better)
- LED Matrix. I used this Adafruit one, which is 64 x 32 with a 5mm led spacing
- Adafruit RGB Matrix driver. I used this one with the RTC, but you should be able to use the regular one.
- Adequate power for the display and Pi. This adapter should work great.
- It's worth noting that my display is configured with 2A to the hat and 500mA to the Pi over USB. It works using lower brightness, but there is some flicker.
- Appropriate peripherals (Display, keyboard, mouse, etc) or SSH enabled by default.
- Install Raspbian (No desktop environment needed)
- Keeping the default user "pi" will work best, as that is what's configured in packageinst.sh
- You may still change the default password
- If are advanced and you wish to use a different username, modify packageinst.sh for the new paths.
- Enable SSH
- Get an MTA API key here.
- Install Python 3 (likely installed by default) and PIP (you likely will need to install) on the Raspberry Pi (For retrieving packages)
- Follow this Adafruit guide to get the examples running on your display.
- You can pick between quality and convenience, both work for the purposes of this guide.
- Ensure that you are able to run example 0 (the rotating cube) before continuing.
- If the display works for a second and then shuts off, you may not have sufficient power.
- If there is severe aliasing or flickering, experiment with different values for --led-gpio-slowdown. I used --led-gpio-slowdown=2
- At this point, I'm assuming that you have the rotating cube demo file working. Your file structure should look like /home/pi/rpi-rgb-led-matrix/bindings/python/samples/
- We will be keeping this file structure during this guide for the sake of simplicity.
- Move the files rundisplay.py , mtacalls2.py (be sure to add your API key in the two places) , stops.csv , and packageinst.sh to /home/pi/rpi-rgb-led-matrix/bindings/python/samples/
- Using FileZilla over SFTP is the reccommended way to do this.
- In your SSH window, change directory to our main directory
- cd /home/pi/rpi-rgb-led-matrix/bindings/python/samples/
- Run packageinst.sh (You may need to make the file executable using the command below)
- sudo chmod +x packageinst.sh
- sudo ./packageinst.sh
- Check your work. You should see lots of new folders in the /home/pi/rpi-rgb-led-matrix/bindings/python/ directory.
- First, make rundisplay.py executable
- sudo chmod +x rundisplay.py
- Then, run the code (Modify this code as needed for your display).
- sudo ./rundisplay.py --led-rows=32 --led-cols=64 --led-slowdown-gpio=2 -b=30
- You should see train times appear after a few minutes of the code running. You should see the times appear on your terminal window as they are loaded by the API as well.
- If this works, jump to the customization section. If not, follow the troubleshooting section.
- Ensure whatever file you are trying to run is executable
- sudo chmod +x filename.abc
- Ensure all python packages are loaded
- Ensure you entered your API key probably
- Recheck whether you can run the rotating cube demo file
- edit mtacalls.py using nano to add the below line:
- print(totalstationtimes("A41"))
- then, run mtacalls.py
- sudo python3 mtacalls.py
- you should see train times print out after a few seconds. If you don't, and you see a python error, search the error on stack exchange.
- Use stops.csv to find the code for your desired station(s). Use only the first three letters.
- e.g, 232 for Borough Hall, or A41 for Jay St-Metrotech.
- Note that the station names for some stations in stops.csv have been shortened to fit better on the display.
- Ensure to change the data links on line 10 of mtacalls.py if your station is not on the 1,2,3,4,5,6,A,B,C,D,E,F,M
- You may also need to edit the c value in lines 140 and 142 of rundisplay.py to reflect the number of stations if you are not using 3.
- Modify the time filter for how long it takes you to get to your station (change mintoarrival on line 51 of mtacalls2.py)
- Modify the font - I like the font spleen. Change on line 56 of rundisplay.py
- Edit /etc/rc.local to make the display start on boot and run continuously
- See example rc.local file
- I also recommend creating a cron job that reboots the pi automatically every day. This will help with stability.