Home Automation does what it says - It enables various smart devices around the home to work together in an automated way based on instructions/configurations.
Home automation can be achieved using IoT/Smart devices. IoT is a network of devices, devices that are embedded with sensors, software, and other technologies with the sole purpose of connecting and exchanging data with other devices over the internet. IoT enables devices to interact, collaborate, and learn from each other's experiences just like humans do. Some of the examples of IoT devices are below.
Below are a few day-to-day activities which I automated
In this blog post, I will explain all software, tools, devices, services that were used by me for achieving the top two automation flows.
Home Automation has three components.
1) Sensors like (Water flow sensor, Pressure sensor, Temperature sensor, Door sensor, PIR sensor, Water level sensor).
I used a Water flow sensor, Door sensor, and PIR sensor.
2) ESP8266 boards like (Arduino UNO, Wemos D1 R2, RaspberryPi Zero). We can connect the mentioned sensors to these boards and send the key data to the hub.
I used Wemos D1 R2 which contains a Wi-Fi chip. Flashed this device with Tasmota and connected it to the local hub.
3) Sonoff devices. Sonoff is a brand of low-cost (5$) Wi-Fi switches that can be used for controlling main-powerline connected appliances like lights, pumps, heaters, etc. They consist of the ESP8266 Wi-Fi Chip plus additional circuitry. and are made by ITEAD Studio, which also makes a collection of home automation products.
We can operate these devices using the mobile app. The user sends a signal to a smart device to turn on or off a light, which in turn sends that signal directly to the cloud. Cloud servers understand, process the data, and take necessary action for the targeted home appliance. For Example, consider the Philips Hue bulb. When we turn on the bulb from the mobile app. It sends the request to the Philips cloud server and the cloud server sends the request to the edge device (bulb) to turn on.
Alternatively, we can flash these devices with open-source firmware like Tasmota and configure the devices for connecting to our local gateway or hub. Home Assistant is one such software that provides a platform/Gateway/Hub functionality. which can act as a cloud server.
I am using 10 Sonoff devices. Few of those are running with default firmware connected to manufacturer cloud and few devices are flashed with Tasmota firmware connected to the local hub.
4) TpLink smart plug.
5) Sonoff 433RF Bridge- 433Mhz RF receiver module is low power consumption, high sensitivity radio receiver module. It uses internal software decoding and data decoding circuits. Few examples are - Door sensor, PIR sensor transmits an RF message. The bridge captures the RF message and sends it to the cloud server for further processing.
For my use-case, I have flashed the firmware of the device with OpenMQTTGateway (OMG) and configured it to send data to the local hub for further processing of the data.
1) Embedded C programs – Wrote an embedded C program and installed it onto Wemos D1 R2 board. The code measures the water flow rate and publishes the flow rate as an MQTT message on a specific topic to the MQTT broker which is running on Hub.
I replaced this implementation with Tasmota firmware
2) OpenMQTTGateway (OMG) - OMG supports basic 433mhz/315mhz protocols & infrared (IR) with which we can turn old dumb devices - "smart". and has the lower cost advantage when compared with Zwave or any other sophisticated protocols. OMG is evolving and its recent addition is Bluetooth Low Energy (BLE) and LORA.
In my use case, it enables to:
3) Node-Red – Node-Red is a programming tool for wiring together hardware devices, APIs, and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single click. The core of Node-RED is Node.js.
I created a couple of data-flows using this software
4) IFTTT- IFTTT derives its name from the programming conditional statement “if this, then that.” It provides a software platform that connects apps, devices, and services from different developers in order to trigger one or more automation involving those apps, devices, and services. There are numerous ways you can connect all your services and the resulting combinations are called “Applets”. Applets connect two or more services together and help you do something that you couldn’t do with just one service alone.
Here are just two “if this then that” automation you can run with IFTTT:
I implemented few applets in IFTTT, one of them sends a mobile notification with the message “Water supply started” and another applet to turn on "Water motor".
5) Tasmota - Tasmota is custom firmware that is available for ESP8266 based devices allowing for web, timer, OTA firmware updates, and sensor support. Tasmota allows ESP8266 based devices to be controlled via HTTP, MQTT, and KNX allowing for any home automation integration.
6) Home Assistant – Home Assistant is an open-source home automation system. It supports RaspberryPi, uses Python with Hassbian OS. It has simplified automation rules that developers can use to build their home automation product saving them thousands of lines of code. Home Assistant acts as a central smart home controller hub that features all common conditional statements, creator functions to control any modern home automation platform. It also includes gateway and bridge (Protocol converters) for devices and services using different IoT technologies.
If you want complete control of your devices then the use of a home assistant is recommended and it also has great community support and robust integrations solutions for multiple smart devices. Some of the integrations are mentioned below.
Alternatives of Home Assistant are OpenHAB (written in java), Calaos, FHEM, Domoticz, EEDOM, etc.,
With references from the Home assistant community portal. I could run Home Assistant on a RaspberryPI and configured a few integrations like MQTT broker, NodeRed, IFTTT, PushOver (for sending push notifications to mobile), Tasmo-Admin, motionEye.
Once the water supply starts my automation-goal is to perform the below actions.
Flow Sensor and Wemos
Flow1
In the node-red flow 2. Every day at 6 am below actions are performed-
Flow 2
Automation1 Images
Installed wemos device in an IP65 rating case.
Flow sensor connected to the wemos device.
Configured flow sensor in wemos device. Module. Tasmota considers it as a sonoff basic device. There are similar screens for configuring Wi-Fi and MQTT broker details on the device.
Sonoff Device
In this automation, all devices communicate with the local hub and external pushover server. The door sensor is fixed to the main entrance door and the PIR sensor is fixed near the stairs.
Goals that I want to achieve with this automation.
The Home Assistant sun integration will use my current location to track if the sun is above or below the horizon. Based on this data it will turn on lights at sunset and turn off those lights at 09:30 PM every day.
Sensors
The Door sensor and PIR sensors transmit RF signals. Door sensors transmit when the door is opened and the PIR sensor transmits an RF signal when it detects any object within its range. Both these sensors work under the 433Mhz band.
Sonoff RF bridge
When these sensors transmit RF signals it gets captured by the Sonoff RF bridge. The purpose of the bridge is to consume RF signals and convert them to a unique code that gets published using MQTT protocol to MQTT broker over a topic.
Home Assistant on Raspberry Pi
IFTTT Connection
Sonoff dual-channel device
Both the lights are connected to a Sonoff dual-channel device running Tasmota firmware and this device is also configured as a switch in the hub.
Below are sample automation scripts are written for Automation 2.
Sample configuration written in Home Assistant. There are similar configurations for other integrations like IFTTT, Pushover, TasmoAdmin, Tuya, Motion-Eye, and Custom Sensors.
TasmoAdmin showing all Tasmota running devices.
Home page of a home assistant after user login.
Additional Implementations
In this blog, we have seen a couple of IoT automation flows that are actively used, observe how a device communicates with other devices and how it reacts without user intervention.
These smart solutions can be easily implemented for any household. I will be happy to share my knowledge and experience. and do share your thoughts/opinions/suggestions. I am available in messenger.
Needless to say, I learned many concepts by doing this project, some of them are mentioned below:
The other plus side of this implementation is power and cost savings and it helped my parents to manage daily chores with less/no strain. I installed these applications in their mobiles and taught them how to manage the IoT devices.
Also published on: https://medium.com/@rakesh362/home-automation-using-the-internet-of-things-iot-59f11e16c283