Hacker News new | past | comments | ask | show | jobs | submit login
Ambient bus arrival monitor from hacked Linksys WRT54GL (jgc.org)
273 points by jgrahamc on March 17, 2012 | hide | past | favorite | 48 comments



Amazing.

Unfortunately it makes me sad to see so nice ways of using the public transport data - and having it not available everywhere where I'd care.

In Cologne/DE I actually sent mails and calls to a bunch of contact addresses (both technical and marketing/customer service) and tried to get access to similar data for the bus and subway lines. They .. don't get it. Open data seems to be scary..

Well done, this project is technically interesting and looks decent enough to sit in a room that is partially controlled by my SO _and_ it's useful. Full points.


The MBTA in Boston MA opened up their real-time feed to developers 2 years ago. I entered a moving clock face that provides "glancable" bus arrival times in a contest they had and won!

http://groups.google.com/group/massdotdevelopers/msg/7cab0ae...

I never produced more than the one prototype. Maybe I should do a kickstarter to see how many people would want one.


Open Data is scary and can vastly undermine the companies - most of European public transport is done by public tenders. You want to be able to provide what's required as cheaply as possible. That means as few busses and more important as few drivers as possible (labor costs are the highest). If the contract is up for grabs and your competitor can see how many busses you need at any given time for instance, that means a tremendous win. Sure it's still a bad argument, but there is some say for threatening their business.

Here in the Netherlands lots of the tenders/contracts contain provisions for providing the data to "regional or national transport planning systems", which is a very vague stipulation, and it's still hard to get data providers to provide the data.

A great site for GTFS based data (maybe including your city?) is http://www.gtfs-data-exchange.com/. Use data from it and https://github.com/openplans/OpenTripPlanner/wiki/ to build a trip planner for your city in an hour.


Wouldn't open data make a bus company more popular to another one that does not release its data to the public? But here in Colone there is only one bus company, which might be the reasons why there is no public API---why put extra effort if there is no competition?


This article last week highlights how research in Chicago has shown that publishing live data and releasing an API has increased ridership: http://www.theatlanticcities.com/commute/2012/03/do-real-tim...


We only got this late last year in London. They have had the data for years for displaying arrivals times at selected stops. I think they selling point might be that tourists use apps to help them get around and will use buses more if they can understand them. Buses are always confusing when visiting places.


Similar problem in Vienna/Austria. They actually used to make their data available upon request, which meant proper Google Maps integration, etc. Via some backroom deal, the data is now only available to one company which has done a terrible job of putting user interfaces (mobile apps, web site) on it.


Have a look at the Öffi Android app: http://oeffi.schildbach.de/

That guy somehow figured out how to get the data for a lot of cities, Cologne being one of them. Maybe he knows how to get it.


As far as i know he just parses the websites of the different public transportation services.

Some of the techies behind those sites were kind enough to provide him with a url parameter so they know where the spike in traffic comes from.

In addition, all he got is the non-live data. In the article the live data from every bus station is used.


Actually, fyi, the company that is responsible for most of the schedules and time tables is hacon, and the system they offer is called hafas. If you search for the term, you'll find that many, if not most, european transportation providers rely on them for their services. That's why I can search for a train in suburban france using my deutsche bahn-iphone app. it would only be a matter of understanding that one api and the data would be open ( without any screen-scraping or other hacks involved ).


A friend of mine started to reverse engineer the API, that the DB-Navigator App uses, as it covers pretty much every public transport in Germany and at least trains (and sometimes trams and buses) in all of Europe. It can even give you a route to Pjönyang, North Korea. I don't know how successful he has, though.


Same here in Italy. They're just starting now to understand that OpenData is the way to go, but it's a looong road. I know that there's also a European multi year program, I hope something will happen..

ps Great hack John!


I just wrote to a bunch of addresses in the Frankfurt/DE area, asking for that kind of data. I hope i'll get more response than you did.


We emailed them (in London) for access to this data some time back. We were told that the powers that be wanted to create their own services first (before opening the data to the public), the main one of which, unbelievably, was to be a "text for your bus time" type service.


Hacker News often leaves me jealous of someone's programming skills, but this has made me realize that electrical engineering feats more often lead me to say "I wish I could do that".


