Picture frame that scrapes train times from the web

rpi-train-times-fixture

Whenever [Gareth James] needs to catch a train he has only to push a button on this frame and the next three departure times will be displayed. As you can see from the post-processing in the photo, this is accomplished by a Raspberry Pi board using a few familiar tools.

Let’s take a look at the hardware first. He acquired a 7″ LCD display which he removed from its plastic case. The bare screen will easily fit inside of the rather deep wood frame and its composite video input makes it quite simple to interface with the RPi board. There was a little work to be done for power. The LCD needs 12V so he’s using a 12V wall wart to feed the frame, and including a USB car charger to power the RPi. The last thing he added is a button connected to the GPIO header to tell the system to fetch a new set of times.

A Python script monitors the button and uses Beautiful Soup to scrape the train info off of a website. To get the look he wanted [Gareth] wrote a GUI using tkinter. Don’t miss the demo after the jump.

If you need a bit of a primer on scraping web data take a look at this guide.

22 thoughts on “Picture frame that scrapes train times from the web

    1. Raspberry Pi seem to me to be a really good fit for some rendering and a little bit of web scraping. I don’t see how you could do that cheaper in a stand alone device (in new parts) without going to ridiculous lengths. Rpi + memory card is like $40-50 (shipped), hardly a problem for most westerners with a day job and no kids, well worth the convenience for many.

    2. He probably only knows python, so he used a raspberry pi. This is more of a good art design married with some nice work. I personally think it’s a hack due to the way he used the screen in the frame.

    3. Tell me an *easier* way of getting data onto an LCD that is formatted nicely like that. Only then will your comment be respected. Don’t forget the cost of your solution has to be less than the rpi.

      1. my bad: i should also have pointed out that using a high resolution lcd screen to display 3×4 digits was also overkill — it just seemed obvious.

        So : arduino + whatever network wing + 12 7 segment display. I have not made the total, but I would think that we are *way* below the cost of the RPi + LCD.

        But then you would have to adapt the design — I’m not sure that the retro 7 segments would fit in that (again, very nice) case.

        Please do not take as not respectful (your answer was, btw) — I was just thinking that, although the result is nice, it seems a bit of a waste of good computing power.

      1. While I agree the rPi is the sensible option here, I would genuinely love to see someone build a webscraper and drive the LCD using TTL and machine language.

  1. Very nicely done. You say in the post that you scrape the data from one of the live train times sites. Network Rail have recently released their data for free – though you do have to sign up for it, and it isn’t perhaps as easy to digest as a screen scrape – might be worth a look though:

    https://datafeeds.networkrail.co.uk/

  2. It’s a sweet project, though I agree that raspberry pi is probably overkill. Pulling the data through Yahoo Pipes or running his python script through something like scraperwiki would have made more sense.

    1. This still leaves the question how you get your information to this kind of LCD panel. I don’t know how much time it would take me to build a system which converts plain text to e.g. a good looking VGA signal. Before there was the pi, I would probably thought about gutting an old laptop.

  3. It’s a sweet project, but raspberry pi was overkill. It would have made more sense to pull the data through yahoo pipes or run the python script remotely on something like scraperwiki

    1. It would be nice to be always-on, but I included the pushbutton to avoid checking the server too often (its a scrape script). Also I wanted to switch the screen off automatically when it’s not needed.

    1. It is now a city, but historically they were two separate towns, with combined transport of course. Only in the last 20 years (I don’t remember when) were the two councils merged after city status.

    1. Brighton connects to other places (Lewes, Eastbourne, Hastings, and smaller stops on the route via Haywards Heath to London, plus Thameslink { https://en.wikipedia.org/wiki/Thameslink } route to Gatwick and Luton airports, and Bedford).

      Hove is on the Brighton to Portsmouth / Littlehampton west coast (most is in West Sussex) line, and while there are trains from Hove direct to London (on the Littlehampton to London Victoria route), they are hourly (or where, when I lived in the area until 1989) during the day, so it can be quicker to go via Brighton.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s