10 Best Twitter Bot Projects for Raspberry Pi

Ads by Google

Twitter bots: automated programs that interact with the popular social network, often reacting to hashtags and events based on predetermined settings. For instance, I might use a Twitter bot to lookout for mentions of my MakeUseOf posts, and have them retweeted.

But what if you had a Twitter bot running on a piece of hardware like the Raspberry Pi? This would enable real world alerts and notifications from the virtual microblogging Facebook wannabe; you could to view a physical count of the number of times a hashtag is mentioned, perhaps, or flash some lights.

Users have found many ways to interact with Twitter using a Raspberry Pi. To get started, check our own Raspberry Pi Twitter bot project, and then read about the following 10 projects to see how you might spin your own…

Tweet Your Pi’s Status

When we kicked off the idea of Twitter bot projects, our own DIY expert James Bruce put forward using a Raspberry Pi to tweet hardware status (such as the CPU temperature) and photos from the device webcam (see above link).

It uses a custom Python app built with the Twitter API , and employs the crontab command to schedule repeated tweets. We would recommend you take a look at this tutorial before proceeding with the other projects listed here, as it will give you a good grounding in the basics required for building a Twitter bot.

Ads by Google

Simple Retweet Bot

One of the most important things you can do on Twitter is retweet. This might be to show your support for a cause, to underline your admiration for something, or to promote a commercial enterprise. Whatever the reason, it can be a little distracting making manual retweets constantly.

Fortunately, various tools are available to help you automate the process of retweeting, not least building a Raspberry Pi retweet bot that does the job for you. Thanks to a simple Python script and the Twitter API, you can make a bot that retweets based on a hashtag of your choosing. See SG Vulcan’s tutorial page for more details.

Tweet Your Speedtest Results

If you need some convincing as to the power and potential of a Twitter bot, take a look at this tweet:

Created by a Twitter bot programmed by Reddit user AlekseyP, the idea of the bot is to detect the download speed of the Comcast network, to which he is a subscriber. When the down speed drops below the 50Mbps level (the user pays for 150Mbps down and 10Mbps up), a tweet is sent.

The code is available on Pastebin. As AlekseyP observes, “I know some people might say I should not be complaining about 50Mbps down, but when they advertise 150 and I get 10-30 I am unsatisfied.” Interestingly, this approach seemed to have delivered a result.

“I set this up because I was frustrated during a period of constant drops and outages. It is a lot better now. We used not be able to stream Netflix and I would fail to connect to CSGO [Counter-Strike: Global Offensive] matches.”

Flash an LED When You Get a Direct Message or Retweet

Rather than tweeting and retweeting, what about using your Pi as a Twitter monitor, physically reacting to triggers from other tweets? To do this, you will need a Raspberry Pi, a breadboard, a resistor an LED, as demonstrated in this tutorial.

While the projects earlier in this list used hashtags to selectively retweet, this project uses them to illuminate the LED. It’s fair to say that this isn’t the most inventive use for a Raspberry Pi and some LEDs, but it’s really just a tip of the iceberg of what can be achieved by connecting a Raspberry Pi to Twitter. Other alert options might include playing a sound (perhaps even a car horn as demonstrated on the project page!) and this project is a good place to start from if you have aspirations to control a Pi-connected robot via Twitter.

Tweet My Roar

Based around a standard dinosaur toy, this project is a sort of continuation of the previous one. Instead of a light flashing, however, this uses Python code to detect @ mentions of Boris the dinosaur’s dedicated Twitter account, and have him roar in response.

It is aptly demonstrated in this video.

Obviously, the dinosaur was already able to roar. The project utilizes existing hardware, and essentially transmits an on/off command to the dinosaur. While the outcome is quite different, it is essentially the same as flashing an LED.

You’ll find the sample code on the Dino Tweet page.

Tweet How Your Garden Grows

Finding interesting things to automatically tweet with your Raspberry Pi can be tricky. So why not consider existing Raspberry Pi projects? One example is the Urban Agriculture Tweetbot which tweets pictures of the garden and water level and soil moisture data.

The project was built with a Raspberry Pi Model B+, so should work with little alteration on the Raspberry Pi 2 and Raspberry Pi 3 models. Of course, you don’t need to be cultivating hydroponics to use this project – it might just as easily be setup in your greenhouse or your veggie patch.

Manage Your Fish

Fish management is an oft-overlooked aspect of pet ownership. If you’re concerned that your goldfish (or other aquatic pets) are not experiencing suitable temperatures, why not set your Raspberry Pi up to detect the temperature, take a photo, and tweet the results?

While there is no set of instructions for this, it’s pretty similar to what we’ve already seen with the garden tweet bot, above. It also demonstrates that while very few original ideas are left to be uncovered, the Pi-powered Twitter bot is consistently impressive.

Listen to Your Tweets

What are tweets saying, really? Whether you don’t have time to read, or you’re unable to, a Raspberry Pi Twitter bot whose purpose it is to find relevant tweets and read them to you would seem particularly useful. You’ll find the software and outline for the TwitterPiBot at GitHub, and as long as you have an audio output connected to your Raspberry Pi, tweets with the specified hashtag will be read out to you. You could modify the project to read tweets through a Sonos system easily, too.

If configured intelligently, this is also a means to ensure curated news and information is delivered to you, like your own personal radio station!

Get International Space Station Alerts

Where is the International Space Station tonight? Without looking outside, it’s tough to see, but this Raspberry Pi Twitter bot project uses an RSS feed generated by Nasa’s ISS spotting web page to predict when the space station will be visible from your part of the world, and send a tweet the day before, so everyone who is interested in looking to the skies will be able to get ready for some astro observation.

Given that – at the time of writing – two Raspberry Pi’s are orbiting Earth on the ISS, this project seems particularly apt.

Mock Politicians

They enter politics with noble aims, but become pariahs. Yes, it’s politicians, and Twitter Bots can be configured to poke fun at these self-serving “public servants”. Could there be any better way of using a Raspberry Pi? One such example is by Reddit user “Shut-Up-Tyler”, who created automated satire (comedians, quake in your boots) with this project.

So how does it work?

“My program runs on a Raspberry Pi, running Python. It uses beautifulSoup to extract tweets from Mr. Trump’s page, removes links through regular expressions, uses a function to replace words with “doot doot” and “trumpet”, puts it through a markov chain… and tweets it out.”

Occasionally the tweets are nonsense. Unfortunately, this makes them very difficult to discern from Trump’s actual tweets.

No doubt there are many other ways that you can use a Raspberry Pi-based Twitter Bot – so why don’t you tell us about yours in the comments?

Join live MakeUseOf Groups on Grouvi App Join live Groups on Grouvi
Raspberry Pi Projects
Raspberry Pi Projects
479 Members
DIY Tech Projects
DIY Tech Projects
328 Members
Arduino Projects
Arduino Projects
279 Members
Affiliate Disclamer

This article may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.

For more details, please read our disclosure.
New comment

Please login to avoid entering captcha

Log In