Building a Giant Light up MBTA Map
I ride the subway every day. That gives me a lot of time to think about the T. Mostly little things like ugh why are there so many people... or The destination of this train is... BRAINTREE!. Sometimes those thoughts turn a little more productive like wouldn't it be really cool if there were little lights to show where your train is on its route?
Well... that's what I ended up building. A really big map with a ton of really cool RBG LED lights.
This project was done during Carbon Black's quarterly R&D hackathon. We're allowed to work on whatever we want; it doesn't have to be work related at all (clearly!). I teamed up with Zenas Lu, a UX Designer, to build the whole thing over the course of the three day hackathon.
Planning and Material Choices
To start, I had to address a number of logistical challenges. Primarily, the sheer number of stops in the system. I figured there were probably 70 or 80 max. Turns out there are 145. My original plan was to not only have lights at each stop, but also between the stops to indicate approaching trains. That would likely mean around 300 LEDs so... no thanks. LEDs on the individual stops will be just fine.
At the previous hackathon some people had some success with the neopixel strips from Adafruit. Unfortunately those strips are not very flexible. Literally. Bending them into the shape of the map would be unbelievably tedious. Adafruit does sell a through-hole version of the LEDs which could have been perfect... but buying 150 of them is really expensive. Not to mention that I would lose my mind soldering together that many LEDs!
After some more research I learned the a "neopixel" is just the brand name of ws2812 LEDs. Our friends over on AliExpress have us covered. I bought pre-wired (note: WIRED, not plastic taped!) LEDs... 200 of em for around the cost of one strip of the neopixels
Powering 200 LEDs isn't easy. Each LED draws around 60 mA. Individually not that much, but lighting up 150 of them requires a cool 9A. I found a pretty cheap power supply on amazon that can provide a regulated 5v 12A current. This higher powered supply leaves enough capacity to also run a raspberry pi for interacting with the mbta apis. A regulated power supply is important as voltage spikes above 5v will damage the LEDs.
Full Materials List
- A large print of the MBTA subway map (mine was 36x36)
- Foam board for a backing
- RGB LEDs
- 5v 12A power supply
- Miscellaneous lengths of wire
- Mini USB cable
- FadeCandy controller
- A lot of electrical tape to secure the LEDs
- Spray adhesive to attach the map to the backing
- A drill and bit that roughly corresponds with the size of the LEDs (3/32 worked for us)
The first task was to assemble the wiring for the power supply. We liberated a power cable from the supply drawer, cut off the end, and wired it in. Very carfully we plugged it into the wall. Nothing sparked or smoking! A read of the output showed the expected voltage and amperage.
Next up was verifying that the LEDs actually worked. It had been a long time since I had done any soldering. I'm definitely not proud of the job we did, but against all odds it does seem to work. If I were to make another one I would definitely get a set of helping hands to hold things in place. That and some real spools of wire... The wire in the LEDs resisted all attempts to twist the strands into a reasonable package for soldering. Fortunately all the grounds were shared since I think one of those leads ended up breaking!
So it's definitely not elegant, but it does work. We plugged the board in and much to my surprise it was instantly recognized by the OS and could be passed through to the VM I set up. After running the
fcserver program and loading the web interface all the lights miraculously lit up!
With the lighting situation under control we set off building the physical map. First up was gluing the map to the foam board. The spray adhesive made quick work of that.
After letting the glue dry we started the painstaking process of drilling all of the holes for the LEDs. We drilled many test holes in a spare sheet of the foam board. In the end we found that the 3/32 bit in reverse was the best way to get good clean holes. Any larger and they didn't not come out cleanly. Doing the drilling in reverse also helped make the front side turn out cleaner.
145 holes later we were ready to actually install the LEDs. I was originally planning on hot gluing each one in place. Fortunately Zenas convinced me to use the electrical tape instead.
The ability to reposition some of the lights after seeing how they looked was crucial. More than that, if we had glued them then splicing in a new LED when we discovered that one was missing would have been near impossible! (whoops)Here's a fun game, let's play spot the unlight station
All that remained was the little matter of writing the software to actually control the LEDs. I wrote a simple program to light each LED in sequence. This allowed us to generate a mapping of station to LED number. Very conveniently a coworker had just written a python wrapper around the MBTA data apis. From there it was really simple to query each vehicle, see what stop they're at, and set the LED color.
Seeing the stations all light up was really cool! We did it! There was one problem though, you couldn't actually make any sense of the data. It might look cool, but it doesn't mean anything. To help make the visualization more useful we added an indicator light at the bottom to show what direction the trains are moving. The inbound trains light up, then the outbound. At each station a solid light means a train is stopped, and a flashing light means that one is approaching.Hackathon promotional video