Unitz LLC
Home   |   Unitz News   |   Contact Us

Automate Your Christmas Lights!

Bookmark and Share
Posted by Paul Reilly at 3:35 pm on December 10, 2009 • Fun,General,Programming
Holiday Lights Display

Holiday Lights Display

As the holidays fast approach, millions of us are pulling decorations out of the attic, grabbing extension cords and untangling the lights. Last weekend I set up the tree, put lights outside, and put candle lights in each of my windows. It certainly looked nice and festive, but I quickly dreaded having to plug and unplug each set of lights every day.

Fortunately, I had a solution! Using X10 automation modules, my windows computer and about 30 minutes of effort, my lights now turn on and off automatically every day!  This post details the steps I took to accomplish this, and provides some resources so you can set up a similar solution yourself.

The X10 automation system is technology that send signals across your home wiring, to turn on and off lights and devices you plug in to power outlets. To get up and running yourself, you’ll need a starter X10 kit – I recommend the Firecracker Kit.

X10 Firecracker Kit

X10 Firecracker Kit

Be forewarned – the x10.com store is notorious for popup ads and gaudy design. Despite this, their products are quite reputable. Also please note that most of the items mentioned in this post are available on eBay for a fraction of the cost. The Firecracker kit has four items – a transceiver which receives the on/off signals and sends them through the house wiring (and can turn on/off an item plugged into it), a lamp module which can turn lights plugged into it on and off when it receives a signal sent by the transceiver, and a computer interface and remote control – both of which send the on/off signals to the transceiver. You can purchase any additional lamp outlets you may need on eBay inexpensively as well.

The x10 transceiver lets you select a letter from A-P via a simple dial.  This is the ‘house code’ for that transceiver. Each of your lamp modules then let you pick both a house code and unit number from 2 to 16 (the transceiver itself is unit 1). Each combination of house and unit numbers must be unique. So to get started, set your transceiver to house code A, plug a set of Christmas lights into it, and plug it into the wall. Then take your lamp module, set it to house code A and unit number 2, and also plug lights into it and plug it into the wall. You’re ready to turn these on and off using the included remote control! Set your remote to house code A, and then hit the unit 1 and unit 2 on buttons – voila! the lights turn on. With more lamp modules you can set all the lights you want to control throughout your house this way, as long as the unit numbers are all unique.

After setting this up, you could just stop here. You can now turn off all of the lights with the push of a few buttons – much simpler than walking all over the house twice every day! But I wanted the lights to turn on and off completely automatically. To accomplish this, I utilized the fourth item that came with the Firecracker kit – the computer interface, called the CM17A. This tiny little item plugs into your computer’s serial port and sends the same signals that the remote control sends, only you can configure your computer to send the signals automatically. The following explanation is done on a computer running Windows 7, but the same steps can be accomplished on other versions of Windows, though the steps may look a bit different.

commandprompt

X10 Command Line Example

X10.com offers software packages for a fee that allow you to set up complicated macros – this was overkill for me as I just needed to send on and off signals once a day. I used a very simple command line tool created by Adam Davis instead. Once you have the CM17A plugged into your computer, visit his website and download the CM17A.zip file. Create a c:\cm17a\ directory and unzip the files there. Then start up the ‘Command Prompt’ under the accessories section of the start menu.

Type ‘CD C:\cm17a\’ into the command prompt, as illustrated in the screen shot. The cm17a program is in this directory and is called with two or more parameters. The first is the COM port number of your actual cm17a device on your computer. The second parameter is the device you want to control. If you want to turn the lights plugged into the lamp module you set as house code A, unit 2, the parameter is ‘a2on,’ and to turn it off, it is ‘a2off.’ You can string multiple commands in a row, separated by spaces, so if your cm17a device was on COM port 2, and you want to turn lamp modules a2, a3 and a4 on, you would type ‘cm17a 2 a2on a3on a4on’ into the command prompt and press enter. All three sets of lights should now turn on. By the way, if you don’t know the COM port of your device, it is likely 1,2,3 or 4, so you can type a few sample commands varying the code to see which one works.

X10 Batch Script

X10 Batch Script Example

Okay cool, so now we have a way to control the lights via our computer, now what? The next step is to load up notepad – we have to create a very simple batch script. This simply means we type the command that you’d use through the command prompt into a file that we can run automatically later. Follow the screen shots to see how to type the command and how to save the file – its important to select save as file type ‘any file’ and save the file with .bat at the end. Otherwise it will append .txt to the end and this won’t work.

Save as a .bat file in Notepad

Save as a .bat file in Notepad

After you created a lightson.bat, now do the same process again, changing the on’s in the file to off, and save it as lightsoff.bat.

The final step is to tell windows to run these batch scripts automatically. This is done using the windows ‘Task Scheduler, which is in Start -> Accessories -> System Tools. When the task scheduler is up and running, select Action -> Create Basic Task. We’re going to create two of these, one to turn the lights on, and one to turn the lights off. Name and describe the task any way you’d like. Under Trigger, select daily, and then pick the time you want the lights to turn on. Under action, select Start a Program, and then browse to C:\cm17a\ and selected the lightson.bat script that you created. Also, under the ‘Start In’ box, type in ‘c:\cm17a\.’  Once you’ve finished the lights on task, do the same thing to create a lights off task, which runs at a different time and calls the lightsoff.bat program instead. Optionally you can refine the tasks further by editing their properties, telling the computer to turn itself on if it’s in sleep mode to run the task, along with other options.

X10 Task Manager Example

X10 Task Action

This was the last step! Now your Holiday lights will turn themselves on and off each day without you having to lift another finger. Happy holidays from Unitz!


Additional Notes and Tips:

The bigger your house or your lighting needs, the more complex this setup can become. The following are a few additional tips that might help.

  • Your whole house isn’t necessarily on the same wiring circuit. This means that some light modules might not respond to transceiver signals. There are a few solutions here. X10 offers hardware to bridge your circuits, but this requires opened up your power panel. A simpler solution is to just buy an additional transceiver and set it to another house code – then set the light modules on this circuit to the new house code.
  • To avoid buying lots of lamp modules, you can use extension cords and power strips to turn on multiple lights with one receiver – make you’re only using low wattage lights though.
  • Newer computers don’t always have serial ports. Fortunately for just a few dollars on eBay you can buy Serial to USB converters, which solve this problem.
  • The wireless range of CM17A might not be wide enough to reach your transceiver(s). You can purchase serial extension cables (or in a USBextension if using a USB to serial adapter.)
  • Obviously this solution can be used for many more uses aside from Christmas lights.
  • If you want to do more complex actions, or involve other X10 products like video cameras, they do offer software that has more control.
  • X10 lamp modules do not currently work well with compact fluorescent bulbs.
  • This same approach can be used with other operating systems. In Linux it can be done with bash scripts and cron jobs – the following explains how to control the CM17a in Linux.
  • If you only want to control some devices automatically, you can still use the remote control to power other devices.
  • http://www.iopus.com/guides/winscheduler.htm has additional examples of how to schedule tasks in windows.

2 Comments

  1. it is wise to choice to select Light Emitting Diode christmas lights becaue they are not fire hazard ;:~

    Comment by Keratin Hair Treatment · at 11:57 am on November 13, 2010

  2. Good – I should definitely pronounce, impressed with your web site. I had no trouble navigating through all the tabs and related information ended up being truly simple to do to access. I recently found what I hoped for before you know it in the least. Reasonably unusual. Is likely to appreciate it for those who add forums or anything, web site theme . a tones way for your customer to communicate. Nice task.

    Comment by BG mail at 9:46 am on October 11, 2011

Comments are closed for this post.

TrackBack URI

Unitz LLC, 850 North Randolph St., Suite 103 - A38, Arlington, VA  22203 * Tel. 703-539-2542 Email us