Skip to main content

Arduino Starter Kit - Video 10. Twitter-controlled Mood Lamp

This is the last video in the series of 10 Arduino video tutorials presented by Massimo Banzi and RS Components. In this last video, Massimo shows us how to build an internet-controlled lamp, changing its colour depending on the content of Twitter messages. The purpose of this tutorial is to familiarise the user with the Arduino WiFi shields, opening up all kind of possibilities by interacting with existing web services, applications and social media.   The lamp built by Massimo is really a RGB LED that changes colour depending on messages posted on Twitter. If somebody posts a Twitter message that begins with the hashtag  #ArduinoRGB followed by a color represented as a six digit hexadecimal number, the Arduino picks it up, decodes the colour components and uses them to change the LED colour.  The circuit consists of a RGB LED connected to the Arduino via 3 pins - used to control the brightness of each individual colour component - and an Arduino WiFi shield, mounted on top of the Arduino board. The WiFi shield has a 32 bit micro controller, containing all the software needed to process the WiFi messages and to connect to the internet. The code on the Arduino follows these steps: it connects to a local WiFi network using the WiFi shield, it connects to Twitter, it then searches for the #ArduinoRGB hashtag, fetches relevant messages, decodes the hexadecimal code into colour components and finally sends signals through the individual pins connected to the LED. In order to use the Arduino WiFi shield we need to include the WiFi library and specify the name of  the local network and the password to be used to connect to it. Most of the code used in this example was written by Limor Fried for the Adafruit internet of things printer and adapted by Massimo to decode and control colour components, rather than sending messages directly to a printer. This video closes the first cycle of tutorials showing us how to expand Arduino with a shield and how to use the WiFi shield specifically. This basic code works as a useful basis on which you can connect local sensors and actuators to existing web services, allowing the realisation of a wide range of domotic applications.

You can find the previous tutorials here and subscribe to the upcoming Arduino video tutorials. As Massimo always says: build it, hack it and share it on the internet, because Arduino is you.

DesignSpark Electrical Logolinkedin