LedMatrix Tweet Visualization

Contents hide

Story

Description

Display tweets with a certain hashtag on a led-matrix using an Arduino/Genuino Yùn or Yùn-Shield. We will use a Python script to log into twitter and check for updates.LedMatrix Tweet Visualization

Configuring the Yun101/YunShield

In order to connect your board to internet you first have to configure some parameters.

Open your Arduino IDE and go to example -> Bridge -> YunFirstConfig

If you are using a YunShield be sure to select the name of the board to which it is attached and not a Yun board!

Configuring the Yun101/YunShield

In order to connect your board to internet you first have to configure some parameters.

Open your Arduino IDE and go to example -> Bridge -> YunFirstConfig

If you are using a YunShield be sure to select the name of the board to which it is attached and not a Yun board!

Now if you click on the Keys and Access Tokens tab you should see your own CONSUMER_KEY and CONSUMER_SECRET. Save those values, we will need them in the next step.

Great, now we only have to generate the OAUTH tokens.

To do so you can run the python script you’ll find in the software section of this project. It is the same script that we will upload on our Yun101/yunShield but first we need to make some changes.

Download the script and open it in an advanced text editor. Set the two constants at the top of the code with the CONSUMER_KEY and CONSUMER_SECRET.

Now, to generate also the OAUTH tokens we have to run the script. Open the terminal and use the following commands

sudo pip install requests requests-oauthlib
python YunTwitter.py Arduino

Now you should have received the ID and the content of the last tweet with hashtag #Arduino.

If you run this script for the first time you could get an URL as a response. Follow that link and copy and paste the identification number you get in the terminal. Now you have your OAUTH_TOKEN and OAUTH_TOKEN_SECRET, set them in the code to complete the authorization process.

Set Up your YunShield

In order to to download the python libraries we are going to use we can connect to the board via ssh ( be sure your computer is connected to the same network of the yun-shield).

Open your terminal and use the following command to download the libraries.

ssh root@name_of_your_yun.local
opkg update
opkg install python-pip
pip install requests requests-oauthlib
pip install sys

For the next step we will need the IP address of our YunShield.  We can obtain it by using the command ifconfig.

Now that we have the IP we can proceed uploading the script. You can use this command replacing your_path with the folder’s path to reach the python script.

scp /your_path/YunTumblr.py root@your_Yun_ip_address:

We are done!!!

To test it out you can digit in the terminal while you are connected via ssh:

python YunTwitter.py Arduino

Wiring

For this project we used an 8×32 led matrix.

Normally all led matrix comes with three wires. The black one for the ground, the red one for the 5V and the coloured one for the data.Schematic LedMatrix Tweet Visualization

Software and libraries

The led matrix needs some libraries to work. You can easily install them from the Library Manager.

In the Arduino IDE go to

Sketch -> include library -> manage libraries

And search for:

  • Adafruit_GFX
  • Adafruit_NeoMatrix
  • Adafruit_NeoPixel

For more detail: LedMatrix Tweet Visualization


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top