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.

Comments

  1. ben says:

    A Raspberry Pi for a simple call to a web service ? a bit of an overkill…

    The casing is real nice, though.

    • Markus says:

      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.

    • Kyle says:

      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.

    • Matt says:

      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.

      • ben says:

        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.

    • John says:

      Why is reducing development time “overkill”? Should everyone use machine language and TTL?

  2. Ben says:

    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/

  3. P says:

    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.

  4. pguardiario says:

    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

  5. David says:

    Why does it have the pushbutton? Why not just update continuously?

    • Gareth says:

      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.

  6. What screen are you using and how is it connected to the Raspberry Pi?

  7. mental2k says:

    Aren’t Brighton and Hove the same place?

    • Web Dude says:

      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.

  8. Why would you want to catch a train from Hove to Brighton.
    Walk to the beach, swim ten feet and you are now in Brighton.
    OK, you may be a bit wetter than the journey by train. But it’s quicker.

    • Web Dude says:

      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

Follow

Get every new post delivered to your Inbox.

Join 94,612 other followers