What really would compel someone to actually develop a complete IoT-based home automation system? Could it be the need to improve the safety of your home, or could it be the desire to live a Jetson-like life that millennials always dreamt of?
It is difficult to say. Often, it is even more difficult to visualize the technology that is required to build a home automation platform.
Due to the complexity introduced by software, hardware, and networking ecosystems, it becomes extremely important to learn, understand, and utilize the right home automation technology for your smart home product.
We hope to address some of the concerns with this article.
What will you learn here?
- Home Automation: How to get started from zero
- Home automation sensors and protocols
- Home automation architectures, gateways, and platforms
IoT Home Automation: Getting Started
Home automation has three major parts:
- Communication protocols
Each of these parts is equally important in building a truly smart home experience for your customers. Having the right hardware enables the ability to develop your IoT prototype iteratively and respond to technology pivots with ease.
A protocol selected with the right testing and careful consideration helps you avoid performance bottlenecks that otherwise would restrict the technology and device integration capabilities with sensors and IoT gateways.
Another important consideration is the firmware that resides in your hardware managing your data, managing data transfer, firmware OTA updates, and performing other critical operations to make things talk.
Applications of Home Automation
Rebuilding consumer expectations, home automation has been projected to target wide array applications for the new digital consumer. Some of the areas where consumers can expect to see home automation led IoT-enabled connectivity are:
- Lighting control
- Lawn/Gardening management
- Smart Home Appliances
- Improved Home safety and security
- Home air quality and water quality monitoring
- Natural Language-based voice assistants
- Better Infotainment delivery
- AI-driven digital experiences
- Smart Switches
- Smart Locks
- Smart Energy Meters
The list is still not exhaustive and will evolve over the time to accommodate new IoT use cases.
Now that you are familiar with home automation applications, let’s have a detailed look at what components are involved in building a typical home automation prototype.
Home Automation Components
We have talked about them before, but let’s clearly separate our components that will finally help you build a realistic model of what major components are involved in building a smart home. The major components can be broken into:
- IoT sensors
- IoT gateways
- IoT protocols
- IoT firmware
- IoT cloud and databases
- IoT middleware (if required)
IoT sensors involved in home automation are in thousands, and there are hundreds of home automation gateways as well. Most of the firmware is either written in C, Python, Node.js, or any other programming language.
The biggest players in IoT cloud can be divided into a platform-as-a-service (PaaS) and infrastructure-as-a-service (IaaS).
Major IoT PaaS Providers
- AWS IoT
- Azure IoT
- IBM Bluemix
Characteristics of IoT Platforms
Again, these platforms are extremely divided over the IoT application and security-related features that they provide. A few of these platforms are open source.
Let’s have a look at what you should expect from a typical IoT platform:
- Device security and authentication
- Message brokers and message queuing
- Device administration
- Support towards protocols like CoAP, MQTT, and HTTP
- Data collection, visualization, and simple analysis capabilities
- Integrability with other web services
- Horizontal and vertical scalability
- WebSocket APIs for real-time for real-time information flow
Apart from what we mentioned above, more and more platform builders are open sourcing their libraries to developers. Take for example the Dallas temperature library for DS18B20 for Arduino was quickly ported because of open source development to a new version that helped developers to integrate DS18B20 with Linkit One. Understanding these things become crucial as IoT tends to evolve continuously and having an equally responsive platform makes it business safe to proceed.
Let’s now deeply evaluate each of these components, starting with IoT sensors.
Home Automation Sensors
There are probably thousands of such sensors out there that can be a part of this list, but since this is an introduction towards smart home technology, we will keep it brief. We will break down IoT sensors for home automation by their sensing capabilities:
- Temperature sensors
- Lux sensors
- Water level sensors
- Air composition sensors
- Video cameras for surveillance
- Voice/Sound sensors
- Pressure sensors
- Humidity sensors
- Infrared sensors
- Vibrations sensors
- Ultrasonic sensors
Depending upon what you need, you may use one or many of these to build a truly smart home IoT product. Let’s have a look at some of the most commonly used home automation sensors.
The market is full of them, but the famous temperature sensors are DHT11/22, DS18B20, LM35, and MSP430 series from TI. The MSP430 series is more accurate than the rest, but at the same time, it is one of the most expensive for prototyping or initial product testing purposes. MSP430 tops all temperature sensors, as the precision and battery consumption is minimal with them.
The DHT11 has a very restricted temperature range and suffers from accuracy issues. DHT22, on the other hand, is a little bit more accurate but still, doesn’t make it as the preference.
The DS18B20, on the other hand, is more accurate, as opposed to digital temperature sensors like the DHT22 and 11. Dallas temperature sensors are analog and can be extremely accurate down to 0.5 degrees.
Take note that often, the temperatures that you directly sense from these sensors may not be very accurate, and you would occasionally see 1000 F or greater values no matter what you are doing.
There’s an entire logic that goes around building temperature sensors that we will address in another blog post.
Lux sensors measure the luminosity and can be used to trigger various functions range from cross-validating movements to turn the lights on if it becomes too dark. Some of the most popular light sensors are TSL2591 and BH1750.
Recent tests to include TSL2591 and BH1750 into low-powered IoT devices have found them to be working fairly well for most use cases.
Here’s a study done by Robert and Tomas that shows how these two compare against a spectrometer and a photodiode.
To get a good idea of whether these two sensors would meet your needs, we would suggest illuminance tests followed by normalizations of the data to observe deviations under various situations.
Water Level Sensors
While building your prototype, you may consider a solid state eTape liquid level sensor or, like others, just use an HC-SR04 ultrasonic sensor to measure the water level.
On the other hand, in other cases where those two don’t suffice, one has to utilize something that can deliver a much higher performance.
Float level sensors and other ICs like LM1830 offer a more precise measurement capability to IoT developers — although, they are substantially much more expensive than others.
Air Composition Sensors
There are a couple of specific sensors that are used by developers to measure specific components in the air:
- CO monitoring by MiCS-5525
- MQ-8 to measure Hydrogen gas levels
- MiCS-2714 to measure nitrogen oxide
- MQ135 to sense hazardous gas levels (NH3, NOx, Alcohol, Benzene, smoke, CO2
Most of these are sensors have a heating time, which also means that they require a certain time before they actually start delivering accurate values.
These sensors mainly rely on their surface to detect gas components. When they initially start sensing, there’s always something that’s there on their surface, some sort of deposition that requires some heating to go away.
Hence, after the surface gets heated enough, true values start to show up.
Video Cameras for Surveillance and Analytics
A range of webcams and cameras specific to hardware development kits are usually used in such scenarios. Hardware with USB ports offer to integrate camera modules to build functionality.
But utilizing USB ports is not very efficient, especially in the case of real-time video transfer or any kind of video processing.
Take the Raspberry Pi for example. It comes with a camera module (Pi cam) that connects using a flex connector directly to the board without using the USB port. This makes the Pi cam extremely efficient.
Sound detection plays a vital role in everything from monitoring babies to automatically turning lights on and off to automatically detecting your dog’s sound at the door and opening it up for your pet.
Some commonly used sensors for sound detection include the SEN-12462 and EasyVR Shield for rapid prototyping.
These sensors aren’t as good as industrial-grade sensors like those from 3DSignals, which can detect even ultra-low levels of noise and fine tune between various noise levels to build even machine break-up patterns.
These sensors bring the capability of sensing humidity/RH levels in the air to smart homes. The accuracy and sensing precision depends a lot on multiple factors, including the overall sensor design and placement.
But certain sensors like the DHT22 and 11, built for rapid prototyping, will always perform poorly when compared to high-quality sensors like HIH6100 and Dig RH.
While building a product to sense humidity levels, ensure that there’s no localized layer of humidity that is obscuring the actual results. Also, keep in mind that in certain small spaces, the humidity might be too high at one end as compared to the others.
When you look at free and open spaces where the air components can move much freely, the distribution around the sensor can be expected to be uniform and, subsequently, will require fewer corrective actions for the right calibration.
Home Automation Protocols
One of the most important parts of building a home automation product is to think about protocols — protocols that your device will use to communicate to gateways, servers, and sensors. A few years ago, the only way to do so was by either using Bluetooth, Wi-Fi, or GSM. But due to added expenses on cellular SIM cards and low performance of Wi-Fi, most such solutions didn’t work.
Bluetooth survived and later evolved as Bluetooth Smart or Bluetooth Low Energy. This helped bring a lot of connectivity in the “mobile server powered economy.” Essentially, your phone would act as a middleware to fetch data from BLE-powered sensors and send it over to the internet.
When looking at the major home automation protocols, the following top the list:
- Bluetooth Low Energy or Bluetooth Smart: Wireless protocol with mesh capabilities, security, data encryption algorithms, and much more. Ideal for IoT-based products for smart homes.
- Zigbee: Low cost, mesh networked, and low power radio frequency-based protocol for IoT. Different Zigbee versions don’t talk to each other.
- X10: A legacy protocol that utilizes powerline wiring for signaling and control.
- Insteon: Communicates with devices both wirelessly and with wires.
- Z-wave: Specializes in home automation with an emphasis on security.
- Wi-Fi: Needs no explanation.
- UPB: Uses existing power lines installed in a home. Reduces costs.
- Thread: A royalty-free protocol for smart home automation, uses a 6lowpan.
- ANT: An ultra low-power protocol helping developers build low-powered sensors with a mesh distribution capabilities.
Home Automation: Which Protocol Is the Best?
While there are some protocols that clearly offer much more, it is always important to start from your smart home development needs and then move towards narrowing down the solutions.
The commonly preferred protocols are Bluetooth Low Energy, Z-wave, Zigbee, and Thread. The protocol selection can now be narrowed down by the following factors:
- Ability to perform identity verification
- Quality of sensor networks
- Data transfer rate
- Security level
- Network topology required
- Density of objects around
- Effective Distance to be covered
Home Automation Architecture
This architecture supports the following considerations for home automation solutions:
- End to end security mechanisms involving multilevel authentication
- End to end data encryption, including the link layer
- Flexible and configurable access and authorization control
- Powerful cloud infrastructure
- Network agnostic with built-in feedback loops
- Configurable cloud-based rules engine
- API endpoints
- Data scalability
- NoSQL databases
Home Automation Gateways
For developing a home automation product, often a standalone product sending data to a server is not enough. Due to battery and protocol limitations, the data from a sensor or sensors present in a home has been routed through an IoT gateway.
To select the perfect gateway for your IoT home automation, consider some of these factors:
- Communication protocols supported
- Real-time capabilities
- MQTT, CoAP, and HTTPS support
- Security and configuration
When it comes to building IoT gateways, modularity and hybrid IoT protocol support top the list when a product is in the early stages of market introduction.
To incorporate a gateway in your home automation stack, you can consider the following options:
Either create a gateway from the ground up using existing hardware stacks for prototyping (using Raspberry Pi, Intel Edison, etc). Then, when a PoC is validated, you can create your own custom hardware.
Or, you can use existing gateway modules like Ingincs BLE gateway. These gateways are extremely easy to customize and connect with your cloud services and devices. However, they may or may not offer the same level of support that you need to build certain features.
For example, a gateway with a bad networking queue may result in traffic congestion, or it may not support the required protocols that you wish to use.
Further, pivoting with these gateways to some other technology stack may become very difficult. It should be emphasized that they are extremely good for robust prototyping needs.
Home Automation Programming Languages
Home Automation Frameworks
If you think you can build everything for home automation (protocols, hardware, software, etc.) on your own, that is a bit unrealistic. Everyone, from high-growth startups to billion-dollar consumer-focused enterprises, is now using the help of home automation frameworks to build connected products to delight consumers.
There are more than 15 different smart home frameworks available for IoT developers to use and build their next generation of connected home products. Some of these frameworks are open source and some are closed-source. Let’s have a look at some of them in the sections that follow.
Open Source IoT Platforms and Frameworks
Looking forward to doing a quick and dirty prototype? There’s no need to write down everything from scratch. Thanks to a bunch of awesome contributions, we have open source platforms that can get your home automation products up and running in no time.
Our favorites are:
- Home Assistant
- OpenHAB: Supports Raspberry Pi, written in Java and has design tools to build your own mobile apps by tweaking UI.
- OpenMotics[Asked their developer, waiting for them to respond(dev confirmed)]
Let’s take a look at the major home automation IoT platforms.
Supports Raspberry Pi, uses Python, and the OS is Hassbian. It has simplified automation rules that developers can use to build their home automation product, saving them thousands of lines of code.
Home Assistant supports the following:
How Home Assistant works:
- Home control: Responsible for collecting information and storing devices.
- Home automation triggers commands based on user configurations.
- Smart home triggers based on past user behavior.
As developers, it is very important for us to understand the architecture of Home Assistant for us to build high-performing products on top of it.
Let’s have a look at the architecture that makes control and information flow possible.
Home control consists of five components:
- State machine
- Event bus
- Service registry
The core architecture of Home Assistant:
All of these components working together create a seamless asynchronous system for smart home IoT. In the earlier version of Home Assistant core, the core often had to stop while looking for new device information.
But with the new versions of Home Assistant, a backward compatible API, and an async core have been introduced, making things a lot faster for IoT applications.
The best part about home assistant’s core architecture is how carefully it has been designed and developed to support IoT at home.
OpenHAB is a home automation and IoT gateway framework for smart homes. Similar to Home Assistant, OpenHAB works nicely with Raspberry Pi and comes with their own design tools to create a UI for your home automation product.
An understanding architecture of OpenHAB:
- Modularity: It is realized with the bundle concept
- Runtime dynamics: So that software components can be managed at runtime
- Service orientation: There are services for various components to speak with each other and exchange information
Further relying on the OGSi framework, it leverages the following layers stacked together:
- Modular layer: Manages dependencies between bundles
- Life cycle layer: Controls the life cycle of the bundles
- Service layers: Defines a dynamic model of communication between various modules
- Actual services: This is the application layer, using all other layers
- Security layer: Optional, leverages Java 2 security architecture and manages permissions from different modules
- Plugin framework
- Rules engine
- Logging mechanism
- UI abstraction: A tree structure for UI Widgets, Item UI providers, and dynamic UI configuration
- UI implementations are available for the web, Android, and iOS
- Designer tools availability
OpenHAB has been primarily only been observed as a project for the hobbyist programmer, and even many parts of openhab.org convey the same. But we have observed a different effort in recent times from OpenHAB in building the developer economy for building IoT smart homes.
Take this slowly growing GitHub repo talking about OpenHAB cloud, for example.
According to the repository, OpenHAB cloud architecture will look something like this:
Impressive enough that some open platform out there is thinking about system services, Cron jobs, logging, etc.
Further, let’s look at the frameworks and technologies that openHAB will support: Node.js, Express.js, Nginx, MongoDB, Redis, Socket.IO.
Unlike Home Assistant’s vast integrability, openHAB is currently limited to:
- Amazon Alexa
- AWS EC2 [AWS Multi-AZ isn’t compatible for multiple time zone availability]
- AWS IoT with openHAB
- MQTT support
OpenHAB is extremely powerful, but at the same time very limited in terms of integration. The team behind openHAB is extremely promising and have already conveyed their plans to open up openHAB to other integration capabilities very shortly.
Calaos was developed initially by a company that closed back in 2013, but home automation since then has grown, and it is being maintained and upgraded by developers. While now being open source, it facilitates premade source code to:
- Create sweet home environments
- Control music
- Automation rules that focus on time, mood, or ambiance
- Easy configuration
Calaos supports the following hardware:
- Raspberry Pi
- Intel-based machines
Their lack of support towards developing private IoT applications restricts their usage by developers to build high-quality solutions for consumers.
Domoticz allows you to monitor and configure your devices and sensors with the simplest possible design. Impressive enough that the entire project is extremely lightweight, it further is backed by high integrability with third parties and features like auto-learning switches.
This platform has been designed to work with operating systems like Linux and Windows.
Protocol capabilities of Domoticz include: Z-wave, Bluetooth, Apple Homekit, X10, and MQTT
Hardware integration capabilities of Domoticz:
- RFXCOM transceiver
- ESP2866 Wi-Fi module
- P1 smart meter
- Youless meter
- Pulse counters
- Philips Hue
- Essent E thermostat
Domiticz can be used to create any sort of services that you can think of, ranging from a smart weather device to a Telegram bot.
Currently, very few people know about the architecture of Domoticz, making it extremely difficult to build applications on it without taking unnecessary risks in building the product itself.
For example, the entire design of general architecture feels a little weird when you look at the concept of a sensor to control to an actuator. It seems to be missing.
Building advanced applications with Domoticz can be done using C++, lula, PHP, shell, etc.
Blockchain in IoT
Consumers, especially those who grew up in the digital era, understand the importance of privacy. With the evolution of IoT, security has taken center stage for realistic deployment scenarios.
Deployment of blockchain into home networks can easily be done with a $35 Raspberry Pi. A blockchain secured layer between devices and gateways can be implemented without a massive revamp of the existing code base.
Simply put, blockchain is a technology that would be an implementation that most users won’t even know about, but it will play a huge role in the future to reassure them with revolutionary and new business models like dynamic renting for Airbnb.
So far, interoperability issues and broken protocols seemed to have hampered the growth of IoT-based smart homes.
But as technology is progressing and more and more computing power can be generated with very low-powered devices, home automation will gradually become a technology that will easy for us to build and develop for on a daily basis.
Home automation is a big space to address in one blog post. If there’s something else that you would like, feel free to drop a comment or reach out to me on Twitter – I am @hsshah_.