twitterpop

After buying an arduino and some 8x8 LED matrices I really needed a project to make good use of them. At a similar time I also had become a bit addicted to twitter and had been reading up on the API with the intention of doing something cool with it,somehow these ideas all got rolled into one to give a twitter popularity meter. The system uses a PHP script to search twitter for a predefined term, #tag or @reply and then presents the result of this as a webpage with number of results. The page is then read by an arduino with associated Ethernet shield and displayed on a bar graph format on the LED matrix.

hardware

The central part of the hardware in this project is the arduino with ethernet shield then 2x 595 shift registers and one 8×8 common anode LED Matrix from china via ebay. Basically the arduino requests the page containing the current popularity metric and then adds it to an array containing the states of the currently lit LEDs which is then pumped out to the shift registers to update the display. The circuit lights the correct LEDs. The schematic can be viewed below. Currently I’m waiting for a custom pcb of this to be fabricated.

arduino shield

I have now assembled the circuit into a more robust for as an arduino shield, this will allow it to be easily reused for any application which requires an 8x8 LED display.

software

The system relies on a PHP script to search twitter and provide a number to represent the popularity of the search term. This uses cURL to search twitter and receive a JSON feed from which it counts the results (source code available below).

The software run by the arduino reads a number from the webpage then converts it to a binary representation of the number required to light that many LEDs, adds this to the array of previous popularity results and then updates the LED matrix. There is also conversion as the number read is in asci.

Previously this system was run using a client computer to read the PHP script from the webserver and then feeding the result via serial to the arduino, this has not been abandoned in favour of the arduino communicating directly with the server.

the future

The next stage for this project will be to improve the generation of the popularity metric by taking in the number of follows, @replies and #tags rather than just a simple seach term

The hardware is also in the process of becoming more refined as a PCB should be arriving from the US soon.

source code

Download arduino sketch

Download PHP code

schematics

Download schematic (eagle)

Download schematic (png)

related links

Arduino website

Arduino ethernet shield

Arduino shift register tutorial