Introduction: @tweet_tree: Twitter Controlled Christmas Tree

@tweet_tree is a Christmas tree that everyone can control from Twitter. Just tweet a color to @tweet_tree. A small embedded server reads your tweets, and fades our fiber optic tree to the colors you send. New tweets are grabbed every few seconds.

Live streaming video of @tweet_tree is on USTREAM (The broadcast has ended, thanks to everyone who gave us a light show with Twitter!). See this article with the original formatting at DangerousPrototypes.com

@tweet_tree is a stand-alone network appliance based on our open source, business card size web platform. The web platform is available as a kit for $35, including worldwide shipping. Seeed Studio can assemble yours for $5 more.

Using it

To choose the color of our tree, just send a color to @tweet_tree on Twitter.

@tweet_tree red, green, purple, green, p, g, r, b

@tweet_tree understands red, orange, yellow, green, blue, and purple. Send one color, or combination of colors to morph through. Separate multiple colors with a comma. Only the first letter of the color matters, r,o,y,g,b, & p, are acceptable color commands.

@tweet_tree red, *ff0000, green, *00ff00, blue, *0000ff

You can also blend custom colors using 24bit hexadecimal color codes. Here's a color picking tool to help you choose values. Send the value as *rrggbb, where rr=red, gg=green, and bb=blue. We used the * designator because the more common # is already used for Twitter hash tags.


Step 1: Overview

Tweet a color to @tweet_tree on Twitter. A business card size server connects to Twitter once every few seconds and grabs new tweets. A multicolor LED in our fiber optic Christmas tree fades to the new color.

If there's are more than one color in a tweet, or multiple tweets, the tree fades between them until it reaches the most recently sent tweet.

Step 2: Hardware

The tweet_tree has three primary components.

Web platform

Our open source web platform does the heavy lifting. It has all the hardware we need to connect to Twitter, parse tweets, and convert them to colors. The color(s) are stored in memory and sent to the ShiftBrite LED over a simple 3-wire interface.

The web platform is available as a kit for $35, including worldwide shipping. For an extra $5 Seeed Studio will assemble it for you.

ShiftBrite LED

A ShiftBrite high-power LED blasts the colors sent in the tweets.

  • IO2->LATCH
  • IO3->CLOCK
  • IO4->DATA
  • GND->GND

It only takes three pins to control the ShiftBrite, we used IO2-4 on the web platform IO header. The EI pin should be permanently enabled by connecting it to ground. The module requires a 5volt+ power supply, we tapped the same supply we used for the web platform.

Fiber optic tree

Our tweet_tree is a small fiber optic Christmas tree, but you could use more ShiftBrites to light a full-size tree or yard display.

We removed the original guts from the base of the fiber optic tree and replaced them with the ShiftBrite. A major concern was that the LED wouldn't be bright enough to replace the original mini-halogen lamp, but the ShiftBrite works perfectly.


Step 3: Firmware

Firmware

The latest firmware downloads are on the project Google Code page. The code is written in C, and compiled with the free Microchip C30 demonstration compiler.

The firmware uses an adapted version of the #twatch source code to connect to Twitter over the internet. It opens a TCP connection and sends a search query for '@tweet_tree', the response is a JSON formatted data file like this.

A JSON parsing state machine searches through the data for the 'text' and the 'id' tags. The text tag value is processed for color commands. The value of the first id tag is stored too. We'll use it to limit results to new tweets in the next search query. Hint: try JSONView to work with JSON in Firefox.

If a new color command is found, the LED fades into the new color. If multiple commands or tweets are found, the colors morph from oldest to newest, with a 5 second pause between each. The tree always ends on the most recently tweeted color.

Every minute, or after completing a stored sequence, whichever takes longest, the web platform queries Twitter for fresh tweets. It appends the saved id tag value to the search query so the feed only returns new tweets. Twitter limits the number of queries you can make in an hour, but 60 is well below the limit.

The ShiftBrite is controlled with bitbang routines from our RGB remote control pumpkin project.

Compiling

This firmware uses the free Microchip TCPIP stack. If you want to compile the firmware yourself, download the TCPIP stack and follow the instructions in main.c.

Step 4: Get One

Taking it further

Twitter-controlled holiday possibilities are endless. The web platform can Twitter-enable a Halloween or Christmas yard display. Multiple Shiftbrite modules could be tied together to light a large Christmas tree, or substitute a TLC5940 16channel LED driver to control individual LEDs.

Other web platform demos

Get one

The web platform is available as a kit for $35, including worldwide shipping. For an extra $5 Seeed Studio will assemble it for you.