Homote — Your Home Automation Remote

Create your own Cost-efficient Home Automation System with a NodeMCU, Relay Module and Battery

Shashank Singh
Geek Culture
10 min readMay 26, 2021

--

The Indian Home automation industry is expected to be over USD 13,574.1 million by 2026 from USD 1,790.9 million in 2018. India remains an underserved market for home automation products largely due to high cost of products and limited brands and service options.

Home Automation, till a few years back, remained limited to the affluent segment of the society. But now, the acceptance of technology and the desire to relax in the middle class has made it an industry with large scope, albeit the high prices and the complexity of the home automation systems hinder the average person from going for it.

But, with the advent of wireless technology and the products that are being provided with it, this article tries to provide an affordable solution to the problem of exponentially increasing costs.

I have used NodeMCU, a board made by the open source community which can be used as a much economical alternative to an Arduino with an ESP8266. I have also used an android application for controlling the appliances connected for home automation as the NodeMCU connects to the home router and hence the internet.

So, this article expects to provide the technology-ready class with an affordable solution for the obstacle that is home automation and it’s sky high prices.

What is Home Automation?

A home automation system is a technological answer that permits automating the majority of electronic, electrical and technology-based tasks inside a home. It uses a mixture of hardware and computer code technologies that permits control and management over appliances and devices inside a home.

This is a growing industry and as the world is growing, people are inclining towards more and more relaxed lives. This calls for the inclusion of technology in this sector, and the automation system tends to follow that path. Global Home Automation Market was valued at $39,607 million in 2016, and is projected to reach at $81,645 million by 2023, growing at a CAGR of 11.2% from 2017 to 2023.

What is the purpose of the article?

The motivation of this home automation system is to automate the simple yet important activities such as turning the lights on with the help of the user’s Android phone in his room. This system hopes to provide a cost-efficient solution to the problem of skyrocketing prices for the different home automation systems.

Photo by Sebastian Scholz (Nuki) on Unsplash

The system uses Arduino for providing the hardware interface to our Android based application. The remote is able to switch the modes of light from different places once the NodeMCU is connected to the internet. The purpose is to make lives of people easy and convenient in a very cost-effective manner.

The Home-Automation systems in today’s world are either too difficult to use for a user who is not familiar to the technology or too expensive to be used by the average citizens. Hence, with this home-automation system, I hope to provide a cost-effective solution to this conundrum.

Components Required

NodeMCU

NodeMCU is an open source IoT platform, whose firmware runs on Espressif’s SoC Wi-Fi ESP8266, based on the ESP8266 nonOS SDK. Its hardware is based on the ESP-12 module. The scripting language is Luawhich allows to use many open source projects like lua-cjson and spiffs.

An ESP8266 is a microcontroller with:

  • Low-power, highly-integrated Wi-Fi solution
  • A minimum of 7 external components
  • Wide temperature range: -40°C to +125°C
  • ESP8285–8 Mbit flash embedded
ESP8266 — Block Diagram | Image by Ligo George on his article on electrosome

Relay Module

Relays are most commonly used switching device in electronics. Before we proceed with the circuit to drive the relay we have to consider two important parameter of the relay.

  • One is the Trigger Voltage — this is the voltage required to turn on the relay, i.e., to change the contact from Common -> NC to Common -> NO. Our relay here has 5V trigger voltage.
  • The other parameter is your Load Voltage & Current, this is the amount of voltage or current that the NC, NO or Common terminal of the relay could withstand, in our case for DC it is maximum of 30V and 10A.
5V Relay Switch — Block Diagram | Image from Components101 Article

The above circuit shows a bare-minimum concept for a relay to operate. Since the relay has 5V trigger voltage, we have used a +5V DC supply to one end of the coil and the other end to ground through a switch. This switch can be anything from a small transistor to a microcontroller or a microprocessor (microcontroller in our case) which can perform switching operating.

You can also notice a diode connected across the coil of the relay, this diode is called the Fly back Diode. The purpose of the diode is to protect the switch from high voltage spike that can be produced by the relay coil. As shown, one end of the load can be connected to the Common pin and the other end is either connected to NO or NC. If connected to NO, the load remains disconnected before trigger and if connected to NC, the load remains connected before trigger.

  • It is commonly used in switching circuits.
  • Also used for Home Automation projects to switch AC loads
  • Used to Control (On/Off) Heavy loads at a pre-determined time/condition
  • Used in safety circuits to disconnect the load from supply in event of failure
  • Used in Automobiles electronics for controlling indicators glass motors etc.

Product Specifications & Features

One of the first steps in developing a product is to understand what are the things that are asked from the product. These features of the products is what determine their success in the markets along with the execution of how well these goals were achieved. The product features from this system are stated as following —

  • With the help of this mobile application for the home remote, and a very cost efficient solution to the problem of home automation, users will have the option of performing simple yet important activities with just a tap on their mobile phone rather than actually having to do the work by themselves.
  • The system will be able to provide the user with the option to perform certain actions one after another without any exaggerated delays.
  • In the Arduino IDE application, we upload the code to the NodeMCU which gets the wifi SSID and password which already makes way for only the users with access to the wifi router in their home to be authorised.

