Web platform: Twitter controlled Christmas tree

Posted on Friday, December 18th, 2009 in web platforms by Ian

UPDATE: Live video of @tweet_tree on USTREAM (sorry, WordPress wouldn’t let us embed it). The broadcast has ended, thanks to everyone who gave us a light show with Twitter!

Choose the color of our 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.

@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.


Tweet a color to @tweet_tree on Twitter. A business card size server connects to Twitter once every 20 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.

We used Twitter as a control mechanism because it’s easier for the tiny internet device to act as a client than a server. If you contacted the @tweet_tree directly, not only would it crash with more than a few users, but we’d have to configure routers and use a service like DynamicDNS to tunnel into our local network. Instead, we let Twitter and their servers handle the user input, the @tweet_tree just contacts Twitter and pulls datafeeds as needed. This arrangement is a lot more solid than opening a tiny embedded server to the world.

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.


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.


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.


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.

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.

This entry was posted on Friday, December 18th, 2009 at 11:26 am and is filed under web platforms. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

9 Responses to “Web platform: Twitter controlled Christmas tree”

  1. Bill Owens says:

    Where’s the Ustream feed so we can watch the tree change colors? ;)

  2. Ian says:

    I’m going to try to set one up over the weekend and have it going for a few days before Christmas.

  3. Shadyman says:

    Haha, I have the same tree! Excellent!

  4. Jim Gardner says:

    You can embed videos in wordpress using

  5. YC says:

    You can also embed it on a blank page (like on, and then iframe it onto your page.

  6. Shadyman says:

    Would it be possible to put a 3-RGBLED base on the tree, instead of the single ShiftBrite? I seem to recall the original halogen lamp-based system having a cool multi-color-morphing effect.

    Maybe a MegaBrite? ( )

  7. Ian says:

    @Shadyman – Those should work fine. Same chip, but three of them together.

  8. Ken Santos says:

    Twitter is really a good way in keeping yourself updated with the day to day activities of your friends and families members. I update my Twitter and personal blog daily.

Leave a Reply to Shadyman

Click here to cancel reply.

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • Joe Desbonnet: Ya, I can recommend the low melting point solder. I used brand 'ChipQuik' and it's amazingly easy to use.
  • Jerome: I need a new BusPirate for the Fablab ;) Many thanks!
  • Max: Seems like an unexpectedly violent way to remove the chip indeed. A hot air station should of course do the job just fine, but in...
  • jose: Part removal described here is pure butchery, the cheapest hot air station will do a fast and clean job removing the QFP, heat air to...
  • Cody: Yes please