SF Muni countdown display

Why should you have to go to the streetcar stop to find out when the next streetcar is coming? Sure, you can check NextBus, but you don't want to take time to check your phone or computer when you're trying to get your butt out the door.

Here's how it started: Casey ordered 5 meters of individually addressable LEDs on a strip. After he received his 5 meters of LEDs, he began to ponder the question "what awesome thing should we do with 5 meters of individually addressable LEDs?" I, on the other hand, was thinking through our daily routine, asking the question "what is a shared pain point we could address?" One day as I was leaving the house and navigating through the cumbersome NextBus website, I realized that I was always looking for the same thing, but had to scroll through a bunch of irrelevant information to find it – and I had to keep my phone nearby as I darted from room to room, putting on my jacket, doing my hair, filling my bag with the things I needed.

What if we used our LEDs to make transit information as accessible in our house as it is at the station?

We spent an afternoon at SudoRoom thinking the display through. Here's the thing: we live in a very good spot for public transit, so we get a little lazy. We live a 10-minute walk from a Bart station, and Bart comes at least every 10 minutes on weekdays. This would be enough to make most San Franciscans pretty happy. However, we're only a 2-minute walk from the Muni J-Church streetcar, which converges with the Bart downtown. It's a prettier ride and it's less crowded. The catch is that it comes much less often than the Bart, plus it's a bit slower, so we really have to get the timing right.

We realized that we need to know three things:

  • When's the next J-Church streetcar, and can we make it in time?
  • Is Muni screwed up in some way – do we need to check the website?
  • Is Bart screwed up in some way – do we need to check the website?

We actually don’t need to know when the next Bart is. So long as Bart isn’t really screwed up, we can trust that we’ll catch a train pretty quickly.

Casey programmed the lights in Python, wrangling two different APIs to show both Bart and Muni information. (Yes, they're different agencies. Don't ask.)

We got these LEDs. They're not super high quality, but they're half the price of the nicer ones. It's worth noting that they took a month to arrive from China.

The power supply is an old 5-volt power supply we scavenged a from Noisebridge junk bin; since the lights were going to be stationary, plugging it into the wall was by far the easiest thing to figure out. The LEDs draw very little current – .5 A at most.

And the code runs on a Raspberry Pi. Here's a word from Casey on making this work:

These strips are a dream to work with on the Pi. They talk SPI, so they don't require any sophisticated timing code, and they are 3.3v sensitive, so no level shifting needed. There is already an existing library, but it had a lot of deficiencies so I made it better. The code is split in to two threads - one updates the LEDs, the other occasionally polls the various transit agency APIs for updates.

Electrically, you just connect the MOSI and SCLK lines from the Pi to the Data and Clock lines, respectively. The Pi's voltage regulator isn't sufficient to power the strips, so you definitely need a separate power supply. It's also important to tie the grounds together, otherwise the signaling will be unreliable.

We put a piece of masking tape on the LED strip, made dots where the LEDs showed through, and transferred the tape onto a balsa board to make a quick mockup.

The Muni countdown is in three colors. Yellow means that the next streetcar is so far away that it would be faster to take Bart. Green means that, if you leave now, you'll hit the streetcar just right. Red means that the streetcar is almost there, and you would have to really haul in order to make it.

We drilled holes, positioned the lights behind the holes, and taped the lights and the cable to the back of the board. The final step was to clean up the face plate a little. I could have gone full graphic design on this, but I kept it pretty simple. The balsa was a pain to work with, and we were eager to get this thing up and running. So we cleaned out the raggedy holes with an exacto knife, covered the rough edges of the board with brown washi tape, and added a few labels.

The result? A display right in our front hall that uses 17 lights to display an awful lot of information. (Suck it, screens!) Rather, it displays just a little information, but that's enough to help us make several decisions very fast: should I take Bart or Muni? Can I make Muni? Do I need to check the internet because some crap is going down?

If you want one of these for your house, grab our code, customize your display as needed, and make it happen!