Underlying this is a simple JSON API that, while not public, seems to be usable by the average programmer as long as I'm not abusive. So with its details deciphered (hardly hard since the web site uses the API) I set about building an ambient bus monitor into a model London bus. The idea is that I can glance at the bus and see the times of up to the next two buses that I'm likely to want to catch and know when to leave the house.
Here's a picture of the completed unit:
Raspberry Pi. But with the delay in being able to buy one I switched to another host: a hacked Linksys WRT54GL. It's possible to reflash the Linksys with a custom Linux installation that lets me control the box completely (and still use it as a wireless router). There are various project, but I used OpenWRT.
With OpenWRT it's possible to SSH into the box and treat it as any Linux server (albeit a rather slow one). But there's plenty of power to grab bus times and update an LED display connected to the WRT54GL's serial port. Yes, there's a serial port inside the WRT54GL that uses TTL levels and can be easily accessed by soldering on three wires.
First you remove the cover of the router. It's easy because it simply pulls apart, but first you have to cut through a sticker warning you that your warranty is about to end.
LED module I'm using is from SparkFun and accepts TTL levels and needs a 3.3V power supply.
homemade matrix display made from hacked Christmas lights).
A quick test with the multimeter showed that I was getting about the right voltage:
It relies on STTY so install it with apt-get install coreutils-stty so that it can set the serial port up correctly. On my box that second serial port is /dev/ttyS1.
The program has three parameters: a comma separated list of bus routes, a bus stop number and a 'walking time'. For example, it's possible to do:
lua ambibus.lua 3,12 50906 2Which means get the times for buses 3 and 12 arriving at stop 50906 (close to No. 10 Downing St.) and allow me two minutes to walk there. The program will find the buses, adjust the times by 2 minutes to allow you to arrive and once a minute update the display with the times of the next two buses.
Next up is a nice case for the display. What better than a London bus. I chose a Plaxton Pointer as it was the right size for LED display to show through the side windows.
I prised the top off using a screwdriver to reveal the plastic window piece: