Apress - Smart Home Automation with Linux (2010)- P10 potx

5 312 0
Apress - Smart Home Automation with Linux (2010)- P10 potx

Đang tải... (xem toàn văn)

Thông tin tài liệu

CHAPTER 1 ■ APPLIANCE CONTROL 28 C-Bus Although there are several well-known protocols for appliance control, X10 is the best known by a long shot with members of the general public being aware of it, primarily because of its low barrier to entry. Within the HA community, however, it is the ownership of a Clipsal C-Bus system, which becomes the goal. 6 About C-Bus The C-Bus system was developed by an Australian company, Clipsal, as a means of controlling various light systems remotely. Clipsal’s original intention wasn’t in the field of HA but in stadium lighting rigs and commercial arena and conference centers. This meant the system had to support much longer cable runs than would be utilized in a home setup and a larger address space. It succeeded on both counts, with cable lengths of 1km being possible with 100 appliances on a subnet—with each subnet being capable of connections to another six through basic bridges or considerably more through the now available Ethernet bridges. Differences Between X10 and C-Bus C-Bus’s primary difference is with its installation. Although X10 transmits its data along existing power cables, C-Bus devices are controlled by utilizing a proprietary protocol that travels along a separate Cat- 5 cable. Consequently, such installations can be carried out only by qualified Clipsal-approved staff, pushing up the initial cost. However, once all the cables have been laid, one achieves the benefit of a near-zero level of maintenance since the interconnects will always exist and remain future-proof. It also provides two-way communication between the switch and a computer, making it trivial to query the state of the light dimmer or appliance. Furthermore, since the signal speed is not limited by the zero- crossings in the power line, all light changes happen instantaneously—a benefit that only those with many years of experience with X10 systems can truly appreciate. To lower this initial overhead, Clipsal has recently introduced a wireless version of C-Bus, which eliminates the need for costly installations, so it is this subset of devices on which I’ll concentrate. This optionally supports 128-bit encryption of its data stream, making it more secure than an (unfiltered) X10 wireless solution, although it’s still hackable by the determined. Its wireless range is no better than the RF-X10 combinations covered previously, with a 5 to 20 meter range according to material. Unfortunately, there is a maximum of 30 devices on a C-Bus wireless subnet, making it less capable than an X10 system using two house codes. The generally adopted approach to C-Bus installations is that a wired version is used for the initial house configuration, with wireless being added later as a cheap upgrade path. For the geek, the primary difference is in the software because the protocol is closed, making Linux tools impossible. To reclaim this market, Clipsal has released an RPM containing a binary-only driver that is available for zero cost on its website. 6 C-Bus is used mostly in the United Kingdom and Australia, with the U.S. equivalent known as SquareD Clipsal. This is to avoid confusion with a similar technology called CEBus/EIA-600 utilizing the consumer electronics bus (CEBus). CHAPTER 1 ■ APPLIANCE CONTROL 29 ■ Note A Red Hat package manager (RPM) can be utilized on non–Red Hat platforms such as SUSE or converted using tools such as Alien. The biggest problem with drivers packaged in this way, however, is its level of compatibility with the Linux kernel. Any change in the driver API, or similar breakage between kernel version numbers, will render the driver (and therefore your C-Bus system) useless. In these situations, when there is no more open solution available, it is always best to keep a low-level legacy system available and be prepared to migrate other software away from the box when necessary. Unlike X10, each C-Bus device contains a microprocessor that makes it possible to control other devices remotely, without a computer. This is provided by switching the device into one of its five modes, which break down roughly as follows: • Normal, stand-alone, switch • Basic peer-to-peer switch control • Networked switch control • Networked switch control, with remote • Interfacing with a wired C-Bus install The adscititious computer is of benefit to smaller HA installations and those concerned about complex lighting UI. But for those of us intending to control other devices, the inclusion of a PC is not an issue. Devices Like X10 devices, C-Bus has the ability to dim lights and control appliances that are attached to it. Where they differ is the ability of a C-Bus light switch to control one or more other devices straight out of the box and with minimal on-device configuration. ■ Note I’ll consider only the wireless devices here, for the reasons given previously. Controlling Lights There are two designs of light switch, Neo and Saturn, which fall in the 5850 and 5880 product ranges, respectively, and differ by their decorative styles only, although within each group you have the choice of two-, four-, six-, and eight-button versions. They are always paired, with the first two buttons controlling CHAPTER 1 ■ APPLIANCE CONTROL 30 the dim function of the connected lightbulb. Each subsequent pair is required to transmit the button press information (wireless) to another device, 7 or devices. Because of the built-in microcontroller, these switches can be configured as a dimmer switch, an on/off pair, a remote trigger, or a scene trigger (the latter being the C-Bus term for macro programming, where several state changes can occur on several devices at the same time). Scene programming can also occur through the C-Bus Toolkit Software, although this is currently available only for Microsoft Windows. There are several devices in each family, capable of various support loads and characteristics, but generally speaking a C-Bus dimmer will support incandescent and halogen lamps between 25W to 500W (up to 2A), along with fan motors (up to 2A). These two series also provide basic switch units. These appear the same as their lamp-controlling counterparts, except that they lack the dim functionality. By way of compensation, they can support a much greater range of devices (up to 2KW, and 8A in places) including fluorescent lights. ■ Note There appear to be no in-wall units for sale, meaning you cannot use wireless C-Bus electronics with your own style of face plate. Controlling Appliances Like X10, C-Bus provides an appliance module that plugs into the wall and controls the flow of current to its corresponding socket. These are known as the 5812 series plug adapters and look like their X10 counterparts, with the exception that they too support dimming and switch versions. Since every C-Bus device includes a microcontroller and the C-Bus protocol supports the remote programming of other devices, any of the light switches mentioned earlier can also be used to control an appliance switch by programming an “association” on the switch, equivalent to a Linux symbolic link. Controllers The Series Wireless remote control 5888 is the main device here. It is an RF transmitter (operating at 433.92MHz) supporting ten devices up to 70 meters away (although 25 is more likely inside a building). Because of the unified design of all C-Bus modules, it is technically possible to control more than the allotted ten devices by using the remote to control one switch, which in turn controls another two through the use of a scene. Furthermore, no RF gateway is required to use this remote, since the C-Bus wireless network is already operating on RF. This also means that multiple remotes can control any individual device, and any individual button can control multiple devices. Like X10, it also supports an “all off” message. 7 Provided they are configured in a networking mode. CHAPTER 1 ■ APPLIANCE CONTROL 31 Gateways With so much emphasis on the wireless network, it is sometimes necessary to revert to wires. This is where the Wireless Gateway C-Bus 5800 Series comes in. This is a necessary feature and the only way that the wired and wireless versions of C-Bus can be connected together. Also, through the use of software such as C-Bus Toolkit, it can be connected to a computer for remote, sequenced, and intelligent control. Consequently, this device is also necessary for a wireless-only network that needs to feature PC control since the 802.11 wireless protocol used by commercial routers is not suitable as a C-Bus wireless gateway. Networked Devices Although X10 and C-Bus both provide a good means of sending simple controls to simple devices, more complex communication requires something better. More specifically, it requires something with more bandwidth. When the command is “play this song,” it needs significantly more bandwidth. The most accessible way of supplying this is through a local Ethernet network, because it can send commands and data at high speeds without the distance limitations of USB, RS-232, or parallel cables. And unlike X10, two-way communication is provided for free as part of the specification. Ethernet Devices There are many devices that support communication through Ethernet, either to control it or to supply it with data. Some can work on their own without additional hardware, such as personal video recorders (PVRs) and media enclosures. Both consist of a method of storing the media and the technology for playback. Others require a server to supply it with data. The functionality of the device, and its use within an automated home, is always improved by utilizing networked capabilities. This means you will need a server, of some kind, for most future appliances. This elicits the distinction of two necessary parts—a front end and a back end—connected by a local area network, be it wired or wireless. The front end, or head unit, will generally consist of a device connected to a nearby HiFi or TV in order to play media located on a physically remote machine. Because such a unit is placed in the living room or bedroom, it should be small, silent, and attractive. Preferably, it should also be fairly cheap, because one front-end unit is needed for every room in the house that wants to participate in streamed media. The back end, by contrast, is stored away from the main living areas (since it’s generally a big PC with a noisy fan) but able to supply media streams to all the head units within the house via the network. I’ll cover various media-oriented head units in Chapter 3, although most of those shown could be re-created with a Linux machine running the appropriate software. However, the power usage, noise, and cost will generally be larger than a custom-built embedded device, even though many of those devices may be running Linux themselves! To connect the units, however, you need to know how to set up a network. Networking Primer To best utilize the devices here, you will need to configure a Linux machine as a suitable server. Most computer science books will begin their networking section by describing the OSI seven-layer model of networking I won’t! Instead, you’ll learn only the necessary, practical steps of providing and configuring a suitable home network for automation. CHAPTER 1 ■ APPLIANCE CONTROL 32 ■ Note Each Linux example here, and throughout the book, is based around Debian and the packages within it. This is not advocacy on my part, merely practicality, because it’s what I use. Some distributions may place the files in slightly different places or have slightly different names, but the principles are always the same, and the equivalents are easy to find. Concepts A home network is a way for each computer in the house to share a set of common resources such as printers, scanners, and storage space. In this sense, it’s very much like an office network. Where the home differs is in the level of technology and, consequently, the expertise needed to run it. One of the main bugbears in office IT systems is the issue of security. With a home network, the relationships between the people using it are very much different, and social mores are brought to bear. The standard network configuration has two parts—internal and external. The internal part is a network that connects all the house computers together, along with their peripherals, and makes them invisible to the outside world. These devices may be networked together through cables or wireless. The external network is everything else! The big, wide Internet is generally unavailable the computers at home; it is available only by connecting to an ISP through a modem, broadband connection, 3G card, or similar device. To connect these two sides of the network together, you need a router. Sometimes the router is a small box that comes as part of your DSL/cable/broadband package and automatically separates the internal and external traffic. Sometimes you’ll need to buy one. They have one RJ-45 socket carrying the external network traffic, into which you plug the network cable from the broadband modem, and one or more outputs to the internal network. Alternatively, you can use a PC with two network cards—one configured to talk to the external network and one for the internal. If you have a 3G card, then this acts like your externally configured network card. With the router existing in both internal and external networks, it is able to automatically keep both sets of traffic separate and block any data or software you don’t want moving between the two. Most routers are configured, by default, to allow all outgoing traffic but block all incoming traffic, except those on specific ports. The port is the route by which traffic protocols flow and is dereferenced by a number. All web pages, for example, are requested on port 80. So if your router is blocking incoming traffic on port 80, you won’t be able to access your internal web server from outside your home’s internal network. Depending on the number of machines on your network, you might also need a switch that provides additional network sockets, into which you can plug more computers. Although it is unlikely that many people will fill eight sockets with computers, it is not uncommon to have noncomputer devices that also use Ethernet to transmit data, thereby exhausting the available sockets. Addressing Every device on the network must have a unique address. There are two current forms of addressing, IPv4 and IPv6. IPv4 was the original form of describing addresses by means of a dotted quad, such as 89.16.172.66, and is used by virtually every machine and home device on the planet. IPv6 was introduced in 1998 by the Internet Engineering Task Force to overcome the various problems with IPv4, such as address exhaustion. However, its adoption is less than widespread, and many of the small, home- oriented devices do not use it, so I’ll be concentrating on IPv4. . follows: • Normal, stand-alone, switch • Basic peer-to-peer switch control • Networked switch control • Networked switch control, with remote • Interfacing with a wired C-Bus install The adscititious. their decorative styles only, although within each group you have the choice of two-, four-, six-, and eight-button versions. They are always paired, with the first two buttons controlling CHAPTER. bridges. Differences Between X10 and C-Bus C-Bus’s primary difference is with its installation. Although X10 transmits its data along existing power cables, C-Bus devices are controlled by utilizing

Ngày đăng: 03/07/2014, 20:20

Mục lục

  • Prelim

  • Contents at a Glance

  • Contents

  • About the Author

  • About the Technical Reviewers

  • Acknowledgments

  • Introduction

  • Appliance Control

    • Making Things Do Stuff

    • X10

      • About X10

      • General Design

      • Simple Case

      • Standard Case

      • Fully Automated

      • Assigning Addresses

      • Using Multiple House Codes

      • Device Modules

      • Controlling Lights

        • Lamp Module (LM12U)

        • Bayonet Lamp Module (LM15EB)

        • Wall Switch (LW10U)

        • MicroModule with Dimmer (LWM1)

Tài liệu cùng người dùng

Tài liệu liên quan