Home Automation with Linux

3681

Home automation may sound like a science-fiction dream, but in reality it is not only commonplace, but relatively simple to get started, especially with Linux.

Smart control of household appliances and utilities begins at the low end with plug-and-play radio frequency (RF) and powerline modules and relays that can easily interface with a small home server in charge of scheduling and monitoring. At the high end, a home automation setup may include environmental controls, home security systems, and many other add-ons, which–despite the name–are important concerns for businesses as well as residential customers.

Lighting and environmental controls (such as heating and air conditioning) are the most common home automation targets. Both can be activated according to a fixed schedule, or respond to sensor data such as ambient light or temperature, and can be programmed to behave differently according to the time of day, day of the week, or season. Security systems, such as lighting that responds to motion sensors, door/window triggers, and video surveillance cameras, can also be tied in to home automation systems, making it possible to activate lights if a window break is detected, in addition to calling the police or other standard security responses.

Increasingly, home theater aficionados use lighting and environmental automation to control “scenes” for their entertainment rooms. Most AV receivers, home theater projectors, and motorized projection screens include serial port control, making it easy to tie in to a single system with other home automation devices. In addition, almost any appliance or electrical device can be remote controlled, and thus managed by a home automation computer–from sprinkler systems to window shades. The only impediments are finding the hardware modules to connect the device to the network of automated services and the software to control it.

Standards

Underlying any home automation system is the communication standard with which messages are relayed between components. The home automation industry has several, some proprietary and some open, some controlled by a single equipment vendor and some implemented by multiple manufacturers. The oldest standards tended to use powerline signal transmission, but newer systems use RF exclusively or a combination of both.

X10 is easily the most widely-known standard; it is an open standard using powerline transmission. Although it has a maximum signal rate of just 20 bits per second, the low cost of components makes it popular, particular for newcomers to the field. X10 was created in 1975, but a newer standard called INSTEON exists that is backwards compatible with it, but includes a much higher signaling rate, built-in error detection and retransmission, and hybrid RF-and-powerline communication. Unlike X10, however, the INSTEON specification is patent-protected and available only from its creator, Smarthome Technology.

C-Bus, Bus SCS, HomePNA, and Z-Wave are other standards growing in popularity, but which are controlled by either a single company or a trade group. In contrast, the LonWorks and KNX standards have been approved by the ISO, IEC, ANSI, or other standards bodies, and can be implemented without paying royalties. KNX is distinct in that it is the unification of three prior standards, the European Installation Bus (EIB), European Home Systems Protocol (EHS), and BatiBUS. ONE-NET is an interesting new standard engineered to be vendor-neutral and open from the ground up.

In addition to these home automation-focused standards, there are several other protocols that are often used to integrate devices into smart home systems, including the ZigBee wireless communication protocol and (increasingly) USB and Bluetooth.

Basic Linux Applications

Support for home automation starts with sending and receiving messages using the appropriate standard. X10 support is broad, and there are multiple X10 control devices that you can connect to a Linux computer over a standard RS-232 serial port. One of the most actively-maintained X10 package for Linux is Heyu, which supports multiple generations of X10 serial port devices. Heyu is a command-line driven tool that can run as a daemon or a cron job to automate commands, but there are several third-party front ends available as well.

Other X10 utilities include Bottlerocket for the popular X10 “Firecracker” model controller, and X10d which is not Linux-native but is easily patched for Linux support. Both are bare-bones communication packages focusing on sending and receiving signals directly to the attached X10 serial device, but have a healthy ecosystem of higher-level tools designed to run on top of them. In addition to the projects’ pages, Neil Cherry’s Linux Home Automation site has lists of these user-friendly applications.

INSTEON is not as widespread as X10, but there are several independent Linux projects that support it as well. Cherry supplies several INSTEON utilities, some of which are ports of X10 code. There is also iLink, which can communicate with both serial and USB INSTEON controllers. The more ambitious may prefer the Efundies site, which caters to electronics tinkerers, and has both hardware and software hacking guides, including code samples and documentation.

The proprietary protocols–understandably–have little to no support in free software, although a handful of free utilities for Bus SCS are linked to from the My Open Bticino site, and at least one Z-Wave vendor has released source code to a Linux driver for its products.

LonWorks and KNX each have several independent driver projects, most of which support only specific hardware–in some cases not off-the-shelf components. Cherry’s site maintains the best list. ONE-NET has code and documentation available on its site, but thus far the only compatible hardware options are evaluation kits.

Whole-House Systems

For the do-it-yourselfer and hardware hacker, rolling your own solution from the device drivers and low-level tools listed above is not only adequate, it is more fun than a plug-and-play home automation environment. However, for the less adventurous, there are projects that abstract away the need to worry about bit rates and device codes, so that you can simply plug in the components you have and focus on drawing up your lighting plan and AC schedule.

MisterHouse is the oldest still-maintained whole-house system for Linux. It is written primarily in Perl, and focuses on X10 devices, supporting a wide array of X10-to-computer interface devices including serial port, infrared (IR), and network-attached. MisterHouse can schedule appliance and light behavior by time, but also accepts voice input, file monitoring, and remote network triggering. It has a standard web interface, but also supports writing to LCD panels and speech output.

MisterHouse is easily extensible via Perl, and add-ons are available that extend coverage to other standards, including INSTEON. In addition to lighting and appliance control, MisterHouse integrates iButton weather station monitoring, certain alarm, pool, and sprinkler systems, entertainment systems, and standard email, Web, and instant messaging features.

Priscilla is a newer whole-house system that implements X10 and EIB/KNX device control, can use serial or IR connections, and supports 1-Wire programmable devices in addition to off-the-shelf components. The Priscilla development team is based in France, and consequently can incorporate electricity usage monitoring, a feature not possible in all countries. Priscilla is written in PHP and runs on top of Apache and MySQL.

Pluto is a commercial offering that runs on top of Linux, marketed mainly at builders and equipment manufacturers. But homeowners can use an open source version of the same code for free with LinuxMCE. Pluto and LinuxMCE support X10, INSTEON, EIB/KNX, and Z-Wave, plus the PLCBUS and EnOcean protocols. In addition to basic home automation, Pluto and LinuxMCE are built to serve several other roles, such as security system, telephony server, and multimedia DVR and entertainment server. This functionality is built on top of existing open source code such as MythTV.

OpenRemote is relatively new, but boasts an ambitious array of planned technology support: X10, INSTEON, KNX, ZigBee, and IR. OpenRemote is a Java-based Tomcat application, which runs on top of Apache. The current release does not yet support much beyond IR, but it is a project to watch. Again, Cherry maintains the definitive list, so if none of the projects mentioned above precisely fit the bill, it is worth checking. New projects are always in development, such as Domogik or the Ruby-based R-House.

Like any large-scale project, home automation demands a time investment, whether you take the do-it-yourself approach or use a whole-house system. Setting up the modules, designing lighting scenarios, and planning then testing the schedules takes time. There is also a hardware investment–even the simplest and cheapest standard, X10, begins to add up once you purchase a dozen or more modules and controllers; INSTEON and the other standards can be an order of magnitude more expensive. Still, the open source device drivers and Linux-based whole-house management systems are vastly less expensive than proprietary options, and like all open source code, offer the user unlimited freedom to customize.