tweeLaw

//"Ang tweet na nakasisilaw"//

=I. DESCRIPTION=


 * tweeLaw** is an Arduino controlled lamp which can be commanded to change colour by tweeting. It connects to the internet via a WiFi shield and uses ThingSpeak to pull tweets from Twitter.


 * tweeLaw** is a project made by **Joseph Jay A. Montalbo** for the **Mobile and Embedded Systems Development Workshop**.

=II. MAIN COMPONENTS=

1. Arduino Uno

2. Arduino WiFi Shield

3. Super Bright LEDs (Red, Green and Blue)

4. ThingSpeak API

=III. INSPIRATION=


 * tweeLaw** was inspired by an instructable called Twitter Mood Light.

=IV. APPLICATIONS USED IN THINGSPEAK=

TweetControl monitors the Twitter Streaming API for the user's trigger word. In the case of **tweeLaw**, the project uses **kulay** as the trigger word. Once the trigger word is detected by the application, TweetControl calls the **ThingHTTP** request registered to it. ​ Allows access to other APIs or webpages through HTTP requests. In the case of **tweeLaw**, the project's **ThingHTTP** copies the tweet that **triggered TweetControl** and puts the said tweet into the project's channel.
 * Tweet Control**
 * ThingHTTP**

Similar to a database, the channel stores data which can be retrieved or updated by other applications. ThingSpeak's channels support XML, JSON and CSV. The channel can be made private, in which case API keys are needed to read and write to the channel. Making the channel public allows access to the channel without needing any API keys.
 * Channel**

=V. COMMAND FORMAT=

The user should follow this format for tweeting the command: **#tweetcontrol kulay (desired colour)**

The program is strict when it comes to this format. Failure to follow the said format will result to the lamp ignoring the command. This would not crash the lamp but instead the lamp will continue to shine using the colour of the most recent correctly formatted command.

Further, the user must make sure that his/her profile is **public** (i.e. not protected). The ThingSpeak API can only access the public streaming API.

=VI. COLOURS=


 * tweeLaw** uses the RGB color model and supports 12 colours. Keywords for the colours are all in lowercase.



=VII. THE PROCESS=

1. User tweets command. 2. Command triggers TweetControl. 3. TweetControl calls registered ThingHTTP. 4. ThingHTTP stores tweet in Channel. 5. Arduino routinely (every 30 – 60 seconds) downloads the latest data in the Channel. 6. Arduino parses tweet. 7. Arduino sends brightness values to the bulbs. 8. Lamp displays desired colour.

=VIII. LIMITATIONS=

Because of ThingSpeak's API rate limit (the channel can only be updated or accessed every 15 seconds) and the intermittent nature of the Arduino's internet capability, there is a delay of 30 seconds (up to 60 seconds) in updating the lamp's displayed colour.

=IX. APPLICATION=

Because the lamp's main function is to change its color based on tweeted commands, the lamp has no practical purpose except decorative. However, **tweeLaw** should be seen as an **exploratory** project into the features of **ThingSpeak**. Further, the nature of the lamp as a powerful visual representation of digital data can be leveraged in interesting ways. For example, adding sentiment analysis and the ability to process tweet feeds into the lamp will allow the user to immediately know, through colours, the mood of his/her friends in twitter. Combining sentiment analysis, twitter's geotag feature and accessing the public streaming API will allow the mapping of real time sentiment of users per region.

=X. EXTENSION=

Given the chance, I would like to **create a customized ThingSpeak server** (the code is open source) which would **stream the user’s private tweet feed**. The Arduino will **download and perform sentiment analysis** on the said feed. The lamp will then **show the colour corresponding to the** **predominant mood** of the user's tweet feed.

=XI. SUGGESTIONS GIVEN BY EVALUATORS=


 * 1. Increase the number of colours available.**


 * 2. Loosen the restrictions of the command tweet format.**


 * 3. Put a visible indication that the user's desired colour is not supported.**

=XII. PROJECT PRESENTATION=


 * Powerpoint Presentation**




 * PDF**

 create a **customized**  ThingSpeak server (code is open source) which would **stream**  the user’s tweet feed while an Arduino will perform **sentiment analysis** on the said feed  5. **Arduino** **parses**  **tweet** 6. **Arduino sends** **brightness values** **to the bulbs**