3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

@tweet_tree: Twitter controlled Christmas tree

Step 3Firmware

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.

« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
128
Followers
30
Author:ian(DangerousPrototypes.com)