Tweeting With Raspberry Pi




Introduction: Tweeting With Raspberry Pi

About: ​M.Sc. in Electrical Engineering in Rochester Institute of Technology at USA and CMO of Embarcados.

In this instructable, I will explain how to make your Raspberry Pi tweet!

To run this tutorial you'll need:

  • Raspberry Pi - I'm using Rasp 2B
  • USB Mouse
  • USB Keyboard
  • Monitor
  • HDMI Cable
  • USB power supply for Raspberry
  • Internet

I based this tutorial in the following texts:

So, let's start!

Step 1: Creat an App at Your Twitter Account

Go to your twitter account. You'll need the following parameters to make your Rasp Pi Tweet, that you'll get from this app

  • Consumer Key (API key)
  • Consumer Secret (API Secret)
  • Access Token
  • Access Token Secret

Step 2: Insert All Informations and Create an App - Fill the Form

Step 3:

Access Keys and Access Tokens tab in your app, that you just created.

Get all the tokens and create a file in Raspberry Pi, inside your working folder, called with all your information in it.

consumer_key = "aaaaaaaaa"
consumer_secret = "bbbbbbbbbbb"
access_token = "cccccccccc"
access_token_secret = "dddddddddd"

Step 4: Install Twython in Your Raspberry Pi

Open a terminal in Raspberry Pi, choose a working folder and run the following commands to install Twython, a python package that is required for this experiment.

sudo apt-get update sudo apt-get upgrade
sudo apt-get install python-setuptools
sudo easy_install pip
sudo pip install twython 
sudo pip install requests 
sudo pip install requests-oauthlib

Step 5:

Open a file and your working directory in Pi and rename it to

import sys

from twython import Twython
from keys import (
twitter = Twython(
message = "Meu primeiro tweet - a conta do tpfslima foi invadida poruma plaquinha Raspberry Pi bem espertinha!"
twitter.update_status(status=message)print("Sua mensagem foi twittada com sucesso: %s " % message)

Save it and run it using


Step 6: Your Raspberry Pi Is Tweeting!!!

Your Raspberry Pi will tweet!

That's all folks! Happy Hacking!

Be the First to Share


    • Potato Speed Challenge

      Potato Speed Challenge
    • Mason Jar Speed Challenge

      Mason Jar Speed Challenge
    • Bikes Challenge

      Bikes Challenge



    3 years ago

    How can I connect a Blackberry Bold Q10 nano-keyboard to a raspberry?
    I want to make my raspberry portable console with a nano-keyboard of a Blackberry Bold Q10 but i don't know how to connect it XD