Building a WiFi Twitter Display: Scrolling Tweets

In the previous post - Combining multiple LED matrix modules we explored the use of three LED matrix displays to show scrolling text.

But the text was pre-programmed in the code, and hence was not of much utility. By connecting the device to the internet, we can get interesting and meaningful content to display on the device. For this purpose, I connected a Sparkfun WiFly Shield on top of the Arduino Uno.

This simple shield allows connectivity to the internet using WiFi. Let us first test the WiFi Shield to learn how to use it.

The above code is the sample code that uses the WiFly Library to connect to Google’s Homepage and return the raw HTML in the Arduino Terminal.

Once you get it working, try fiddling with it to understand how it works.

Now to read data from a Twitter account, we need to use the Twitter API. To do this, we write a simple Node.js application, and host it somewhere like Heroku.

The URL we call is

http://api.twitter.com/statuses/user_timeline.json?screen_name=verge&count=5;&trim_user=1

Here we are telling the API, to return the last five tweets of the user @verge and trim extra information. The response is in JSON format. To extract it, we need to do some string manipulation on the code.

Here is the Node.js code running on Heroku: Node.js code snippet on Github and the result is the following: simpletwitter.herokuapp.com

As you can see, we take the complex JSON response from Twitter, and parse it into a simple list of five strings. To see the real Twitter JSON response, use the command line utility curl.

Now that we have a webpage that can give us text to display, we connect to this Heroku app using the WiFi Shield, and scrape out five strings. Then its really easy to just send these strings to the display like in the previous code.

The combination of three LED matrix displays give us 24x8 LEDs bringing the total LED count to 192. Yes we are controlling 192 LEDs using just one Arduino!

The buffer that stores this is:

byte displayBuffer[24]= {0};

which is a simple buffer of size 25 bytes. Each byte is 8 bits, and each bit corresponds to one column of 8 LEDs on the displays.

Here is the entire code for this setup:
Scrolling Tweets using multiple LED matrix displays code on Github

Finally we get this:

Building a WiFi Twitter Display: Scrolling Tweets from Param Aggarwal on Vimeo.

Finally to make the project completely wireless, we use a Sparkfun LiPower Shield and accompanying LiPoly battery.

Congrats on building a network connected device of the future!

Parts used in this tutorial:

  1. Arduino Uno
  2. USB Cable
  3. Feemo Matrix Adapters
  4. Breadboard
  5. Male Header Pins
  6. Jumper Wires
  7. Sparkfun WiFly Shield
  8. Sparkfun LiPower Shield
  9. LiPoly battery