Boris, the Twitter Dino-Bot

UK teachers: want two days of free, top-class CPD? Check out Picademy, and send us your applications!

What do you get if you cross a PiFace with a rubber dinosaur from Marks and Spencer?

Twitter magic, that’s what.

Teacher Dan Aldred has come up with a thing of beauty: a hack that makes your desktop dinosaur roar whenever it’s mentioned on Twitter. (What do you mean, you don’t have a desktop dinosaur?)

Boris, scaring the living bejezus out of all comers.

Boris, scaring the living bejezus out of all comers.

The build itself is simple enough – you can do the same with any kids’ toy that uses a button or switch to make a noise. Dan built a bridge across Boris’s switch using tin foil, our favourite hacker tool. He hooked Boris up to the PiFace GPIO expansion board (the PiFace site is currently the only site on the internet that features a picture of me crouching like a preying mantis in a cardigan on its front page), got Python talking to the Twitter API and wrote a simple program to tell Boris to roar whenever the string “ROAR” is tweeted at Dan’s account. All very easy, but the results are magic.

Boris, innards exposed.

Boris, innards exposed.

Here’s Boris in action:

You can send Dan a tweet yourself – he’s @Dan_Aldred. (Just think! If enough of you tweet “Roar” at him, he’ll either be driven mad or forced to power Boris down.) We love it, Dan. Boris is a thing of beauty, and a great learning exercise. Dan has made full instructions and all the (very simple) Python you’ll need available at his website: if you’ve got some time this weekend and are in charge of a bored child, I can’t think of a better way to spend a couple of hours.

14 comments

Avatar

laughing with tears in my eyes – love the choice of background music! Did anyone warn M&S they are going to get a rush on these today?

Avatar

I’m off to M&S tomorrow to grab one of these. I love it!

Avatar

The Dinosaur “found a way”!

Avatar

Imagine Katy Perry sees this :) ROAR!!!

Avatar

I like the noise the Dino makes when a Tweet arrives.

I make the same noise when I’m in the loo.

Avatar

I’ve told everyone I have absolutely no need of a twitter account.

How wrong I was…

Avatar

This is so cool! It’s awesome to see Tweepy being used in the wild (I’m a maintainer of it). Just a note if Dan Aldred is reading this – on the page for the project, Tweepy is being called Twython, even though the instructions say to install Tweepy.

Avatar

Well spotted! I have changed it to ‘Tweepy’. Thank you also for the improved code.

Avatar

I’m working on an improved version of the Twitter script that utilizes Twitter’s Streaming API. Their streaming endpoint is currently down (see https://dev.twitter.com/status), so it won’t work until it comes back up.

Avatar

Actually, Twitter’s API isn’t causing a problem. Here’s my improved version: https://gist.github.com/Aaron1011/567bc00f02b87b7e3529

Avatar

Trying your modified code I get the following error – but it then continues to run ok ?

ERROR:root:unknown message type: {“friends”:[28631573]}

any thoughts ?

Avatar

Yeah, that’s nothing to worry about. I haven’t added the ‘friends’ message to Tweepy, so it’ll print out a warning about it. It’s nothing to worry about, and won’t affect anything.

Avatar

Thank you for all the comments and the updated code, it functions much better now. I’ll set Boris back up today if I get 5, his voice is very sore and so are my ears!

Avatar

OMG YES!! This is awsome and I love the jurrasic park background music in the video!

Leave a Comment

Comments are closed