The Internet of Things, Raspberry Pi and Twitter Data

The Internet of Things, Raspberry Pi and Twitter Data
Reading Time: 5 minutes

The connection of digital devices to the internet commonly referred to as the Internet of Things or IoT, has been growing exponentially for the past few years.  It is estimated that by 2020 there will be over 20.4 billion devices that are connected to the cloud in some form, sending and receiving data, providing services to business and consumers.

The Raspberry Pi is one of these devices that can be connected to the internet and operate as an IoT device. In this blog post, we explore how the raspberry pi can be connected to the internet and used to extract and process Twitter data.

What do we mean by the Internet of Things?

The Internet of Things refers to a network of devices, appliances or other hardware devices that often contain software, connectors or even cameras.  These devices can send and receive data.

For example, IoT devices can be used in oil rigs or even manufacturing plants to undertake quality control or measure the stress that a given component is under.  This information can then be fed into predictive algorithms to help engineers anticipate when components or machinery should be repaired.

On a consumer level, smartphones and smartwatches all fall into this category. As the use of networked devices continues to rise in popularity, one thing is certain, the quantity of data being generated and shared in the cloud is only set to grow.

[bctt tweet=”As the use of networked devices continues to rise in popularity, one thing is certain, the quantity of data being generated and shared in the cloud is only set to grow.” username=”GAPapps”]

What is the Raspberry Pi?

The Raspberry Pi is a small computer, so small in fact, that you can fit it in your pocket.  It’s almost the size of a credit card and can even be plugged into your TV.

It’s been out for a few years now and can do pretty much everything that your regular PC can, e.g. home and office computing, browsing the internet and much more.  The device is regularly used to help children learn how to code in popular education programming languages, often, positioned as games such as Minecraft Pi.

A core theme of the Pi is to make computing accessible to everyone and as such, the device is a cost-effective way for those that want to dip their toes in computer programming.  There are several models with the cheapest being only $5!  At the time of writing, the most expensive is only $35.  You can find out more about the device and its various price points.

How can the Pi be leveraged to process Twitter data?

So, now that we’ve introduced the IoT and Pi, it’s time to look at some ways this device can be used to process Twitter data.

Sentiment Analysis

a sample sentiment analysis tool

Being able to tap into online conversations in social media and performing sentiment analysis (a branch of machine learning) is a great way to unearth actionable data that can let your business know how your brand or service is being perceived online.  Sentiment analysis can be so useful, that in 2012, the Obama administration used this approach to gauge public opinion for policy announcements and campaign messages ahead of the 2012 presidential election.

You can build your own sentiment analysis tool by using a Raspberry Pi, a few software libraries and can even wire up some LEDs that indicate positive, negative or neutral emotion in tweets as your Pi extracts them from the Twitterverse!  You can find out more about this sort of project.

Tweet Dashboard

image2 3

Fancy setting up a dedicated device that keeps you informed of key accounts on Twitter that you can just switch on and not have to worry about?  You can do this with a Pi too.  You can plug a small LCD screen into the Pi and by using a programming language such as Python, and with the help of a few Pi libraries, can write a simple script that connects to the Twitter API and extracts tweets from the accounts you’re interested in which are then displayed on the LCD screen.

Twitter Bot

Ok, Twitter Bots get a lot of bad press, and often for good reason.  What if you’re an avid follower of a few Twitter accounts and find yourself retweeting a lot of their content? With a Raspberry Pi, you can automate this task.

By using a Python library called Tweepy and configuring a cronjob to run every few minutes, you can have your very own Twitter Bot that retweets anything you like based on a configuration of your choice.  The script is less than 100 lines of code and relatively simple enough to understand.

If you’re interested, you can find an example of this type of project here.

Listen to Tweets

By connecting your Pi to a speaker, you can get it to read tweets to you!

You can use a 3rd party script to extract tweets based on hashtags of your choice and have them read back to you! It’s almost like having your personal news assistant.

An entire project has been dedicated to this on GitHub which you can find here.  No more scrolling endlessly through your timeline or searching for accounts in your Twitter lists, just have your Pi read tweets out for you!

[bctt tweet=”For less than $20, the Raspberry Pi is a great way to learn about computing and explore some novel ways that device can be connected to the cloud and used in the home.” username=”GAPapps”]

Mining Data and Predictive Analytics

By using Tweepy, Scikit-learn and the Feedparser modules, the Pi can also be used to mine Twitter data to help arrive at a predictive scoring in terms of the potential popularity of a given tweet.  This is more involved than simply retweeting tweets based on the existence of a hashtag but reduces the likelihood of you being perceived as being “spammy”!

This can be achieved by using a neural network that leverages the number of “likes” and “tweets”, in conjunction with training data, can generate a probability scoring in relation to the potential success that a tweet will be well received by users in the Twitterverse! This is quite an interesting use of the Pi that employs data analytics and machine learning.


In this blog post, we’ve discussed the Internet of Things, Raspberry Pi and how it can be connected to the cloud and used to extract and process Twitter data.  We’ve also looked at how this cost-effective device can be used in other ways.

For less than $20, the Raspberry Pi is a great way to learn about computing and explore some novel ways that device can be connected to the cloud and used in the home.  Why not get yourself one today!?

Here at Growth Acceleration Partners, we have extensive expertise in many verticals.  Our nearshore business model can keep costs down whilst maintaining the same level of quality and professionalism you’d experience from a domestic team.

Our Centers for Engineering Excellence in Latin America focus on combining business acumen with development expertise to help your business.  We can provide your organization with resources in the following areas:

  • Software development for cloud and mobile applications
  • Data analytics and data science
  • Information systems
  • Machine learning and artificial intelligence
  • Predictive modeling
  • QA and QA Automation

If you’d like to find out more, then visit our website. Or if you’d prefer, why not arrange a call with us?