Getting your X10 CM17A Firecracker Module Working in Linux
Haven’t you always wanted to control your Christmas lights with your Linux server? Being able to control X10-enabled devices opens up your world to a whole new level of geekness. There are several other powerful reasons to put your computer in control of your lights and appliances including programming simple timers and controlling your lights from anywhere in the world. I’m going to show you how to do it with the CM17A interface. There are plenty others out there like the CM10A, CM11A, and others. You may be able to tweak this article to your needs if you have a different interface other than the CM17A.
Checking your Inventory
Before we can go on, here are the supplies you will need to get the ball rolling.
- CM17a Firecracker Module.
These can be bought from x10.com or eBay. - X10 Transceiver (TM751 or RR501)
- Lamp Module (LM465) or Appliance Module (AM466)
Note: The X10 Transceiver also functions as an appliance module. - Palm Pad Remote (HR12a)
The remote is optional since we will be using our computer to send commands.
If you need to purchase all items in the list above: consider purchasing a bundle kit, like the CK18A 4 Piece Home Kit.
The items listed above are the minimum to get your X10 home automation started. If you are looking for more geeky automation toys, go to x10.com. Be careful though, it’s easy to spend money on cool stuff like this.
Installing the Software
I use Heyu to control my devices. It’s a simple command-line tool that you can easily integrate into a front-end, or use it as-is out of the box. Combining the command line tool with cron jobs is enough to make it worth it.
Download a copy of the software at Heyu’s Download Page. This is software that you will have to download and compile yourself. If you are used to deb packages and RPM’s, don’t worry. It’s not bad. Download the software and extract it. Fire up a terminal window and cd to that directory. Follow the Quickstart instructions in the INSTALL text file.
Testing the Interface
Now is the time to connect the hardware. Connect the firecracker interface to your primary serial port and connect your other modules. Make note of the house code that you set and the unit code. The house code is the code that all of your devices will adhere to. For example, if your transceiver is on house code D, then all of your devices have to have house code D. I recommend not using A because the Smith’s next door might be too lazy to switch it off of the default as well. The unit code is the unit’s unique ID. Make note of what you set on that as well.
For the purpose of this tutorial, I will be using house code A. Please change accordingly as you read through this.
Once you have everything ready to go, fire up a terminal on your computer with the interface, and type in the following:
heyu fon A1
Then type:
heyu foff A1
If you did everything correctly, you should have heard your transceiver switch on and off. (assuming your transceiver was off to begin with)
Understanding the Command
The two commands above are simple commands using the heyu program. View the man page of the ‘heyu’ command to see all others.
For example, if I wanted to turn off the appliance that has the unit code ’6′ and is on house code ‘A’, I would type this:
heyu foff A6
If I wanted to dim a lamp that was already on that has the unit code ’7′ and house code ‘A’, I would type this:
heyu fdim A7
Simple, no?
Extend the Knowledge
Now that you know how the program works, it’s time to put it to use. Since, these methods of implementation are beyond the scope of this article, I will only be providing the ideas, not a step-by-step. If you need help on the implementation of some of these ideas, please post a question in the comments area, and I will expand on it in another post.
Cron Jobs: Use simple cron jobs to time lights or appliances in your house such as lamps, Christmas lights, etc.
Web Interface: Forgot to turn on your porch light? Now you can from work, your Internet-enabled PDA, wherever! If your server has web server capabilities, make a PHP/HTML front-end to your home’s devices. Here is an example of how you can do it in PHP: X10 PHP Example
Have others? Post it in the comments section below.
This entry was posted on Monday, November 5th, 2007 at 12:52 pm and is filed under Linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
laroseengineer March 3rd, 2008 at 9:55 pm
I had the sample X10 php working (nice job by the way) and then I tried to use domus.link and I can no longer use the php web page to execute the commands. I can execute the heyu command from the command line but it won’t work through the web any more. Any ideas? I checked the web page and it is owned by root so it should work. No php configuration changes were made. The only thing that is different is I tried out domus.link. There is a X10state file in the /etc/heyu directory that I don’t believe was there before.