Monitoring Twitter with the Raspberry Pi and activating a ‘real world’ component

For over a year, I have been trying to get a Twittering Toy to work with a PiFace.  Just like this Twittering Chick project from this book by Andrew Robinson and Mike Cook.

Try as I might, I couldn’t get it to work.  Of the 3 packages that needed to be installed, 1 of them seemed to always throw up error messages when trying to install them.  I even met Andrew at BETT 2015 and mentioned this to him, but he said there were no easy answers.  It would easiest for someone who knows what they are doing to sit and work through it with me 😦

Right, school open evening is coming up, so I thought I’d have another bash.  Installed all the packages seemingly successfully, the relay on the PiFace turned on when it should and the motor in the chicken moved when it should using the test programme.  Hmm, just one problem though, the Pi would not read the hashtags from Twitter and then speak them, using espeak. Boo hoo.

I thought I ought to use some different packages, so had a look at Twython.  Well, what a difference.  It worked first time.  I just need to work out how to upgrade from controlling an LED to activating a motor in my twittering toy.

Just to prove it works, here are the tweets with #happy in them.

...and here is the Twitter term being picked up :-)
…and here is the Twitter term being picked up 🙂

In my hunt for an orange-orange-black resistor, I was looking for some resistors when I cam across these from an old project.  Great, lets canabalise it 🙂

Hmm, I have an old project with some LEDS/resistors on breadboard. Let's recycle!
Hmm, I have an old project with some LEDS/resistors on breadboard. Let’s recycle!
The python code to make it all work
The python code to make it all work
Wired up 2 GPIO pins with my Pi still mounted on my Pi Robot!
Wired up 2 GPIO pins with my Pi still mounted on my Pi Robot!

I was so keen to get it working, I didn’t even take my Pi B off the robot is was mounted on.

More details and the code follows tomorrow.

Advertisements

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