Raspberry Pi arrives at Earthware!

Last week was a very exciting time at Earthware… our Raspberry Pi arrived!

I have recently started at Earthware as a ‘summer intern’, and so was thrilled to be given possession of the Pi for a day, and struggled to hide my excitement in front of the other, envious developers. I was set the challenge of making the Pi read our Twitter feed aloud to the office. I was asked to create a loop which would refresh every so often and read aloud the latest tweet. If a tweet had already been said, the Pi should ignore it, however if a new tweet was written it should read it aloud to the room, via our TV.

The Raspberry Pi uses the Python programming language to write code, and so as part of the learning process I had to learn how it worked compared with other languages that I am used to writing in. Luckily I found Python quick and easy learn, especially once I realised that it displayed similarities with other languages such as Java and JavaScript.

With the challenge set I quickly got stuck in and started looking into how we could make the Pi actually ‘speak’, and I soon discovered that Python has modules you can use to do different things. I used the ‘httplib’ module to gain access to the internet, and from there used the Twitter API that is made specifically for use in Python to access various Twitter feeds. In order to make the Pi ‘speak’ I found a ‘speaking’ module, and I used the ‘datetime’ module to write code which would highlight when new tweet had been written, triggering the Pi to read it.

After a few tweaks and edits I managed to get the Pi to read aloud tweets from whatever twitter user I wanted! I also enabled the ‘input’ feature which means that users are able to choose how long they want the Pi to wait before it refreshes.

I am pleased to report that I succeeded at my initial challenge of making our Raspberry Pi speak! Only one problem remains… the voice that reads the tweets is not exactly… gentle on the ears… I’m working on it!