.NET X10 CM17A (FireCracker) Control

Last year I started to explore different home automation possibilities and stumbled upon X10.  This looked like a cool solution since it doesn’t require any new wiring in the house, which I couldn’t do anyways since I’m renting.  It was also quite inexpensive, and there were plenty of sellers on eBay selling them for cheaper than X10.com.

My main purpose for this was just to control the lighting in my living room.  Since none of the lamps are on light switches, I was looking for a better way to turn them on and off.  With X10, I am able to use a remote to turn the lamps on/off and also brighten and dim them, which totally beats needing to turn each lamp on individually.

This was great, until I discovered…

FireCracker

So, yeah, the remote thing was cool, but then I found that there’s an X10 component called the FireCracker, which is a serial device that connects to a computer and is able to send X10 commands to the transceiver, much like the X10 remote does!

This definitely opens up some opportunities to further automate some tasks using X10, since I don’t even need to use the remote.

X10 provides some software that comes with the FireCracker; however, I figured if it was as visually-appealing and user-friendly as the X10 website, I’d look around for other options.  Thankfully, X10 published the specification for communicating with the FireCracker here.  This makes third party development much simpler :).

I looked around for some .NET libraries that I could just use, but a couple of them didn’t work, and one of them was written back in 2001 (here).  I ended up basing my development off of the one that was written in 2001.  This one actually did seem to work; it just had some outdated code in it.

VexedLogic.X10

So, after a couple of hours of updating some of the code to use the .NET Framework provided components to communicate with the serial port and various other tweaks, I have come up with a console application and library that is able to send X10 commands using the FireCracker.

FireCrackerCtl.exe

FirecrackerCtl.exe <ComPort> <HouseCode> <DeviceCode> <Command>

Available COM Ports: 1 2
HouseCodes: A-P
DeviceCodes: 1-16
Commands: On Off Bright Dim

The console application is straightforward.  Execute it providing the COM Port that the FireCracker is connected to, the house code and device code of the device, and the command to send to the device.

VexedLogic.X10.dll

The console application is essentially just a wrapper around the VexedLogic.X10.dll library.  This library can be referenced in any .NET 3.5 (or higher) application.

Here’s a sample usage of the DLL that turns device A1 on using a FireCracker on COM1:

public class Program
{
    private static void Main(string[] args)
    {
        X10Command cmd = new X10Command {
            HouseCode = 'A',
            DeviceCode = 1,
            Command = Firecracker.Commands.On };

        using (Firecracker firecracker = new Firecracker(1))
        {
            firecracker.SendCommand(cmd);
        }
    }
}

Download FirecrackerCtl.exe and VexedLogic.X10.dll

Tags: , , , ,

This entry was posted on Saturday, June 4th, 2011 at 3:02 pm and is filed under C#. 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.

4 Responses to “.NET X10 CM17A (FireCracker) Control”

Celia November 16th, 2012 at 12:58 pm

Howdy! I hope you don’t mind but I decided to post your blog: http://csharp.vexedlogic.com/2011/06/04/net-x10-cm17a-firecracker-control/ to my on-line directory. I used, “C# .NET X10 CM17A (FireCracker) Control | Vexed Logic!?” as your website title. I hope this is acceptable with you. If perhaps you’d like me to change the title or remove it completely, e-mail me at celialarge@gawab.

com. Appreciate it.

Robert Greathouse November 17th, 2012 at 7:54 pm

Do you have the code uploaded to Github or some other public repository?

Charlie Foxtrott February 8th, 2013 at 12:36 am

I definitely appreciate your work. I was researching to roll my own, and here it was ready to go. Bonus!

Questions:
Did you implement the x10 All On (0x91), All Off (0x80), Lamps On (0x94) and Lamps Off (0x84) commands?
If so, how are they accessed?

-CF

Tyler March 23rd, 2013 at 5:15 am

Whoa, that is truly spot on, couldn’t have stated it any better myself If I tried. I’m a awful writer
and couldn’t write a effective article if my life relied on it. Terrific work, really worth a read.

Leave a Reply

You must be logged in to post a comment.