There are also some limitations which can be considered while developing a product and given below are the limitations —

  • As such, there is no authorisation page in the android application but it provides with a section to fill with IP address which can only be known to the user and hence only the authorised user is able to use it.
  • A constantly strong internet connection is a must for the system to perform its functions in a normal way.
  • Another constraint for the system is that the actions can be only performed after the completion of another action,i.e. User can’t perform two actions simultaneously as a certain pin number and other information is sent to the NodeMCU from the application and hence they have to perform one after another.
  • Electricity is required constantly for all the devices to be controlled via Arduino.
Use Case of Homote | Image by Author

Procedure

After understanding the basic requirements and features that the designed system was supposed to do, I started working on a few diagrams. This is one of the important steps in professional ways to develop a product. These diagrams help the user as well as the creator gain a better understanding of the system and makes it easier for the creator to ensure that they’re progressing in the right path. Since I’m still someone who’s learning, the diagrams might not be up to the general industry standards.

Sequence Diagram

A sequence diagram simply depicts interaction between objects in a sequential order i.e. the order in which these interactions take place. We can also use the terms event diagrams or event scenarios to refer to a sequence diagram. Sequence diagrams describe how and in what order the objects in a system function.

Sequence Diagram | Image by Author

The above diagram depicts the interaction between the user and the appliance via the arduino (NodeMCU). It simply shows that a new instance is created to start and when the user clicks a button, then the Arduino sends a signal to the appliance, which in turn reacts to the signal. After this sequence, the arduino will be sending a command successful message to the user.

State-Transition Diagram

State-transition diagrams describe all of the states that an object can have, the events under which an object changes state (transitions), the conditions that must be fulfilled before the transition will occur (guards), and the activities undertaken during the life of an object (actions).

State-Transition Diagram | Image by Author

Since it’s quite a simple idea where one requests will be sent and will be executed or be having issues. This state transition diagram depicts them both.

Data Flow Diagram

A data flow diagram (DFD) maps out the flow of information for any process or system. It uses defined symbols like rectangles, circles and arrows, plus short text labels, to show data inputs, outputs, storage points and the routes between each destination.

Data Flow Diagram | Image by Author

The above data flow diagram simply depicts how a user gives input to the system and it’s further working. So, when the user gives the input, the system would be either able to find or understand the given command. If the system doesn’t understand it, it shall check the Wifi connection and if it gets the wifi connection, then it gives some input to the appliances and if it doesn’t find the connection, then it tries to enable the same.

After the NodeMCU receives the input, the command is then transferred to the relay module, whose input block in turn then transfers current in the appliance for which the command was meant. Lastly, it checks if the appliance is working, if it’s working then it’s the end of the process, otherwise the process shall be reinitiated.

Circuit Diagram

A circuit diagram is a graphical representation of an electrical circuit. A pictorial circuit diagram uses simple images of components, while a schematic diagram shows the components and interconnections of the circuit using standardised symbolic representations.

So, here comes the most important part for developing Homote, it’s to create the necessary circuit. You’d have to just copy the same circuit and you’d have a working home automation system in your hands.

Circuit Diagram | Image by Author

The above circuit diagram depicts the components used and how they’re connected, some further information to help you in the same (because it took me a quite a bit of time to understand it myself):

  • The NodeMCU is connected to the relay via its digital pins (say, D1,D2,D3,D4) and to the power supply through the micro USB to a computer (this can be changed as per your needs later on).
  • The relay has its input pins connected to NodeMCU, GND pin & VCC to GND and 3.3V of NodeMCU respectively, the battery’s positive terminal to the common terminal, negative terminal to LED(s)’ negative terminal(s) and the LED(s)’ positive terminal to the normally open terminal.

User Interface

While I could have created my own android application for the same, I thought it would be a better to use an application which is supported on other platforms too. I used the application called Blynk, I recommend using the same, it’s easy to connect the same to NodeMCU too and doesn’t require a long piece of code.

NodeMCU Code

As shown in the above code, it’s a fairly simple process to code your homote. You receive a unique authorisation token in the Blynk application for your account and you shall replace the same in the above code.

The SSID (name) and Password of your Home Wifi (to which the NodeMCU has to stay connected at all times for it to work) shall be replacing the given SSID and Password too.

The above code can be programmed into the NodeMCU with the Arduino IDE and is a fairly simple process(you can refer to articles on the internet without facing any problems).

Blynk Application Interface | Image by Author

As shown above, it’s a fairly simple user interface in the Blynk application. You just have to drag the switches in the application and then configure as per your connection on the relay module to get to the above image in your own application.

After completing this whole process, Voila! You have a working home automation system for yourself without having to pay exorbitant prices demanded by the industry.

Finally, If you faced any difficulties, feel free to contact me or you can take a look at my github gist here (it may be a bit updated, but there are enough comments to help you through it) for any doubts.

--

--

Shashank Singh
Geek Culture

An undergrad student with an overdose of euphoria.