Wifi & Voice Controlled Home Automation Using NodeMCU & Android

Voice Controlled Home Automation Using NodeMCU (Last Updated On: January 8, 2019)

Wifi & Voice Controlled Home Automation Using NodeMCU & Android:

This post is all about Wifi & Voice Controlled Home Automation Using NodeMCU & Android. You can learn about previous similar project, i.e. Voice Based Home Automation with NodeMCU & Alexa. We used Alexa to control home appliances. Now here we will do the same, but instead of using Alexa, we will develop our own App on an Android smartphone to control locally (using buttons or voice), our home devices.




In this project we will be interfacing 4 channel relay with NodeMCU ESP8266 12E Wifi Module and control 4 different LEDs. These 4 different LEDs are similar to 4 different Home Appliances. We will use an Android app having 5+5 ON+OFF Buttons to send signal to NodeMCU in order to control relay output. Every NodeMCU has particular IP Address. We will assign this IP Address to Android App for access control. Similarly NodeMCU is needed to be connected to local Wifi.


Components Required:

1. NodeMCU ESP8266 12E Wifi Module
2. 4 Channel Relay
3. 4 Different Color LEDs
4. 4 Resistor of 220 ohm
5. 5 Volt Power Supply
6. Breadboard
7. Connecting Wires

Block Diagram:

Here is a block diagram for this project “Wifi & Voice Controlled Home Automation Using NodeMCU & Android”. It is simple and easy to understand.

Voice Controlled Home Automation Using NodeMCU

NodeMCU is interfaced with 4 channel Relay using GPIO Pins of NodeMCU. The output pin of the NodeMCU is connected to 4 different LED via 220 ohm resistor. The NodeMCU is connected to Local Wifi and is capable of receiving signal via Internet.

The Android Device has “Home Automation Control” Android app installed on it. To control the NodeMCU input/output, the ip address of NodeMCU is entered on Android App IP box.

Once this setup is done, you can control the Android App staying at any part of the world. Your Android Phone acts as a remote and NodeMCU as a receiver and signal is transferred via Internet.




Circuit Diagram & Connections:

Voice Controlled Home Automation Using NodeMCU

We will use a 4 Channel relay module to control 4 LEDs, simulating 4 home devices.

Connect Relay Input Pin with NodeMCU as follows

NodeMCU GPIO Pin 1 - Relay Input Pin 1
NodeMCU GPIO Pin 3 - Relay Input Pin 2
NodeMCU GPIO Pin 12 - Relay Input Pin 3
NodeMCU GPIO Pin 14 - Relay Input Pin 4

Similarly Connect the 4 output to 4 different LED via 4 resistors as shown in the figure above.

Voice Controlled Home Automation Using NodeMCU


The Android App for Wifi & Voice Controlling:

The Android App will send a string that must be interpreted by the code to activate each one of the relays defined as follows:

Relay1:
Turn-On: “r1on”;
Turn-Off: “r1off”;

Relay2:
Turn-On: “r2on”;
Turn-Off: “r2off”

Relay3:
Turn-On: “r3on”;
Turn-Off: “r3off”

Relay4:
Turn-On: “r4on”;
Turn-Off: “r4off”

If the Android App send as a command: “r1on”, Relay1 must be turn on. We have also defined “group commands” to turn-on (“allon”) and turn-off (“alloff”) simultaneity all devices. Similarly voice input image is also given which when clicked gives pop up for Google Assistant to Accept Voice Command.


Creating The Android App Using MIT App Inventor:

This Step is optional. I have given the link below to download the Android App directly. I have also added .aia link which can directly be downloaded and modified according to your need.

To create Android App Visit http://ai2.appinventor.mit.edu/ and create a project.

Voice Controlled Home Automation Using NodeMCU



Main Components on Screen are these as shown in the figure above:
Voice Controlled Home Automation Using NodeMCU

The internal button contains on off switch for Relay as well as voice input command as shown in the figure below. You can watch the video below for more detail information.

Voice Controlled Home Automation Using NodeMCU


Android App Download Link:

If you are a beginner and you don’t want to make any Android App, you can simply download the App from the link below.

Download Android App

You can also modify the Android App by exporting the .aia file. The detailed tutorial is given in the video.

Download .aia File


Code for Finding the Device IP Address:

Simply copy this Code and upload to Arduino IDE. After Code is uploaded simply click on Serial Monitor and get the IP. Copy this IP as it is required for your Android App.

NOTE: Please Disconnect Relay Power Pin while uploading the code.






Source Code/Program:

Here is a source code for Wifi & Voice Controlled Home Automation Using NodeMCU & Android. Compile and upload this code to your NodeMCU board.

WARNING: Please Disconnect Relay Power Pin while uploading the code.


Video Tutorial:

Recommended For You

Ask A Question .......

Close