Home automation system design: the basics
Home automation is a method of controlling home appliances automatically for the convenience of users. This technology makes life easier for the user, and saves energy by utilizing devices according to strict requirements. Controls can be as basic as dimming lights with a remote or as complex as setting up a network of items in the home that can be programmed using a main controller or even via cell phone from anywhere in the world.
A home automation system can involve switching off electrical appliances like air-conditioners or refrigerators when a desired temperature has been reached, then switching on again when the temperature has crossed a certain value. A home automation system can also be used to secure a house from burglars by sending alerts to the nearest police station and the homeowner in case a trespasser is sensed.
Figure 1: A basic home automation system
Apart from algorithmic automation, devices can be controlled by the user to suit personal requirements using direct buttons, cell phones, the internet, or infrared remotes. A network of appliances and sensors can interact with each other and make decisions for operation.
This article provides a framework for designing a cost-effective and functional home automation system, first discussing the general design considerations that should be evaluated before starting, followed by a review of the trade-offs amongst various architectural approaches, and then how to implement that design using system-on-chip technology.
There are several design challenges and considerations involved while developing a home automation system, many of which are determined by user needs. Once those have been determined, the designer can choose the appropriate processor, sensors, and communication protocol for the system, keeping the following parameters in mind:
Type of Interface: The most basic and crucial requirement in a home automation system, the interface is the basic communication protocol and hardware combination used for sending and receiving messages between devices and the user. Designers have many options for executing communication between devices, the user, and the overall system, depending upon the system, range, size of house, ease of use, etc. If a user wants to control the home appliances through the Internet, the designer needs to add an Ethernet/Wi-Fi interface to connect the system to the home network. If the user wants to control the system using Bluetooth from a cell phone, the designer needs to add a Bluetooth interface to communicate with the device.
The choice of communications interface also depends upon the topology used between the central control unit (CCU) and room control units (RCU). These units will be discussed in more detail later in this article.
Sensing Requirements: The designer needs to determine the sensing requirements of the user and decide upon the required sensor to perform the task. He or she also needs to assess the sensor specifications required for different needs and usability in different environments. The range of sensors that should be considered include:
- Thermistors can be used to control air conditioners, refrigerators, geysers, heating system, or in case of fire.
- Humidity sensors sense the moisture level in the environment.
- Gas sensors can be used to detect gas leaks.
- Light sensors can be used to detect the luminous intensity in the house.
The information provided by these sensors (after signal conditioning) is used by the processor to make several important decisions regarding the appliances and when to switch them ON or OFF.
Security level: Another major requirement while designing the home automation system is to make the entire system secure so that it can’t be easily altered to give control of the house to unauthorized users. It should be able to prevent most types of intrusion. Even if the system is broken into, it should be able to send signals to the user and the nearest police station. It also necessary to hide as many components as possible from direct access via the main control panel, preventing it from being turned into a black box. It should also be able to send and comprehend encoded data while communicating with other devices. This will prevent intruders from tapping into the system and using the same interface to hack devices.
Topology: Topology defines the way home automation control units interact with each other. A star type topology is the most commonly used as it makes use of a central control unit (CCU) interacting with all the available remote control units (RCUs) and taking over decision making responsibilities. The role of the RCUs is to send data fetched from the sensors back to the CCU. After it has assessed the input from the sensors and made any necessary decisions, the CCU sends the command back to the RCU to take a specific action.
Another topology to be considered is a mesh topology, which has no CCU and makes use of a constellation of control units of roughly equal intelligence and capability connected with each other. Each unit sends information on the network which is shared by all the units. Each Unit is independent and makes its own decisions based on the shared information.
The choice of system topology governs the selection of communication interfaces such as ZigBee, RF, Bluetooth, etc.
Depth of automation: System design is affected by the requirements ranging from simple control of lights in the house to controlling all appliances and the security system. Each requirement affects the overall design, and developers need to determine the most optimized way to perform all the tasks with the lowest cost and complexity. Despite the internal system complexity, the system should be easy to use and not pose barriers to its operation by a household user.
Cost: This is the most important aspect of system design as system complexity and depth of automation determine the cost. A highly complex - and thus costly - system can deter customers from purchasing and installing it in their house.
The cost of the system is directly linked with the number of components, interface used, and complexity of design of firmware and hardware. While there should be no compromise on the quality of hardware and software, the number of components in the system can be decreased to reduce the overall cost and system size as well. Rather than the traditional component-based approach, lower cost can be achieved using System-on-Chips (SoC) that integrate multiple peripherals and a processor into the same IC.
The architecture of a home automation system
While there are several topologies to choose from, for the sake of simplicity we focus in this article on a star topology-based home automation system and its two types of control units, the CCU and multiple RCUs (Figure 3).
Central Control Unit: The Central Control Unit is the hub and brain of a home automation system. Common features of a central control unit are:
- Measuring the current environmental conditions using the various sensors and control the lights and fans of rooms accordingly
- Receiving instructions from a remote user over GSM or Ethernet and controling an appliance in a specific room as per the received instructions
- Controlling appliances based on time, such as automatically switching off a television at a specific time
- Monitoring the current state of power and switch off appliances to protect them when a power fault is detected
- Informing remote users when an intrusion is detected or when some fault is detected in the system
Room Control Unit: A Room Control Unit controls the appliances in a particular room. It has a set of sensors to sense the surrounding environment. Based on the current conditions, it can decide upon a course of action. Common features of a room control unit are:
- Monitor the current environmental conditions using the various sensors and communicate this data to the CCU
- Receive instructions from the CCU and control appliances in the room as per the received instructions
- Control appliances based on inputs from a hand-held remote
- Control appliances based on inputs from user buttons
Let’s look at the architectures of both of these units separately:
Central Control Unit
This is the main unit responsible for monitoring the complete home automation system. It interfaces with other system blocks to perform required tasks. The most common interfaces on a CCU are shown in Figure 4. Some of these interfaces are optional and are used as per the system and user requirements.
Different blocks found in a typical central control unit are:
Sensors: Sensors are the eyes of a home automation system. They “see” the environment and convert what they find into an electrical quantity that can be measured by a microcontroller or system processor. Basic home automation sensors include temperature sensors, humidity sensors, light sensors, and gas sensors. Data in the form of signals from these sensors can be used to control the various appliances directly without any human intervention. For example, lights can be automatically switched on upon sunset, an air conditioner can be switched off automatically when no movement is detected in the house for a half hour, or an alarm can be raised when the system detects a LPG leakage event.
Analog Front End (AFE): Each sensor converts the change in a physical parameter such as temperature or light intensity to a similar change in electrical parameters such as resistance or capacitance. These physical quantities must be converted to a voltage equivalent so that the microcontroller can identify the variation in environment. For this purpose, an analog front end (AFE) is interfaced with analog sensors. The AFE preconditions output signals coming from the sensors by filtering out noise and providing required gain to the signals. AFEs are also required to calibrate the system for sensor readings, thus providing a base value for the system to identify any changes in the environment.
Remote Connectivity: Depending on need and various design considerations, users may need to be able to control the system and appliances remotely. The two most common ways of doing this are using GSM-based mobile telephony and the Internet. GSM, Ethernet, or both interfaces can be used to communicate with the system from a remote location. The system can also send or “push” useful information to users such as periodic updates, faults, intrusions, etc. These connectivity options generally require a serial communication protocol like SPI or I2C to communicate with the host processor.
Local Connectivity: The Central Control Unit and Room Control Units need to communicate with each other periodically as well as when events occur. There are multiple options available to establish communication between the CCU and RCUs that can be decided upon based on system cost and topology, including Bluetooth, RF transceivers, and XBEEs, among others. Each of these interfaces has its own pros and cons, hence system designers need to consider all of a system’s requirements before selecting a particular interface.
Manual Control: In a typical home automation system, there are situations when the user needs to manually control one or more appliances. Keypads and/or infrared remotes are most commonly used to provide system control to users. Manual user control should be authorized by the system to prevent control of the system by an intruder and the shutting down of intrusion alerts.
Real Time Clock (RTC): Home automation systems must be able to control appliances based on time. An accurate time source is required to control appliances using time-based settings. An external RTC can be used to maintain time for the system and the central controller can access it to receive current time related information.
NFC Interface: Near Field Communication (NFC) is used for close proximity communication. This technology is quickly gaining traction in embedded applications for communications and information sharing. It can be used to at the main door to lock or unlock the door using the homeowner’s NFC-enabled smartphone.
Power Monitor: In any house there are many electrical appliances that are sensitive to voltage fluctuations and need a reliable supply voltage within a specific range to work as expected. A power monitor block can be added to the Central Control Unit to check the instantaneous power supply voltage. This block brings down the voltage level of power supply to a level where the system can monitor it using an ADC. Using input from this block, the controller can detect low voltage, high voltage, and voltage fluctuation situations. In extreme cases, this block can instruct RCUs to switch off sensitive appliances to prevent damage. An example of a simple power monitor circuit is given in Figure 5 and can be easily implemented into automation systems.
In the power monitor circuit, the potential divider circuit brings down the mains voltage to a lower voltage which can be safely measured by a microcontroller ADC. The peak detector circuit creates an envelope on the scaled down voltage that gets measured. The protection diode protects the microcontroller by limiting the maximum voltage to its Zener Voltage (Vz).