Start by not being afraid. This stuff is pretty accessible these days.


That's a fantastic hack! I have just one question, how did you use stty to talk to the serial port with Lua? I have a LEGO Mindstorms set I want to program, and I flashed pbLua on it and am building a little framework to talk to it, but it's having trouble sending lots of text to the serial port (the brick freezes).

What I'm doing is similar to what you are (as far as I know, anyway, I'm pretty new to Lua), which is just opening and writing to the socket. I can get/send text, but I'm wondering if there's some other mysterious setting I need to change for it to work. Also, since this is serial over USB, I'm not sure if it's the same thing at all, actually...


> how did you use stty to talk to the serial port with Lua

The stty being used is the command line program. You can find it on any regular Unix box. It is used to set baud rate, stop bits and similar details, not to do the actual communication which should work just fine once the parameters have been set correctly.


No, I understand that. I'm just unsure whether there's a parameter that can make my terminal hang or whether it's completely irrelevant due to the USB connection.

In my Lua code, for example, I have to pause a bit every line, otherwise it hangs. I'm wondering if that's normal.


Great hack. Slight diversion but I just bought that router a few weeks ago, flashed it with Tomato Speedmod firmware [2], and love it. First router I've owned in years that is fast, has no lag, no drops, no hangups, and is completely trouble free. Plus, Linux (ssh, etc). I think that's due to the combination of stable, reliable hardware and continually evolving OSS firmware [1][2][3][4]

It also occurs to me the extent to which software can squeeze every ounce of power and performance out of even old hardware, but requires time to evolve and optimize (the last 20% of performance/reliability requires 80% of the work, but makes a big difference). Hence, this 2004 router is better than any other router I've owned since then. And I'm not alone in that assessment, as positive reviews are still rolling in weekly [5][6].

In Bill Gate's day, 640k was enough for any good programmer. Eg, systems were hardware bound. But now that appears reversed, and in many cases systems don't reach the hardware's limits simply because the software isn't given enough time to evolve and optimize. By the time the software gets to, say, 80% of the hardware capability, the model is discontinued for a shiny new one, but with software that's starting over again on a new platform.

Thankfully that's not always the case, as with this router, or all of Apple's products for instance.

1. Tomato: http://www.polarcloud.com/tomato

2. Tomato speedmod: http://touristinparadise.blogspot.com/2008/04/linksys-wrt54g...

3. OpenWRT: http://openwrt.org/

4. DD-WRT: http://www.dd-wrt.com/

5. http://www.newegg.com/Product/Product.aspx?Item=N82E16833124...

6. http://www.amazon.com/Cisco-Linksys-WRT54GL-Wireless-G-Broad...


I bought a "Linksys by Cisco" router thinking "no more generic china routers, this thing will work so well out of the box yay" and it was crap (WRT160N). I also had to install DD-WRT in it (because it would slow down after a while), but most people will just live with a slow router.


I considered that one also, but its Amazon and Newegg reviews made it clear that despite the fact that the WRT160N is positioned as the successor the WRT54GL, WRT54GL > WRT160N.


Bought mine in a physical store! Imagine that


I thought this article was going to be about how he hid a Linksys WRT54GL on the actual buses to gather the real-time bus data himself! <:)

One could hide Raspberry Pi devices on the buses that are programmed to geolocate using Wi-Fi networks along the bus route and then opportunistically use any open Wi-Fi networks to upload their current position.


Connecting to Wi-Fi on the run is probably not feasible most of the time. DHCP is slow on most residential routers.

Maybe it could work by cheating (e.g. sending UDP packets to multiple common IPs of routers, like 192.168.{0,1,2,3}.1, without waiting for DHCP), but the auth frame exchange alone would probably take too much time.


I haven't tried these tips myself but they are supposedly making access to wifis from a bus a real possibility: http://syn.theti.ca/2008/10/25/wifi-roaming-on-the-move/ .


Great hack. For the Canadian folks here is the open data initiative with similar APIs http://toronto.ca/open. Likes for Ottawa, Edmonton and Vancouver are on the right.

