Web platform: Twitter controlled Christmas tree
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.
@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.
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.
A ShiftBrite high-power LED blasts the colors sent in the tweets.
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 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.
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
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 in web platforms and tagged @tweet_tree, remote control, tweet, twitter.