Home Automation Made Easy: Introduction to Control Protocols and Automation Process
The home automation process involves changing the existing state or condition of a device, an appliance, a system, or an electronic component from an internal or external stimulus or event, by a person taking an action, or as the result of the movement of time. To achieve that state change through automation, a control message must be sent to the device to be acted on. The condition or state changes can be a simple switching to an on-or-off status, or can be a more complex adjustment such as dimming to a preset level; and that device modification can be an incremental on or variable or both. The control messages are sent via any one of a number of defined home automation protocols.
From infancy we test various methods and learn ways to control others to meet our needs. Crying is typically the first, then sounds, and before long we are crawling and moving about and can begin to make things happen on our own. Over time our individual skill set builds and we can interact with all the things around us. The simplest control method is human intervention, flipping a switch to turn on a light, for example. You know which switch to use, what it controls, and which direction to turn the target device, in this case a light, on or off. The process or steps for turning a light on or off includes the following mental and physical steps: disturbed–decide–poise–act–receive feedback–adjust if needed–feedback–satisfied. The nonhuman intervention automation process mirrors the steps a person would take. The total home automation process is similar except that the system can do everything but decide what to do. The deciding is left to the human, who must set up parameters in advance for consistent automated operation.
One-off devices to perform some of many home automation steps or functions have been around for some time, but with limitations that are not present in a completely automated computer-controlled environment. This chapter gives a basic understanding of how a novice home automation hobbyist can leverage diverse protocols and choose from myriad available products and technologies to control all the automation functions on one central home automation platform.
Reasons for Using Automated Control
The need for home automation technology comes from wanting to make a change in the condition of something: turning on a light or lowering the thermostat, for example. This need for change arises from four basic categories: time, need, event, and communication. In many cases, your home automation platform can take these actions based on the same stimuli that would spur a human to action with little or no need for human interaction.
Time-based actions include actions based on a set amount of time passing, such as turning off a bedroom television after an hour of use so that the viewers can nod off and not worry, or actions based on a set time of day, such as turning on the coffee maker at the same time each morning. Time-based controls can be employed on any recurring interval, whether hours, day, week, day of week, and so on.
Need-based events are just that, events that have to happen simply because we want them to. When your home gets too cold, you raise the temperature on the thermostat; when it gets too dark, you turn on a light. Not all events can be scheduled, so your home automation platform has to be able to process need-based actions as well. Human participation in initiating the control action can be an easy mouse click or two away or can be done by voice command with the HAL platform.
Event-based actions are triggered based on an event, either predetermined or accidental. For example, you might set your thermostat to turn on the heat when the temperature dips too low, or have a trigger on your air handler shut off power to the unit if water is detected in the water pan.
Threaded through all of these prior circumstances to one degree or another is the desire we all have to stay informed. Some conditions, events, and actions we want to know about as fast as possible. Other events we don’t need to know about but want handled as efficiently as possible and without our knowledge, In some circumstances we want to be able to find out later, by looking at a log entry, that the situation was handled. For example we might want to be notified by email to our smart phone if an aging parent called during our absence from the house.
The feedback loop is a very desirable and important feature of a modern home automation system for those of us who want or need to stay informed. Fortunately, unlike many products currently in use for home automation, the HAL platform has the capacity to keep us informed not only of those things happening in and about the home, but also of financial, weather, and communication information gathered from the Internet or localized weather equipment. We live in an age when the speed of access to information and communication is unparalleled, so leaving some of the recurring chores of keeping informed and in touch though leveraging some artificial intelligence in our home automation can increase our own communication productivity and at the same time free us to focus on other important matters.
The true beauty of the core automation product line discussed in this book is that the HAL software “communicates commands and processes device feedback” in enough of the commonly popular home automation protocols that it is possible to automate nearly every electrical, mechanical, and electronic device in your home environment.
The next section introduces highlights of the four very popular home device control protocols and standards. As a hobbyist, you’ll find that it is important to know that there are differing protocols and that some are more suitable for certain tasks. By bringing diverse protocols into your home automation solution, you can have the best overall system with the lowest overall cost of implementation. Because the HAL software operates at the application layer in the control model, you are not locked into any particular protocol, brand of hardware products, or technology. It is truly a solution that allows combining best of the protocol breeds.
Protocols and Standards
When setting up processes to be completed with home automation technology, there are some relevant details to deal with for whatever protocol your control devices are using, but only during the initial setup or installation phase. After you have completed the device setups within the HAL software you will interact with HAL with language and words not protocols, but some readers will want to know about how those interactions take place. This section gives an idea of what is going on in the background to accomplish your control strategy.
Home automation standards are the set criteria for how home automation devices respond to a control signal and perform a function. There are many home automation standards, some of an open nature and others proprietary in nature.
Many consumers believe that implementing home automation is too expensive and available only to the very wealthy or technologically literate. Fortunately, the reality is that a complete home automation system is well within the reach of the ordinary home owner, provided that they have some spare time and a budget to build out a system. HAL software makes for a cohesive platform by integrating these various standards and protocols under one digital “roof.” Not only does it act as the protocol communicator, but it also translates the users’ needs into actions. After the devices and protocol interfaces are properly set up to work with HAL, the HAL software does the machine-level translating of the command to the physical. By using HAL software to control the various physical-layer communications, a home can have multiple types of devices installed and working together, even to the point of having a switch of one type activate a device of another, each using different control protocols.
The next few sections highlight some details of how the protocol adapters communicate with the devices.
Because everything in home automation relies on electrical signals of one sort or another that carry a message to make the changes for us, we are limited somewhat by the physics or physical properties of electricity as discussed in Chapter 1, “Home Wiring and Electrical Fundamentals.” Electrical signals can be of an analog or a digital nature. By using electrical, radio waves, or infrared light signals as our avenue or method of communication along the home automation control pathways, we are limited only by the physical properties of those signals. With electric power we can channel it to do work. By manipulating the properties of electricity we have the ability to communicate information to our advantage. We can use this communication property not only to control electrical and electronic things but also mechanical things like doors, locks, vents, and valves. This is accomplished by using the electrical controls and solenoids as our assistants to do the work from simple but highly defined message packets to control that work.
To borrow a page from biology, the control communication (electrical or wireless) pathway has to either sense and react to stimulus with a response or initiate a communication that will elicit a response or an action from a controlled device. Therefore, at the control pathway level or sensory level at the most primitive layer, there are only a few things that can happen with an electrical current to initiate or convey messages:
- It can be turned off or on. Example: Voltage/no voltage.
- It can be off, variable in voltage and/or current or frequency, or full on to the maximum. Example: high/low voltage; high to low frequency.
- It can be measured within a low or high range for voltage, current, or frequency to compare or match desired presets. Example: 95 VAC to 130 VAC: Normal household voltage.
- The sensed changes can be associated with time or timing cues to identify message start or end points.
These changes in the physical state are detected at the physical level (hardware, media level) and are interpreted as coded messages high up the application stack. They are used within the devices to execute the state change defined in the message.
Imposing Messages on the Physical Media
At the most basic physical level of the electrical wires or a wireless communication path, the medium used can carry an imposed signal of either an analog or a digital nature. The communication can be a one-way street; that is, sent only and received, or it can be twoway, with returned or reverse-direction message packets sent over the transmission medium from controller to device and back from the device to the controller. When an analog mode is used to communicate, the signal can be made to vary in amplitude or frequency so the resultant signal changes can carry frames of data.
In digital communications mode the signal can be chopped into time slices in which the amplitude of the signal is measured and is considered on or off in that time frame based on its strength, or measured as high or low in a time frame. These on/off states or high/low states of the electrical current or radio signal in digital mode are sensed or sent as changes in voltage, current, or frequency. They are used to represent zeros and ones or other numbers and are used as binary values that translate into data or information or are used as timing pulses to separate and keep track of chunks of the message. These representations of zeros and ones (or numbers) can be used at the distant end to represent anything necessary to perform the desired actions or convey the sought-after information. Parts of the message packets identify the target devices or all the devices or a group of devices through the encoding scheme used in the protocol. Timing pulses are used to define the beginning and end of the object communication so the communication packets maintain whole message integrity or are resent in two-way systems until the whole data packet is acknowledged.
One-way protocols cannot guarantee whole message delivery. A feature called “checksum” can be implemented as a part of a protocol to test the message for completeness and integrity by running a math formula against the packet’s data bit and comparing that to the checksum value sent with the message packet. These fundamentals are implemented in various innovative ways, but at the most basic level the communication occurs because of these simple property state changes at the electrical signal level regardless of the physical media (wire, wireless, infrared, or fiber) used for the transmission of data. In the OSI seven-layer networking model this media layer is referred to as the physical layer. To do the home automation projects in this book, you do not have to delve too deeply into how networking and communications are accomplished or understand them fully. Awareness of some features of protocols covered in this rapid overview should be sufficient for trusting that unique control messages can be sent and received successfully to make the home automation device-level processes function to your benefit.
The four protocols of primary interest used in this book’s projects include X-10, UPB, INSTEON, and Z-Wave. There are other protocols as well and likely there might be innovators in the future that will create other useful ways to communicate from controller to device. Some people talk about the network of things, a concept in which everything in your personal universe is identified by a unique communication’s address, such as an IPV6 address, and everything is connected and reachable though that address. We are not quite there yet, even though many of the pieces are in place. We can, however, communicate right now to the components that matter most to us by using these protocols.
In X10 the data message frames are imposed on an AC current carrying wire at the point where the electrical power is dropping from 120 volts positive down to zero and before the second half of the sine wave that is moving in the opposite direction begins its half cycle.
The frequency of the transmission is 120KHz, and it occurs for only a very short span of time at a specific point in the 60-hertz current cycle, known as the zero crossing point.
There are 16 available House codes A though P, and 16 available Device codes 01 through 16, allowing for a maximum device count of 256 for X-10 devices.
There are seven change state commands to issue to one-way X-10 devices—on, off, dim, bright, all lights on, all lights off, and all units off—which are all sent via a 4-bit code.
There are seven additional command/info settings available to use in the devices and controllers capable of two-way X-10 communication: status on, status off, status request, pre-set dim, hail, hail acknowledge, and the extension code (or extension code itself).
The minimalist data messages sent as X10 communications are referred to as data frames and must include a start code signifying that an X10 command is about to be sent, a one-letter code signifying the “house” the command belongs to, and one function code. The binary for that could look like 1110 01001011 0001, carrying the information message start, house code letter K, and command “all lights on.” It is a simple but limited protocol but is credited with beginning a trend in home automation implementation that did not require rewiring or additional control wiring.
Universal Powerline Bus is considered much more reliable than X-10. UPB communication messages are sent at speeds of a range of 120 to 240 bits per second.
In 60-cycle AC circuits each half cycle takes 8 1/3 milliseconds to occur. The UPB pulses are spikes in voltage placed on the power line at a precise time in each half cycle, the timing of which conveys a value from 0 to 3. Two bits of data are contained in each half cycle, and the data bits from four half cycles are grouped together and carry 8 bits of digital data, a UPB byte.
These bytes are combined into UPB communications packets sized between 7 and 25 bytes for interpretation and use by the device. Each message packet contains a preamble, a packet header, the data message, and a checksum byte followed by an acknowledgment frame. The header packets contain the information about network ID, device ID, source ID, and a packet control word. The data messages also contain the instructions for the device to perform.
One interesting element and what makes UPB different is that the information about the device ID, network ID, and so forth is stored in nonvolatile memory registers within the device.
INSTEON products operate by two communications over the media: over the home’s wiring system and over a preset radio frequency. The devices forward the INSTEON protocol signals, extending the network range for up to three hops; the signal originally sent is hop count zero (0). The three-hop limit prevents endless looping of the command signals.
If the original signal is 0, then the first rebroadcast is hop 1; if the next device adds hop count 2, and the next device hop count 3, there are no more hop counts. So the original signal sent from the first device can travel though three layers of devices to the fourth device layer out in the distant network.
The RF signals are sent at frequencies of 915MHz in the U.S. The power-line protocol is transmitted at 131.65KHz over the wire.
INSTEON plays well with X10 devices although their protocols are different.
INSTEON is a dual-band communications protocol, meaning that its digital signals can travel over the home’s wiring system and over radio frequencies.
There are about 200 available products that speak and understand INSTEON communications. Not that anyone would ever use that many but the core protocol can support more than 16 million devices per network.
The standard and smallest INSTEON message is composed of the following: from address (3 bytes), to address (3 bytes), flag (1 byte), command (2 bytes), and redundancy check (1 byte).
Z-Wave is a wireless protocol and is very much a networking protocol supporting quality two-way communication, much like the Wi-Fi that supports your computers’ connections to wireless networks. It operates at frequencies below 1GHz so it is mostly free from interference from the higher frequency Wi-Fi networks. A level of encryption of the data is supported to keep the communication between the devices secure and intact. Because it is at its core a networking protocol, it can support a version of IPV6 device addressing. It is a proprietary protocol but is supported by nearly 160 manufacturers making Z-Wave-compatible devices worldwide. There are nearly 700 available devices that speak and/or understand Z-Wave wireless messages.
A home Z-Wave network can support 232 devices, and more than one network can be bridged together at a higher layer to support more than 232 devices. This is rarely done in automated homes for two reasons. First, controlled device counts above 100 are rare, and second, other technologies can be used and might offer advantages in specific applications. When using HAL software as the hub command center, you are not limited to a specific technology as your home automation solution.
The Network ID (or Home ID) uses 4 bytes (32 bits) of the control message.
The Node ID uses 1 byte (8 bits) of the control message.
A single Network or Home ID can contain a total of only 232 nodes because some of what would be node IDs are co-opted for messages or performing exceptional functions. One has to accept that node IDs are identified from 000001 to 11101000 in binary or 0x1 to 0xe8 in hexadecimal.
Z-Wave’s approved radio frequency operating range for the U.S. and Canada is set to 908.4MHz.
The devices emit low-power radio waves and the maximum transmit/receive ranges are considered to be 90 feet in buildings to 300 feet outdoors in the clear. Z-Wave presents a good option for controlling something located in outbuildings supplied or powered by a different electrical service because of the potential to send signals via radio wave to 300 feet.
Each Z-Wave network begins with at least one primary controller and a controlled node. New devices are brought into the network by a process called inclusion (or taken out by exclusions). After the network is set up, secondary controllers can join and can be brought into the network.
Two types of device nodes can take on one or more of three characteristics:
- Controllers—Control other Z-Wave devices.
- Slaves—Are controlled by other Z-Wave devices.
- Routing Slaves—Pass messages to nearby neighbors, thereby extending the range of control of the entire network but adding modest time delays for the routing table lookups and retransmissions to each next available neighbor in turn.
Z-Wave presents two clear advantages because it is wireless. The first advantage is that you can control devices that are on nearby alternative wiring systems. The second is that you can use a handheld remote to control Z-Wave devices, again thanks to its wireless communication media.