Advertisement

twitterpop

Not rated 25,865

#arduino #LED matrix #twitter API #social media #display #microcontroller #programming #electronics #DIY #interactive
twitterpop
twitterpop

Description: After acquiring an Arduino and several 8x8 LED matrices, a project was initiated to effectively utilize these components. Concurrently, there was an increasing interest in Twitter and its API, leading to the development of a Twitter popularity meter. This system employs a PHP script to search Twitter for a specified term, hashtag, or reply, displaying the results on a webpage that indicates the number of occurrences. The Arduino, equipped with an Ethernet shield, retrieves this page and presents the data in a bar graph format on the LED matrix. The core hardware consists of the Arduino with the Ethernet shield, two 74HC595 shift registers, and an 8x8 common anode LED matrix sourced from China via eBay. The Arduino requests the current popularity metric page, updates an array reflecting the lit LEDs, and sends this data to the shift registers to illuminate the appropriate LEDs. The schematic is available below. A custom PCB for this project is currently awaiting fabrication. The circuit has been assembled into a more durable form as an Arduino shield, facilitating its reuse for any application requiring an 8x8 LED display. The system relies on a PHP script to search Twitter and generate a numerical representation of the popularity of the search term, utilizing cURL to retrieve a JSON feed for counting results (source code is provided below). The Arduino software reads the number from the webpage, converts it to a binary format to control the number of lit LEDs, adds it to the array of previous popularity results, and updates the LED matrix. There is also a conversion process since the number is initially in ASCII format. Previously, this system operated with a client computer reading the PHP script from a web server and transmitting the results via serial to the Arduino, but it has now transitioned to direct communication between the Arduino and the server. Future enhancements will aim to refine the popularity metric by incorporating data from follows, replies, and hashtags, rather than relying solely on a simple search term.

The circuit design for the Twitter popularity meter includes several key components that facilitate its operation. The primary component is the Arduino microcontroller, which serves as the central processing unit for the system. The Ethernet shield connected to the Arduino enables network connectivity, allowing the microcontroller to send HTTP requests to the server hosting the PHP script. The PHP script is responsible for querying Twitter's API, using cURL to fetch data in JSON format. This data is parsed to extract the relevant popularity metrics.

The LED display consists of an 8x8 common anode matrix, which is controlled through two 74HC595 shift registers. These shift registers are crucial for expanding the number of output pins available from the Arduino, enabling control over all 64 LEDs in the matrix. Each shift register can control 8 outputs, thus two are used to manage the full LED matrix. The Arduino communicates with the shift registers via the SPI (Serial Peripheral Interface) protocol, sending the appropriate binary values that correspond to the number of LEDs that need to be illuminated based on the popularity metric retrieved from Twitter.

The software running on the Arduino includes a routine that fetches the popularity metric from the specified URL, processes the information to convert it into a binary representation, and updates the LED matrix accordingly. The conversion from ASCII to binary is a crucial step, ensuring that the correct number of LEDs lights up in response to the popularity metric.

This project not only exemplifies the integration of hardware and software but also highlights the potential for real-time data visualization using LED matrices. The future enhancements planned for this project aim to provide a more comprehensive view of Twitter engagement by including additional metrics such as the number of follows and replies, thereby enriching the data representation on the LED display.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 P HP 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.

The central part of the hardware in this project is the arduino with ethernet shield then 2x 595 shift registers and one 8G—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. 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. 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 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


Related Circuits