X10-ified
I work for Interactive Intelligence. It’s a great company, with very cool technology. Our IP-Telephony software means that all of my phone communications (and so much more) are managed via our client software that runs on my computer. One feature of our client software is the ability to have plug-ins that can receive and respond to events. This extensibility can lead to a lot of great innovation when it comes to integration with existing 3rd party products (think IM clients, Outlook, custom applications, etc).
I primarily use a SIP phone for my calls, but since I don’t have a SIP hardphone, I have to use a softphone (my headset plugged into the sound card). One disadvantage of this is that it’s really hard to tell if I’m listening to music or on the phone, and that can lead to both interruptions in phone conversations, and/or embarrassed co-workers who interrupt a conference call accidentally! So I thought to myself, how could I indicate my status to a person at my door wanting attention? Our software of course has presence management built in, which means another user in our organization can look at my current status, but that does them no good when they’re standing there looking at me. To make a long story short, I decided that I could try to turn on and off lights depending on my availability (ala an “On Air” light in a radio station). Then I could also handle another problem my SIP softphone presented: I can’t tell when my phone is ringing if I have my speakers turned down and am not looking at the computer screen! Turning on a light (maybe a strobe??) in the hallway will alert me to my silently ringing phone.
After a sleeplessness night and a lot of web researching, I settled on using X10 to control lamp states. X10 has a reasonably priced “Firecracker” kit, and as awful as their website is, this seemed to be the best bet. A serial-port driven wireless interface that can control any X10 device? Sounds great! My only hesitation was the lack of documentation on interfacing with the firecracker. I was worried that it would be some complex propriatary protocol that would take forever to reverse engineer. After doing a little more research, I came across two very encouraging blog/web posts that convinced me to go for it! Bubble, Bubble, Build’s In Trouble at Pragmatic Automation, as well as a blog post by Craig Andera called Build Lights (wiki page with his source code). We were definitely thinking along the same lines! And Craig showed me the light in pointing to the ActiveHome SDK that offers an easy-to-use API for the X10 Firecracker.
I purchased the X10 kit on eBay (saved 10 bucks), and began writing my plugin. A day or 3 later, my unit showed up, and my plugin was ready for testing. Funny thing was, though, that it didn’t work. Big Disappointment #1: I was using the approach taken by Craig (using the ActiveHome SDK) and the call to the provided dll was tanking. As it turns out, I just didn’t read the documentation thoroughly enough at the outset. The ActiveHome SDK requires that the ActiveHome software be installed on the computer. Not only does the software cost $50/pop, but when you’re writing a plugin that with the flick of a keyboard can be installed to all the users in an enterprise, requiring an extra 3rd party application just, well, sucks. It makes sense for Windows Messenger, or Outlook, but in this case my requirements (generated by myself) were that people could plug in the firecracker dongle and get cracking, no special software required.
After a little more investigation, I saw that the Pragmatic folks didn’t use the same X10 interface that Craig used. Their software was written in Java, and used a freely available Java Firecracker API (thanks to Michel Dalal–credit goes to him for my C# port of his logic). Now we’re getting somewhere! I cleaned up my spilt milk, stopped crying, and began porting the Java API into C#. Big Disappointment #2: the .NET Framework (v1.1 and earlier) doesn’t offer an easy way to control your serial port. I had hoped it would be as easy as Java where you specify a port and say .open(). However, some more searching on the web revealed that while 95% of the information about serial ports and .NET included the statement “Use .NET 2.0″, somebody from the remaining 5% had created some classes (in C#–I don’t like porting VB.NET to C# if I can help it) that used P/Invoke to talk with the serial port. Back in business again! This time, to avoid as much trouble as possible, I stripped out all the wonderful functionality of those serial port classes and left the bare minimum that I needed. I called it “SimpleSerialPort”.
— You see, the Firecracker device/dongle does not communicate over standard serial port protocols. It watches the RTS/DTR pins for it’s signal and power.
Anyway, to make a long post only a little bit longer, it worked! A few bucks more at Target snagged me an “ON AIR” light (that says “Applause” on the other side–fairly appropriate) and another simple base with bright red bulb. Now when my phone rings, out in the hallway the red bulb glows with an evil look. When I am on the phone, the ON AIR light switches on and warms me up with the residual heat! It’s great! I’ll try to post a picture soon, if I can.
I am planning on posting the code for both the simple serial port and the Firecracker API soon. I’d also like to add dimming capability to the Firecracker control, and make the code generally a little cleaner. Once I have those posted, you should be good to go to control X10 devices from whatever application you want!
August 22nd, 2007 at 11:30 pm
Good work, I have used some of Craig’s creation source before. BTW: I had the AH Pro software on an older computer. When I purchased my new XP Media Center, I really didn’t want to install the AHP software ( I have my own Software, that runs as a service for my camera and lights ). I was able to use the ActiveHome DLL without installing the Active Home Pro kit. I did have to install the free drivers from X10 though.
I would love to see your code when you post it.
August 22nd, 2007 at 11:30 pm
Sorry that I haven’t posted it yet. It has a bug I need to work out, and I have been so slammed with a deadline at work (plus some ill-timed vacation time) I haven’t had time to work on it. Perhaps tonight, tomorrow, or this weekend I can get to it and post it. Check back soon, though!
August 22nd, 2007 at 11:30 pm
Any plans to post the code for the SimpleSerialPort? I’m really curious to see it… all of the APIs I had seen before didn’t go that low-level, especially for C#.
August 22nd, 2007 at 11:30 pm
Aaron,
Could you please post the code. I am a graduate student and working on building a framework for feedback devices. I would like to show yours as an application of the framework.
August 22nd, 2007 at 11:30 pm
Great point!
Fortunately for me, when something gets in my head, it’s hard to shake it out. I stayed up last night and cleaned it up.
August 22nd, 2007 at 11:30 pm
Nice. Good use of the technology – glad I was of some assistance.
I’d encourage you to post the code now and update it later. If I had a dime for every time I’ve seen “I just need to clean it up a bit” followed by a vast yawning silence, I’d be wealthy.
Post the code so people can use it now – they can clean it up themselves if it needs it.
November 7th, 2009 at 6:10 pm
Since you really got into the X10 stuff I’m curious if you stuck with it now that there are a bunch of newer technologies or if you opted to upgrade. Let us know!
November 7th, 2009 at 8:45 pm
@Insteon – I did stick with it, but only because my needs are so simplistic and the firecracker hardware is so stinking cheap