Linux turns the lights on with X10

396

Author: JT Smith

By Russell C. Pavlicek

A few years ago, my daughter was in a serious car accident. When she came
home after spending two weeks in the hospital, she had trouble moving
around. Simple tasks such as turning her room lights on and off were
difficult and painful.
Thankfully, just before the accident, I had ordered a Firecracker home control kit from
X10.com. The kit included the Firecracker
interface, an appliance control transceiver unit, a lamp control unit, and
a hand-held Palmpad controller. With these devices, it was possible for
my daughter to manually control her lamp and her stereo from bed.

But the thing that was lacking was some degree of automatic control. Her
light needed to go on at dusk and shut off later at night. Likewise, her
stereo needed to be shut off at bed time. The Firecracker device (a
small dongle that connects to the serial port of a PC) was designed to
control actions like that, but the software provided for it was written
for Windows. This was useless with my daughter’s Linux PC.

Thankfully, several industrious people had already set about the task of
controlling the Firecracker interface under Linux. I found two
projects to be of particular value: a command line utility called BottleRocket and a Tcl/Tk
application called RocketLauncher. The home page for RocketLauncher seems
to have disappeared, but I have posted a copy of it on my
Web site
.

BottleRocket is a useful command line program for sending X10 commands via
the Firecracker device. It can be called by other programs (like
RocketLauncher) or can be invoked from any standard command shell. It is
also particularly useful for use by the cron program, which makes the task
of automating the X10 devices a breeze.

How do these things work?

The Firecracker is a small dongle that plugs into a nine-pin serial port.
It has a pass-through connector, so you can even plug in another device
(in my case, a line to my UPS unit) on the same serial port, if
needed. Manipulating the serial port in certain ways will cause the
Firecracker to generate RF signals that communicate to a transceiver
unit.

The Palmpad is a simple handheld remote control that also transmits RF
control signals. But where the Firecracker requires a PC to control it,
the Palmpad is designed to be a simple human interface.

The transceiver is a plastic box with an antenna that plugs into a
standard electrical socket. It has a socket built in, so it can
control one appliance directly. In addition, it can transmit signals over
the electrical lines to other X10 devices, like the lamp control unit.

It should be noted that both methods of transmission (RF and electrical
system) are far from reliable. If you have excessive RF noise in your
location, you might find that some devices will go on or off by
themselves. In our case, a business facility nearby generates enough
stray RF noise to cause our back-yard light to turn on by itself sometimes.

The transmission along electrical lines can also be disrupted by “noisy”
devices. We have some power strips that apparently prevent the successful
transmission of signals when they are plugged in between the transceiver
and the device to be controlled. Also, it is possible that devices on one
electrical circuit may not be able to be controlled by a transceiver on
another circuit.

Despite these restrictions, however, it is still possible to achieve
satisfactory results with automated device controls. Mind you, I wouldn’t
run someone’s heart monitor off one of these things (what do you expect
when you can buy device controllers for under $10 at the X10 Web site?),
but they work well enough to be useful.

What’s the Linux part?

A quick search of Freshmeat.net reveals that a number of people have been
busily creating interfaces to X10 devices over the years. People who want
to investigate a very elaborate control system might want to consider the
MisterHouse project.
But for me, the BottleRocket program is the most useful. Using a
simple command syntax, like br B4 on, you can turn on and off various devices (in this case, the lamp or appliance at house code “B,” unit number 4 is turned on). I have a series of such commands inhabiting one of my cron configuration files. To
compensate for the possible garbling of any one command from stray RF
signals, I tend to repeat the same command at one minute intervals in the
cron file.

The RocketLauncher program is an X11 application that emulates an X10
Palmpad (how is that for a confusing pair of Xes?). It paints the
approximate image of a Palmpad on the screen and then uses BottleRocket
and the Firecracker to send signals to transceivers in the vicinity of the
PC.

Control your house

My X10 experience began with the small kit that aided my daughter through
her convalescence (she’s doing much better now, thank you). But, before
long, I found that the X10 system could be useful for other things as
well. Our front and back lights are now turned on and off at preset
times. A lamp in the living room is now set to come on around dusk, which
keeps our many pets from sitting in the dark until someone comes home.
During the winter, there is no need to catch a chill late at night
by shutting off holiday lights when instead, they go on and off at set times. And, of
course, all of these lights can be controlled via various remotes
throughout the house (we use a number of X10 universal remotes to control
TVs, VCRs, and lights).

The key to this process is reliability. If I were using, say, Windows ME
to control the Firecracker to send signals at certain times of the day, I
would probably worry that the system would hang sometimes and fail to do
the job. In that case, I would probably need to employ one of X10’s
more expensive programmable control units to send out signals at preset
times of the day. But, thankfully, the stability of Linux keeps the
lights going on and off when they should. It has been almost three years
since my daughter’s accident, and Linux has never let me down.

Control your mouse

Anyone who has heard me lecture in the past couple of years has probably
noticed that I use a wireless mouse when I talk. This is actually an X10
Mouse Remote I carry with my laptop. When the remote receiver is
attached to the mouse port of my laptop, I can use the remote to easily
perform all basic mouse functions under Linux. No special drivers are
required to use the remote as a simple mouse.

The RF nature of the remote also allows you quite a bit of freedom when
giving a talk. Unlike an IR remote, the RF remote does not need to be in
line of sight with the laptop. In fact, it does not even need to be in
the same room as the laptop. This gives a presenter plenty of room to
roam, so to speak.

Someone has written a special driver called “remoted,” which will allow you
to program some of the Mouse Remote’s special buttons to execute shell
commands. I haven’t had a need for such functionality, but it is
certainly nice to know that it is there if needed.

Those darn pop-under ads

Yes, X10 is also the company behind many of those annoying “pop under” ads
that occasionally appear while surfing the Web. If you have ever closed a
browser window only to find another window underneath it trying to sell
you an inexpensive surveillance camera, you have been the victim of X10’s
marketing campaign. It is annoying enough to cause some people to boycott
X10 entirely, but I have no intention of ripping out my home automation
system just because the company uses irritating advertising practices.

Conclusion

The X10 devices controlled by a Linux box can make for a useful,
cost-effective home automation solution. Because of the reliability of
Linux, you can use a simple device like the Firecracker to easily control
lamps and appliances through your house. And with the proper kit, you can
even control the mouse on your Linux laptop.