Every year the Schwippy Christmass Tree is turned on and streamed to the world, allowing anyone who wants to the ability to turn the Christmas lights on or off. During the Christmas season, check it out at Tree.Schwippy.com
The technology used to control the tree is actually quite lo-tech. I have been using nothing but X10 technology. While a good relay/triac controller hooked up to the computer would be nice, you just cant beat the simplicity of X10.
Each different strand of Christmas lights has its own X10 lamp module and address, in this case G5, G6, and G7. There are 3 strands of lights per color. The lights are wired in series - one plugged into the end of the other - so all you see here is the head strand being plugged into each X10 module. X10 lamp modules were chosen over appliance modules so the lights would fade in and out instead of instantly turn on or off. It makes for a much more plesant scene. All the X10 modules are simply plugged into a power strip behind the tree out of sight.
The main controlling aspect of the entire system is the X10 computer interface module (Model CM11A). It is hooked up to a server running Ubuntu that is turned on all the time.
Since X10 is a power-line radio protocol, I dont have to have the equipment running in the same place, as long as they are on the same power grid (within a certain length, of course). The computer is in one room, while the tree is in a completely seperate room.
The computer sends a simple serial string to the CM11A module, which then translates the command into an X10 command and injects it onto the power grid for any receivers to capture. Unlike other X10 transmitters, the CM11A doesnt have to be locked down to one house code (The letter part of the code). Any house code and any unit code command can be sent from the computer.
The main html file that hosts the tree's page (Located at tree.schwippy.com) is hosted on an off-site server. If you are interested in the client-side scripting, just view the source of that file. On that page are the buttons that control the lights. Instead of the offsite server controlling the lights, it instead contacts a computer I have set up at home. The PHP file that is called on that computer is located below.
As you can see, when it detects that a user is trying to issue a command to turn a light on or off, the php file simply executes a commant on the shell of the computer. In this case, "heyu". Heyu is a great program written specifically for controlling X10 related hardware. In its simplest form, which is what is being used here, Heyu is executed as heyu <command> <address>. Issuing a the command "heyu on G2" will turn on any appliance that is hooked up to an X10 module with the code set to G-2.
Heyu needs to be compiled manually, so if you're trying to get it installed, make sure you know how to do this before hand. Once you have it installed, you will be able to use this for pretty much any home-automation project you can think of when it comes to scripting your house.
Also a thing to note, if you are using this script above, you will need to give the web user the privledge to execute the heyu command on the system. Make sure you have your system set up securely before opening any execution privledges.
Why it was done
The Schwippy Christmas Tree was inspired by Alek's controllable Christmas light setup. Definately check out his website at www.Komar.org. As well as doing controllable Christmas lights, he also does controllable Halloween decorations. All his proceeds go towards donations for researching Celiac Disease, which both his kids have.
My project was not done to try and 'one-up' Alek's, but rather just because it seemed like a fun project to do. It didn't seem to require a lot of effort (which it didn't), it was something that had high WAF (Wife Acceptance Factor), and just in general seemed like something people would enjoy (which they do).
This shows how much money I spent on the tree the first year setting it up. Each subsequent year it obviously only costs me the price of a new tree.
|Tree||We all know they vary in price||89.00|
|X10 Lamp Modules||One for each color (4 @ $12 ea.)||48.00|
|X10 CM11A Module||Try looking on Amazon||15.00|
|Christmas Lights||3 strands per color @ $4 each strand||48.00|