An open source home automation solution

By Sanjeev Sharma

Engineering Manager

Mentor Graphics Embedded Systems Division

April 18, 2018

Product

An open source home automation solution

A seamlessly integratable, open-source-software-based, reconfigurable and expandable smart home automation system using a Raspberry Pi 2.

A wide variety of home automation solutions are being developed – but most of them require professionals and skilled staff to install and/or operate them. Furthermore, most of these solutions lack the potential for seamless integration into an already functioning home environment. To bridge the gap between consumer and expert, and to allow integration into any existing home environment without physical alteration to the building, a modular home automation solution with seamless integration potential is required.

The proposed system uses open source software and hardware, allowing for development to continue within the existing open source community. This type of system can be installed and configured without professional skills or physical alteration of the environment itself, due to its modular design and flexibility.

A smart home automation system, by definition, is the integration of electrical devices (including actuation of non-electrical devices such as blinds) and the monitoring and control of the home environment through an intelligent system or by a user over a communication medium, such as Bluetooth or Wi-Fi, and coordinated by a computer. 

Within this connected environment, tasks can be made more intuitive and effective. The home network handles all communication and a user is given access to the system via a personal computer, smartphone, or tablet from either within the home or from a remote location over the Internet. The integration of information technologies into the home environment allows systems and appliances to function with convenience, energy efficiency, and safety benefits. The overall smart home architecture therefore consists of the devices and appliances within the home connected to the home network, the user, and the industry service providers.

Existing smart home automation systems are uniquely designed to suit specific consumers home environments and requirements. These systems are complex in design, not flexible enough to meet the custom requirements, and are often embedded into the physical structures of the home – they are also expensive, which prevents adoption by the average consumer and limits the potential for reconfiguration and expansion in order to satisfy the changing needs of the consumer. In addition, the exclusion of open source software also prevents the growth and expansion of smart home automation system.

To solve these problems, a seamlessly integratable, open-source-software-based, reconfigurable and expandable smart home automation system is proposed. To serve as a platform upon which research can continue, it should make maximum use of open source hardware and software. It should also allow for multiple configurations of sensors and actuators and be easy to modify, resulting in a modular design. This will allow the third party community and every customer to reconfigure the system such that it suits the requirements of each unique household.

From the concepts considered, it is decided that the system would run on the Raspberry Pi 2 development board (Figure 1). Many different operating systems can be loaded onto the Pi 2 including Linux and Android, both of which are open source operating systems.

[Figure 1 | A Raspberry Pi 2]

The rest of the system is designed around the Pi 2, which uses a modular, slave/master system design. The master and all slave nodes are connected to and communicate via a home Wi-Fi router. A user gains access to the system either locally over Wi-Fi, or remotely over the Internet. Certain environmental sensors and electronic actuators are included with each slave in this concept. The user interfaces developed as a locally hosted web server or through any application installed on smartphone, allowing the system to be controlled from almost any device that is equipped with a browser.

A simple diagrammatical representation can be seen in Figure 2. The red arrows represent user side communication that is only transmitted between the master node and the user device, whereas the blue arrows represent slave side communication that is only transmitted between the master node and slave nodes.

This research is divided into following areas:

  • System architecture
  • System network 
  • System hardware and software 
  • Hardware and user interfacing                                                            

System architecture

The proposed architecture uses only two types of modules: supervisor engine (SE) and control engine (CE), which are interconnected by a communications network.

As can be seen in Figure 3, the system has a distributed nature and is organized in a two-level hierarchy. SEs are the high level modules and they perform, essentially, supervision tasks. CEs are low level modules that Interact with the physical world through input and output devices.    

[Figure 2 | Diagram depicting entire system layout]
[Figure 3 | System architecture]

System network

A key element of the proposed architecture is the communications network that interconnects the various system modules. This network is of paramount importance as it may affect several characteristics of the system, such as performance, flexibility, and cost. However, we decided to go with MQTT, which is a M2M/IoT connectivity protocol.

We wanted the network to be simple to allow its implementation on the CEs without the need to add any specific hardware or significantly increase the processing and memory requirements of those modules. Without this care, their cost could increase dramatically and the same could happen to the overall system, as the CEs are numerous.

System hardware and software

CEs are very simple and each performs a dedicated task (lighting control, digital inputs/outputs, infrared remote receiver, etc.). Essentially, they have basic microcontroller (PIC) and I/O hardware. This contrasts with a previous version of the prototype, in which all the intelligence was built in the SEs and the CEs were merely I/O cards. This saved microcontrollers, but made software in the SEs very complex (because several of the tasks were hard real-time, thus precluding the use of an operating system kernel and forcing the task scheduling to be done by stringent interrupt timings).This new organization makes software development much simpler by decoupling basic functions from the SEs into the CEs.

SEs have a more sophisticated and powerful controller (80x86, ARM compatible microprocessor). Their function is to implement the intelligence of the system, as programmed in the PC interface, in contrast with CEs which deal with low-level tasks. We are using Raspberry Pi as SEs which is a tiny and affordable computer featuring a Broadcom system-on-chip (SOC), which includes an ARM-compatible CPU.

For CEs, we have decided to go with the ESP8266, which is a low-cost Wi-Fi chip with full TCP/IP stack and microcontroller capability to control the low level modules that Interact with the physical world through input and output devices.

Additionally, a dedicated open-source Arduino software IDE makes it easy to write code and upload it to the CEs. It runs on Windows, Mac OS X, and Linux. The environment is written in Java and based on Processing and other open source software.

Hardware and user interfacing

The proposed system hardware comprises of a Pi 2 & ESP8266 with Wi-Fi capability, relays connected to the digital outputs for switching, and a Wi-Fi capable phone. The hardware is easy to use and implement, and is also readily available.

Here we are proposing a system whereby a Raspberry Pi 2, a purpose built master node, and purpose-built slave nodes are used to integrate with appliances within the home. The Pi 2 serves as the database, interface, and web server. It controls the slave nodes. Each slave node is connected to one or more appliances of similar type and will carry out the control of those appliances based on commands from the master node. Communication between the master and slaves is wireless using radio frequency.

Home automation infrastructures are generally quite complex due to the variety of devices, sensors and actuators involved in the network. One of the challenges of designing an interface between the user and the system is doing it in such a way that it is made easy for the user to associate the physical devices within their household to the applicable elements within the user interface.

The rise of smartphones over the decades has set a new mobile precedent for how we think about interacting with the Internet, but specifically-designed IoT user interface designs give users the best experience.

Conclusion

The resulting system is flexible and has the potential to integrate all household devices. This design is also capable of seamless integration into any home environment due to its open source software and modular design. However, there are still many areas of this solution that need to be evaluated, such as security, more connectivity options to made this solution more scalable, power management for the CE module, stability, and an adaptive user interface.

Sanjeev Sharma is an Engineering Manager at Mentor Graphics, a Siemens Business, in the Embedded Software ABU Division. He is a PMP-certified professional with over 12 years of experience in software industry, largely dedicated to embedded software.