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

Attention!

For the 2011 season, the Schwippy Christmas Tree has been completely rebuilt, and no longer uses any of the technology explained in the following write-up. A new explanation will be written as soon as possible. In the mean time, you can subscribe to updates from the previous page to be notified when the new page is online.

Details

Tree

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.

Server

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.

Script

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.

<?
// this file will control the christmas tree using X10
// it looks for the command in the URI


// list any IP addresses (or IP address segments)
// that are not allowed to control the lights
$ip_strings_to_block = array(
		"68.55.",
		"71.233.12",
		"72.21.60",
		"80.37.93",
		"83.16.4",
		"193.200.150.167"
);


foreach($ip_strings_to_block as $userip){
		$pos = strpos($_SERVER['REMOTE_ADDR'],$userip);

		if($pos === false){
				// ip is ok
		}else{
				// IP IS BANNED! Dont let them in
				header("HTTP/1.1 403 Forbidden");
				exit();
		}
}

// now lets find out what unit we are supposed to be controlling...
// then pass the command to the shell

switch ($_GET['lights']){
		case "blue_on":
				passthru("heyu on G5");
		break;
		case "blue_off":
				passthru("heyu off G5");
		break;
		case "white_on":
				passthru("heyu on G6");
		break;
		case "white_off":
				passthru("heyu off G6");
		break;
		case "green_on":
				passthru("heyu on G7");
		break;
		case "green_off":
				passthru("heyu off G7");
		break;
		case "red_on":
				passthru("heyu on G8");
		break;
		case "red_off":
				passthru("heyu off G8");
		break;
		default:
				// somebody is trying to mess with my stuff
				// do nothing
		break;
}


// Now try to auto-redirect them back where they came from... or show them a link
// if auto-redirect doesnt work
echo ("
		<center>Successfull!
		<br />
		<a href=\"javascript: history.go(-1)\">Click to go back</a>
		<script>
				history.go(-1);
		</script>
		");


?>

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

Project Cost

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.

Item Notes Price
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
$200.00

 

Comments

how do you embed the video streaming? ;)
I use a Fonera 2.0n (89 euro) with a logitech webcam (25euro) and a sis-pmctl (http://sispmctl.sourceforge.net/) for 20 euro ... it's a fake tree that is used every year...
Haha I remember this from a couple of years ago, thanks for making my night a little brighter, God bless you :)
I love you. I came across the Blender Defender on Lifehacker, which lead me to this. I work with Electronic Aids for Daily Living for people with disabilities, and have been looking for a simple, elegant way to control X10 devices remotely through a website. You've done it and shown me how!

Sure, this may look like just an interactive christmas tree, but I see it as a person with quadriplegia controlling his or her lights, TV, doors, windows, etc.

Thanks!
I'm the Alek from "Alek's Controllable Christmas Lights Setup" that is talked about above. I recently ran across this web site and I'm darn disappointed I missed it last year - this is GREAT!!!

I'll have mine up again in 2008 (already am warming up with Halloween) and the world is a better place with more crazy Christmas Displays - I look forward to checking out the Schwippy Christmas Tree in 2008 - awesome job!
Totally looking forward to seeing it in action for 200
It's really sad how much enjoyment people get out of watching and controlling someone else's life. It's just a Christmas tree...
g english
This is very near voyeurism. The only difference is the people actually want us to watch them.



FREAKS.
Jimi Hendrixxx
this is obsly an american no one would be able to waste so much lecky if they tried!
xPlacebo
lolz i sah teh kat
Yuben Meatslapt
Connection closed, WTF!
@Daku: Because everyone fun is asleep.
I'm off to bed myself now. And on a final note...
....GO GREEN!
Wow this is boring now.... Why isnt the chat fun?
GOOOOOOOOOOOO GREEN!!!!!!!!!!!!!
I love you Green!
mycabbit
Ihope that was a cat that just ran across the bottom of the Christmas tree. was this a school project
mycabbit
next year you need to do the whole room. I saw this done last year with a house. It was on the news. It would be funny to do a halloween web site that you can control. I know that you can think bigger. I know that this just the start. Where's the presents. I would like to watch you cook breakfast too
Edddie Donnelly
I like christmas im a fool
Far too much fun... I like green...
Top_Gun_2021
I bet all the kids are gonna cry if they walk pat it and it flickers like this >_>
MrSpinkleswirth
haha, i turned your tree off. XD
JeweledSoul
This adds new meaning to the question blinking or non-blinking lights? Very clever of you and fun for us. Thanks!
getting boring...
haha this is awsome
DualShooter
This thing is freaking awesome!
Rampancy
I got banned from the Shwippy Christmas Tree chat...
I am a monument of all your sins LOL
Wolenber
isn't*
Wolenber
Chat is working for me, is it working for you guys?
Wolenber
If I owned that tree I would sit there ALL DAY watching it change colours.
hahaha
Cool demo.... Fun with technology!
I have the POWER! (*echo...echo....*)
Submit a Comment

Attention!

If you would like participate in a real discussion about this project, you may be interested in visiting the new Forums instead of just leaving a comment

Name
Email (We send a validation email. Also used to display your Gravatar)
Message
47364