Schwippy Tree

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

2014-06-04 19.28.21


 

Attention!

As of 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 X10technology. While a good relay/triac controller hooked up to the computer would be nice, you just cant beat the simplicity of X10.

largedsc_4529

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

largedsc_4535

cm11a

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

 

 

 

Plasma2002

For my bio, please see http://www.plasma2002.com/about

20 thoughts on “Schwippy Tree

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

  2. It's really sad how much enjoyment people get out of watching and controlling someone else's life. It's just a Christmas tree…

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

  4. 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!

Leave a Reply

Your email address will not be published. Required fields are marked *