Make Your Own MTA Subway Train Arrival Countdown Clock

Using Arduino, Python, and AWS

Click to go straight to the GitHub repo with explicit DIY instructions

Arduino (ESP-32) Subway Clock

The year is ~2018. I take a class at my local hackerspace, NYC Resistor. They give a little presentation about the history of IoT devices. They guide us through breadboarding our own little MTA train time arrival clocks, which behave like the ones on the ceilings at Subway stations—except it sits on your desk, or whatever. Neat!

The kit they prepare for us consists mainly of an ESP32 Arduino module (which has WiFi), a tiny OLED screen, and a bunch of great C++ code to parse the MTA’s nasty protobuf feed with the esp32's limited memory. I think Trammell Hudson had something to do with the original design.

Fast forward to 2021: The MTA’s protobuf feed spec has changed a bit, so my tiny countdown clock goes into disrepair. I’m unable to debug the Arduino GTFS parsing code on my own—not even with online support from more experienced C devs. I am still simply not a terrific C programmer, and the GTFS spec boggles my mind.

My friend, the magnificent cinematographer and general brainiac Zach Kuperstein, then points me to Jon Thornton’s repo for MTAPI, a flask app: It handles the hard parts of querying the MTA’s hard-to-use API and spits it out again as a nice new RESTful API. A gamechanger! Now our Arduino/C++ code can be really simple.

So I spin up an ec2 instance to run this Thornton-style MTAPI Flask app, and Zach writes the Arduino to query the new server and render arrival times on the little monitor. Zach even designs CAD models for 3d-printable enclosures with AutoDesk Fusion. Thanks Zach!

All of the code and instructions are public on GitHub. Enjoy!

Data Scientist // @cinemarob1

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store