[Edit] Direct link for North America http://www.nextbus.com/predictor/agencySelector.jsp


The apk you are looking for is One Bus Away. It does this for Seattle only.


Nice, never thought of using a stereo head phone jack as a serial adapter.

Does Lua really have no way to put the current thread to sleep? does that busy loop affect the routers capabilities to route?


Lua can sleep no problem.


A small ISP could copy this and turn it into a great publicity hack.

Imagine a display that is pre-configured with their router for your address. That definitely would get press coverage.


Very nice!

I've been very interested in mobile bus times, so I built better mobile sites for live bus times from:

Oxford - http://www.oxbus.co.uk

and

London - http://londonb.us

They both harvest live bus arrivals data from the relevant providers, then send it out based on the user's location - basically, it's a really quick and easy user experience when you're out and about and want to know how long until the next bus at a nearby stop.


I wish there was stuff like wrt54gl with just a bit more hardware IO and ram/storage. RaspberryPinis halfway there but it is more of a conventional PC.

Maybe something like a beaglebone with half the MHz would be good.

I've been using TP-link 703n for projects - wifi, USB, Ethernet, and about 2x the storage of a wrt54gl. Different archtecture so half the packages under openwrt are missing.


I was just doing some research in the past days for linux/bsd based router (I need it for OpenVPN), and i found:

- some lowcost TP-link wifi routers that can use openwrt / ddwrt like the one you used [1]

- a Buffalo router that seems to ship already with ddwrt, and of course you can upgrade it too to newer versions [2]

- the Miktrotik Routerboard devices, really lowcost but runs a modified linux os so I dont think they're ok for you (afaik you can just do some scripting) [3]

- many appliances that can run pfsense but are not so cheap[4]

I'm still tryin to understand, if I choose a wrt solution, what's best between openwrt and ddwrt (it seems there are sometimes problem with wifi not working etc..)

[1] http://www.tp-link.com/en/products/details/?model=TL-WR1043N...

[2] http://www.dd-wrt.com/wiki/index.php/Buffalo_WZR-HP-G300NH

[3] http://routerboard.com/

[4] http://www.applianceshop.eu/index.php/firewalls/opnsense/opn...


Main difference is cli vs web, really.

What are you tying to build? You might try a routerstation (pretty buff for a router) or even PCEngines Alix (which is x86 geode based and has a LOT more ram and uses CF for storage.)


I need a VPN endpoint for a small office (max 3 users), unfortunately I must put it behind another router that allows only tcp/udp port forwarding, so I cant use pptp or ipsec. I'm thinkin about using one of the above solution as an OpenVPN appliance.


Check into a PCEngines ALIX. You can run full OpenBSD or whatever on them.

Example: http://www.ebay.com/itm/PC-Engines-Alix-2D2-Full-Kit-/280832...

Unfortunately, it appears that the Routerstation has been discontinued.


From the headline, I was hoping that this would somehow use the hacked access point to listen for some sort of WiFi signal from the busses and be able to measure when they are nearby (rather than fetch that information from a Web service).


Sounds really interesting, but I was unable to read the post at much length. The mobile version of your site (reading from iPhone) seems to want to activate strange gestures half the time when I scroll.



It'll be up... it's managed by CloudFlare.


The first time I tried it was down. I got some error, maybe its because it was looking for the mobile theme.

FYI, I just received the following:

ERROR

The requested URL could not be retrieved

Sorry, we can't open the web page that you requested because the server hosting the web page might be unavailable.

Possible solutions:

- Try again later.

- Contact the web page administrator.

Error Code: 10005


Totally awesome! I live in London and use the TFL website every day, but had no idea the live bus departures thing existed.


m.countdown.tfl.gov.uk is the mobile version which last time I looked wasn't obvious from the website.


Anybody has a reference for the JSON API referenced in the article?


He links to the site that uses it. It's not hard at all to use your browser's developer tools to inspect the requests that site is making and find the one that returns a JSON list of all the busses for a given stop. Give it a shot, no reference needed.


Cool hack, nicely done!


Could you use this data feed to enable ferrying little autonomous quadcopters around london on the roofs of buses and just get them to make short hops from bus to bus to save on power when getting about?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: