X10 Interface

June, 2009

I’ve had various X10 lamp modules for many years, but always relied on the wireless remote controls to trigger them.  So, I decided to attempt to integrate some basic X10 lamp module interface capabilities into my home automation system to automatically turn on and off the lights in the house at different times, and for different triggers.

I invested in an X10 Pro PSC05 2-way power line interface.  It came with a special RJ45-25 pin serial interface plug (called TWSerial) that allowed me to use a plain-text interface with a serial port application to enter basic commands like this:



It did not come with any manual, so I had to reverse engineer some of the very limited functions including on/off, dim, all on/off, etc.  As nice as this module was, it did not give me the ability to do actual 2-way interface.  This was pretty much a “fire and forget” type of a module.  However, it did allow me to overcome the challenge of having to write special code to interact directly with the PSC05 which seemed quite challenging at the time.

To interface it with my home automation system, I wrote a simple app that took command line parameters and passed them to the x10 interface via an assigned COM port.  At that time, the .NET framework’s COM interface was not reliable, so I wrote the module in VB6.  In fact, this module became one of the oldest pieces of code I wrote since it was a self-contained module.

I wrote the app to send the ON/OFF command twice in order to get better results.  X10 has consistently proven to be only about 80% reliable in my house.  I’ve invested heavily in tools to measure and supress noise on the line, but it doesn’t seem to help.  Also, as I’ve migrated this code to faster servers, I’ve had to adjust the sleep value between commands in order to optimize good results and fast-executing code because the X10 wireline protocol is very time sensitive.

I created a simple X10 control table inside my MS SQL Server 2008 database.  I did some research and taught myself how to write a trigger using T-SQL using the special command:  EXEC master..xp_cmdshell which let me launch the VB6 app and pass it parameters to turn on/off lights.  Next, I updated the Watchdog app to include timers that would automatically turn lights off every night at midnight (in case they were left on by accident).  I was able to leverage the motion detectors in the house to delay the light off command if motion was detected.

Source Code:

Attribute VB_Name = “Module1”
Public Declare Sub Sleep Lib “kernel32″ (ByVal dwMilliseconds As Long)

Private Sub Main()
Dim i As Integer
Dim Args, Arg() As String
Dim comX10 As MSComm

On Error GoTo HandleError
Args = Command
If Len(Args) = 7 Then
Arg() = Split(Args, ” “, 2, vbTextCompare)

Set comX10 = CreateObject(“MSCommLib.MSComm”)
comX10.CommPort = 1
comX10.InputLen = 4
comX10.Settings = “2400,N,8,2”
comX10.PortOpen = True
Sleep (50)
comX10.Output = Arg(0) & Chr(13)
For i = 1 To 2
Sleep (575)
comX10.Output = Arg(1) & Chr(13)
Next i
comX10.PortOpen = False
End If


End Sub


Capture Capture2



  1. Did you figure out what is sent out for DIM? I got A01 R20 ABR – and I was thinking that 20 was the dim value, but i’m not seeing it work when I test it out.

    1. Sorry, I ripped out all of my X10 a long time ago. I did learn that not all PCS05’s are the same – I found some older ones do not have “advanced” capabilities like dimming.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s