On the everlasting quest for entertaining content for my RGB LED matrix, i stumbled upon twitter. an endless stream of information that “just” needs to be parsed and turned into light. starting off with something simple, i decided to extract people’s favorite colors. i found a nice article on using the twitter search API in python and used it as a base for my script.
here’s what it does: first, it searches for the string “my favorite color” and in practice finds around .1-5 tweets a minute like (totally random samples shown)
#KnowYourAnon my favorite color is neon pink/orange
— Milwaukee Princess(@PrincessMiltown) March 28, 2013
You know I’ve seen it all from the orange of the fall to the green of the summer, but my favorite color is neon
— Kennedy Shutter (@KennedyJShutter) March 28, 2013
My favorite color is purple and I like playing with kittens. There, now that we know each other…can I crash on your couch?
— Witchy Woman (@dreamthievin) March 22, 2013
my initial plan was to use the wikipedia list of colors as a lookup table, when i realized that people are commonly not very creative when choosing their fav color: it’s mostly one of about 10 different colors. so i compiled my own small lookup table from my experiences of staring at tweets:
colorlist = ["grey","lime","white","violet","yellow"...
the script simply cleans up the tweet, removes any strange character like “#” and compares every word of the tweet with my lookup table. the first color string in the tweet wins.
after that, the string is converted into predefined RGB values and weighted with the tweet length to generate some more diversity. the longer the tweet, the brighter the color.
that’s basically it. now every time somebody twitters his/her favorite color, a pixel is slowly fading in to the LED matrix, forming a color spiral in the end.
the result is a very relaxing effect that somehow connects my room to the internets out there in a very abstract way. there are color trends that change over the day and the stream of retweets forms longer traces in the same color. you get an idea of what’s going on in the “favorite color” corner of the twitterverse without obtaining too much information. obviously you could generate a similar effect by choosing random colors and times. but if you look at the display and you know that if a pixel lights up, somebody in some place in the world initiated this by tweeting his/her favorite color and is totally unaware of this project, it feels awesome.
so go ahead and check out the project files to use twitter as a data input for your next project: