Twitter Mood Light using an Arduino




How’s the world feeling right now? This box tells you.

Powered by: an Arduino, WiFly wireless module, an RGB LED, Twitter.com and a 9v battery.

I’m a news junkie. I want to know everything that is going on in the world as soon as it happens. I want to wake up and know immediately if something big has happened overnight.

However, I’m an extraordinarily busy man; I don’t have time to read news feeds; reading that headline that I already knew about or don’t care about is time that I’m never getting back!

No. What I need is some way to be constantly in touch with the world’s events as they unfold, alerted when something big happens, and to be made aware of it all faster than awareness itself!

…A way to get a glimpse of the collective human consciousness as an extension of my own.  Something that I don’t have to continually check or poll, but instead, like a part of my body, it will tell me when it’s feeling pain or generally in need of my attention …leaving me time to get on with other things.

And so, I present: The World Mood in a Box!

The Arduino connects directly to any wireless network via the WiFly module, continually searches Twitter for tweets with emotional content, collates the tweets for each emotion, does some math, and then fades the color of the LED to reflect the current World Mood; Red for Anger, Yellow for Happy, Pink for Love, White for Fear, Green for Envy, Orange for Surprise, and Blue for Sadness.

If an unexpectedly high number of tweets of a particular emotion are found, then the LED will flash to alert us to the possibility of a world event that has caused this unusually strong emotional reaction.
Arduino Twitter Mood Light




For example, a world disaster and it may flash Blue or Red (sadness or anger), if the strong favourite loses a big football game it may fade to Orange (surprise), …and If it flashes White, the collective human mind is feeling extreme fear, and it’s probably best to go hide in a cupboard and sit it out, waiting for sunnier skies and a return to Yellow or Pink.  …OK, I’m not that busy.

Step 1: How it works

An Arduino connects directly (no computer required!) to any wireless network via the WiFly module, repeatedly searches Twitter for tweets with emotional content (aka sentiment extraction or tapping into the moodosphere), collates the tweets for each emotion, analyzes the data, and fades the color of an LED to reflect the current World Mood:

  • Red for Anger
  • Yellow for Happy
  • Pink for Love
  • White for Fear
  • Green for Envy
  • Orange for Surprise
  • Blue for Sadness

Example search terms to find tweets that may express surprise:

  • “wow”
  • “can’t believe”
  • “unbelievable”
  • “O_o”

If an unexpectedly high number of tweets of a particular emotion are found, then the LED will flash to alert anyone nearby to the possibility of a big world event that has caused this unusually strong emotional reaction.

Example signals:

  • A world disaster and it may flash Blue or Red indicating it best to check a news site to see why everyone is so sad and/or angry.
  • If the strong favourite loses a big football game, it may flash Orange to express the surprise at this unlikely event.
  • If there is a heat wave in London it might turn Yellow to reflect how much happier people now are.
  • If it flashes White, the collective human consciousness is feeling extreme fear and something terrifyingly bad is probably about to happen. Time to hide and/or panic.

Uses

  • You could put it on your desk to get an early warning of something big happening somewhere in the world
  • A literal ‘mood light’ at a party or a game whereby you guess what colour it will change to next and for what reason
  • A world mood barometer perhaps next to your bed to decide if it is best to hit snooze until it’s less angry outside
  • A gauge of public sentiment to help you decide when to sell all your stocks and shares, and head to the hills.
  • In a foyer or waiting area or other public space for people to look at and contemplate.
  • Set it to connect to any wireless network and carry it around in the streets, stopping strangers to explain to them that you have managed to capture the world’s mood and have it locked in this here box.

Step 2: All you need is…

I ordered most of the electronics from Sparkfun, and picked up the rest from the local Radioshack. The acrylic I got from a local plastic shop(!) – they cut it and drilled a hole free of charge.

Materials

The Acrylic Box

  • 1 x (5″ x 5″ x 0.25″) – the top
  • 4 * (4.75″ x 4.75″ x 0.25″) – the 4 walls
  • 1 x (4.5″ x 4.5″ x 0.25″) – the base
  • 1 x (4.5″ x 4.5″ x 0.125″) – the mirror with a 6mm hole drilled in the middle
  • 4 x (4.25 x 1″ x 0.25″) – the 4 inside walls
  • Acrylic solvent cement
  • Sand paper (to help diffuse the light)

Tools

  • Soldering iron
  • A computer
  • Arduino development environment
  • A wireless network (802.11b/g)
  • Pliers
  • Wire stripper

Useful links

Arduino Twitter Mood Light circuit

The Arduino development tools can be downloaded from here:
www.arduino.cc/en/Main/Software

and Arduino tutorials start here:
http://arduino.cc/en/Guide/HomePage

Arduino / WiFly:
arduino.cc/en/Reference/HomePage
http://www.arduino.cc/en/Tutorial/SPIEEPROM
http://www.lammertbies.nl/comm/info/serial-uart.html
http://www.tinyclr.com/downloads/Shield/FEZ_Shields_WiFly.cs
http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=158
http://www.sparkfun.com/datasheets/Components/SMD/sc16is750.pdf
http://www.sparkfun.com/datasheets/Wireless/WiFi/WiFlyGSX-um.pdf
http://www.sparkfun.com/datasheets/Wireless/WiFi/rn-131G-ds.pdf

http://www.societyofrobots.com/microcontroller_uart.shtml

Related:
nlp.stanford.edu/courses/cs224n/2009/fp/22.pdf
www.webservius.com/corp/docs/tweetfeel_sentiment.htm
i8news.uterm.org/mood/twitter-mood-reader/
community.openamplify.com/content/docs.aspx/
www.instructables.com/id/The-Twittering-Office-Chair/
http://www.tweetfeel.com

Step 3: Connect the Arduino and WiFly to a computer

Sparkfun have a decent tutorial on how to do this:

www.sparkfun.com/commerce/tutorial_info.php

Firstly, the Wifly breakout board needs to be stacked on top of the arduino and the RX, TX, Vin, Gnd, pin 10, pin 11, pin 12 and pin 13 needed to be connected. I used breakaway headers and soldered the required pins.

Connect to a computer using an A to B USB cable.

Download the Arduino software from here:
arduino.cc/en/Main/Software

Check that you can compile and upload a sample program by following the instructions here:
(remember to set the board and COM ports correctly)
arduino.cc/en/Guide/HomePage

 

For more detail: Twitter Mood Light using an Arduino




This Post / Project can also be found using search terms:

  • arduino mood light
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
Bootload an Arduino
Bootload an Arduino with a ZIF Socket

Bootloading an Arduino with a ZIF socket allows you to easily program a lot of chips at once without worrying...

Close
Scroll to top