You are on page 1of 42

IOT-BASED HOME AUTOMATION

A Major Project Report


Submitted to
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD
In partial fulfillment of the requirement for the award of the degree
BACHELOR OF TECHNOLOGY in COMPUTER SCIENCE AND ENGINEERING

SUBMITTED BY
SARA JHANSI 19641A0572
PINAGANI THAANMAI 19641A05B5
KOYYADA GIRIJA SRI 19641A0595
BANOTH NAVEEN 19641A05A6

Under the Guidance of


Ms. P. SHAILAJA (ASSOC.PROF)

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

VAAGDEVI COLLEGE OF ENGINEERING


(Autonomous, Affiliated to JNTUH, Accredited By NBA)
BOLLIKUNTA, WARANGAL 2022-2023
VAAGDEVI COLLEGE OF ENGINEERING
(Autonomous, Affiliated to JNTUH, Accredited By NBA)
BOLLIKUNTA, WARANGAL - 506 005

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

CERTIFICATE

This is to certify that the project work entitled “IOT-BASED HOME AUTOMATION SYSTEM” is a
bonafide work carried out by Ms. S. JHANSI (19641A0572), Ms. P. THAANMAI (19641A05B5), Ms. K.
GIRIJA SRI (19641A0595), Mr. B. NAVEEN (19641A05A6) in partial fulfillment of the requirements for
the award of degree of Bachelor of Technology in COMPUTER SCIENCE and ENGINEERING from
Vaagdevi College of Engineering, (Autonomous) during the academic year 2019-2023

Project Guide HOD

External Examiner
ACKNOWLEDGEMENT

The development of the project though it was an arduous task, it has been made by the help of many people.
We are pleased to express our thanks to the people whose suggestions, comments, criticisms greatly encouraged us
in betterment of the project.

We would like to express our sincere thanks and profound gratitude to Dr. K. Prakash, principal of
Vaagdevi College of Engineering, for his support, guidance and encouragement in the course of our project.

We are also thankful to Head of the Department of CSE Dr. N. Satyavathi, Associate Professor for providing
excellent infrastructure and a nice atmosphere for completing this project successfully.

We would like to express our sincere gratitude and indebtedness to my project Guide P.SHAILAJA, Assoc.
Prof. for her/his valuable suggestions and interest throughout the course of this project.

We are also thankful to Project Coordinators, for their valuable suggestions, encouragement and
motivations for completing this project successfully.

We are thankful to all other faculty members for their encouragement. We convey our heartfelt thanks to the
lab staff for allowing me to use the required equipment whenever needed.

Finally, we would like to take this opportunity to thank our family for their support through the work. we
sincerely acknowledge and thank all those who gave directly or indirectly their support in completion of this work.
.

S. JHANSI (19641A0572)
P. THAANMAI (19641A05B5)
K. GIRIJA SRI (19641A0595)
B. NAVEEN (19641A05A6)
DECLARATION

We hereby declare that this project entitled "IOT-BASED HOME AUTOMATION" is submitted in
partial fulfillment of requirements for the award of bachelor of technology at VAAGDEVI
COLLEGE OF ENGINEERING affiliated to Jawaharlal Nehru Technology University. The report
has not been submitted either in part or full for degree earlier to this University

S. JHANSI (19641A0572)
P. THAANMAI (19641A05B5)
K. GIRIJA SRI (19641A0595)
B. NAVEEN (19641A05A6)
TABLE OF CONTENTS

PAGE NOS.
Abstract..............................................................................................................................................................i
List of Figures ...................................................................................................................................................ii

CHAPTER I Introduction
1.1Existing System
1.2 Proposed System

CHAPTER II System Requirements


2.1 Software Requirements
2.2 Hardware Requirements

CHAPTER III System Design

CHAPTER IV Diagrams

CHAPTER V Implementation

CHAPTER VI System Testing

CHAPTER VII Outputs

CHAPTER VIII Conclusion

CHAPTER IX Future Scope

CHAPTER X Bibilography
ABSTRACT

The Home Automation System (HAS) is extension of current activities performed inside the home and this Home
Automation System can be developed easily now a days, because of powerful computational devices and wireless
sensor network(WSN), to IoT-Based Smart Bank to Achieve Home Automation with Gesture Detection and Control.
The main objective of this project is to develop a home automation system using an ESP8266 board being remotely
controlled by any Android OS smartphone. Modern houses are gradually shifting from conventional switches to
centralized control systems, involving remote controlled switches. Ever thought of a life where you could just
command your home appliances to work as you need just by using your voice. Coming days we are going to use
automated houses which are activated. This project will demonstrate, controlling home electronic appliances like

T.V. , fans, lights etc., using the internet and your voice and that too low budget.

Today’s, smart objects in the Internet of Things(IOT) are able to detect their state and share it with other objects
across the Internet, thus collaboratively making intelligent decisions on their own. Humans always find
alternatives around them to carry out their work smoothly. Service provisioning in IOT should also be made
capable of providing similar or alternate objects that are aligned with user requirements, current context and
previous knowledge without any human intervention. With advancement of automation technology, life is
getting simpler and easier in all aspects. Now a day’s Automatic systems are being preferred over manual
systems. Traditional methods of household chores are replaced by automation systems which are adaptable
with the modern world. The manual systems are not more acceptable by the new generation people, so
traditional methods are to be replaced. We have reported an effective implementation for the Internet of
Things used for monitoring regular domestic conditions by sensing systems. Architecture of home automation
is based on appliances Node MCU, mobile application, web application, relays.
LIST OF FIGURES

Fig 1 Node MCU………………………………………………………

Fig 2 4 Channel Relay …………………………………………………….

Fig 3 4 Manually Operated Switches…………………………………..

Fig 4 Bulb…………………………………………….

Fig 5 Fan…………………………………………….

Fig 6 Connecting Wires…………………………………………..

Fig 7 Hotspot router…………………………………………….

Fig 8 Bread Board……………………………………………

Fig 9 Circuit Diagram……………………………………


1. INTRODUCTION

The main objective of this project is to develop a home automation system using an Arduino board with
Bluetooth being remotely controlled by any Android OS smartphone Modern houses are gradually shifting from
conventional switches to centralized control system, involving remote controlled switches. Ever thought of a life
where you could just command your home appliances to work as you need just by using your voice? Gone are the
days where you have to be a billionaire like Tony Stark to have an automated house which is voice activated. In this
short tutorial I’m going to show you how you can control your electronic appliances like T.V, fans, light set cover
the internet with your voice and that to under a low budget. You can follow this tutorial even if you have no prior
knowledge about Programming or Node MCU. So lets begin learning Home Automation Using Node MCU and
Google Assistant.

Home automation is anything that enables you to use your home’s lighting, heating and appliances more
conveniently and efficiently. It can be as simple as remote or automatic control of a few lights, or it can be a
complete system that controls all major parts of your home. Custom set to your own personal preference.

It focuses on wireless home automation technologies - these are easy to retrofit into existing homes now need for
new wiring and no ripping up the carpets or drilling holes in the walls. Each technology has its own unique features
and benefits that makes some more suited to particular applications, whilst others can be seen for all general home
automation installations. The concept behind IoT home automation is to enhance convenience, comfort, efficiency,
and security in the home by enabling remote control and intelligent automation of different tasks and functions. By
using interconnected devices and a central control system, homeowners can monitor and manage their homes from
anywhere using smartphones, tablets, or computers. It's worth noting that while IoT-based home automation offers
numerous benefits, ensuring the security and privacy of the connected devices and data is crucial. Implementing
robust security measures, such as strong passwords, encrypted communications, and regular firmware updates, is
essential to protect against potential vulnerabilities.
1.1 EXISTING SYSTEM: Bluetooth-controlled home automation refers to the use of Bluetooth technology to
control and automate various devices and systems within a home environment. Bluetooth is a wireless communication
protocol that allows for short-range data exchange between devices, typically within a range of 10 meters. In
Bluetooth-based home automation, devices such as smartphones, tablets, or dedicated Bluetooth controllers act as the
central control point. These devices communicate with Bluetooth-enabled devices and appliances in the home to send
commands and receive information

1.2 PROPOSED SYSTEM: IoT home automation is a system that uses internet-connected devices to control and
monitor your home's appliances, lights, and security systems. With IoT home automation, you can use a smartphone,
tablet, or voice command to turn on lights, adjust the thermostat, lock the doors, or even start your coffee maker. You
can control your home's appliances and devices from anywhere with an internet connection. This means you can turn
on the lights or adjust the thermostat before you get home, or lock the doors when you leave for work IoT home
automation can make your home more comfortable by allowing you to control the temperature, lighting, and other
aspects of your environment. For example, you can set your thermostat to automatically adjust the temperature to
your preferred setting when you come home, or you can turn on the lights in your bedroom when you get into bed.
2. SYSTEM REQUIREMENTS

Requirements identification is the first step of any software development project. Until the requirements of a
client have been clearly identified, and verified, no other task (design, coding, testing) could begin. Usually
business analysts having domain knowledge on the subject matter discuss with clients and decide what
features are to be implemented. Categorization of Requirements Based on the target audience or subject
matter, requirements can be classified into different types, as stated below:

2.1 SOFTWARE REQUIREMENTS:

1. Arduino IDE

2. Google Home App

2.2 HARDWARE REQUIREMENTS:

1. Node MCU

2. 4 Channel relay

3. 4 Manual Operated Switches

4. Bulb

5. Fan

6. Connecting Wires

7. Wi-Fi Hotspot Router

8. Breadboard
SOFTWARE REQUIREMENTS

1. ARDUINO IDE: The Arduino IDE (Integrated Development Environment) is an open-source software
application used for writing, compiling, and uploading code to Arduino boards. It provides a user-friendly
interface and a set of tools that make it easier to develop projects and control Arduino-based hardware.

Here are some key aspects of the Arduino IDE:

Code Editing: The Arduino IDE includes a code editor where you can write and modify your Arduino
sketches (programs). It supports the Arduino programming language, which is based on C/C++ and includes a
simplified API (Application Programming Interface) for interacting with Arduino hardware.
1. Code Compilation and Upload: Once you have written your Arduino code, you can compile it within the
IDE. The IDE takes your code and transforms it into a machine-readable format for the specific Arduino
board you are using. You can then upload the compiled code to the Arduino board via a USB connection.
2. Library Management: Arduino libraries are pre-written code modules that provide additional functionalities
to your Arduino projects. The Arduino IDE has a built-in library manager that allows you to search, install,
and manage libraries easily. This makes it convenient to include existing code libraries in your projects.
3. Serial Monitor: The Arduino IDE provides a built-in Serial Monitor tool that allows you to communicate
with the Arduino board via the serial port. It enables you to send and receive data to and from the Arduino,
making it useful for debugging and monitoring purposes.
4. Examples and Documentation: The Arduino IDE includes a range of example sketches that demonstrate
various functionalities and concepts. These examples can be a helpful starting point for beginners or as a
reference for understanding how to use different Arduino features. The IDE also provides access to
extensive documentation and resources on the Arduino website.
5. Cross-Platform Compatibility: The Arduino IDE is available for multiple operating systems, including
Windows, macOS, and Linux. This cross-platform compatibility allows you to develop Arduino projects
on different computer systems.
6. Extensibility: The Arduino IDE is extensible, meaning that you can customize and enhance its functionality
by adding plugins, also known as "board support packages" (BSPs). BSPs enable the IDE to work
with different Arduino-compatible boards and provide additional features specific to those boards.

The Arduino IDE is widely used by hobbyists, students, and professionals for prototyping and developing
projects involving Arduino boards. It provides a simplified and beginner-friendly environment for programming
and controlling hardware, making it accessible to those with limited programming experience.
Please note that there are alternative development environments available for Arduino, such as Visual Studio
Code with Arduino extensions and other third-party IDEs. These alternatives offer additional features and
customization options beyond the basic functionalities provided by the Arduino IDE.

2. GOOGLE HOME APP: The Google Home app is a mobile application developed by Google that
serves as a central hub for managing and controlling various smart devices and services in your home.
It is available for both Android and iOS devices.
Here are some key aspects of the Google Home app:

1. Device Setup and Configuration: The Google Home app allows you to set up and configure various Google
devices and compatible smart home devices, such as Google Nest speakers, Chromecast devices, smart lights,
thermostats, cameras, and more. It provides step-by-step instructions to connect and integrate these devices
into your home network.

2. Home Control and Automation: With the Google Home app, you can control and manage your smart devices
individually or in groups. You can turn devices on/off, adjust settings, set schedules and timers, and create
automation routines that trigger actions based on specific conditions or events. For example, you can create a
routine to turn off all lights, lock doors, and adjust the thermostat when you say "Goodnight."
3. Voice Assistant Integration: The Google Home app works in conjunction with the Google Assistant, which is

Google's voice-activated virtual assistant. You can use the app to configure and customize the Google
Assistant settings, such as voice recognition, language preferences, and personalized routines. You can also
access and manage your voice commands and interactions history.
4. Multi-Room Audio and Video: The app enables you to create speaker groups, which allow you to play
synchronized audio across multiple compatible speakers in different rooms. You can also cast video content
from various streaming services to compatible devices, such as Chromecast-enabled TVs or smart displays,
directly from the app.
5. Home Network Management: The Google Home app provides basic tools to manage your home network,
such as checking the status of connected devices, running network speed tests, and optimizing Wi-Fi
performance. It can also recommend devices or accessories to improve your network coverage and stability.
6. Content and Services Integration: The Google Home app allows you to link and control various media
and streaming services, such as Spotify, YouTube Music, Netflix, and more. You can manage your accounts,
browse content, and initiate playback on compatible devices from within the app.
7. Guest Access and Family Controls: The app supports guest access, allowing you to grant temporary
access to your smart home devices and services to visitors without providing them with full control.
Additionally, you can set up parental controls and manage family members' access and usage restrictions
for specific devices or services.
8. App and Device Updates: The Google Home app regularly receives updates to add new features, improve
performance, and enhance compatibility with the latest Google devices and services. The app provides
notifications and prompts for updating both the app itself and connected devices to ensure you have access
to the latest features and security patches.
The Google Home app provides a centralized and intuitive interface for managing and controlling your smart
home devices and services. It simplifies the process of setting up and configuring devices, allows for convenient
control through voice commands, and offers automation and integration capabilities to enhance the overall
smart home experience.
HARDWARE REQUIREMENTS

1. NODE MCU(esp8266): NODEMCU board is a low cost Wi-Fi module, is a self-contained System-On-
Chip with integrated TCP/IP protocol stack that can give any microcontroller access to your Wi-Fi network.
The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions
from another application processor. The chip first came to the attention of Western makers in August 2014
with the ESP- 01 module, made by a third-party manufacturer Ai-Thinker. This small module
allows microcontroller to connect to a Wi-Fi network and make simple TCP/IP connections using Hayes
style commands. However, at first there was almost no English-language documentation on the chip
and the commands it accepted. The very low price and the fact that there were very few external
components on the module, which suggested that it could eventually be very inexpensive in volume,
attracted many hackers to explore the module, the chip, and the software on it, as well as to translate the
Chinese documentation.

Fig 1: Node MCU


2. RELAY: is an electrically operated switch. It consists of a set of input terminals for a signal or multiple control
signals, and a set of operating contact terminals. The switch may have any number of contacts or multiple contact
forms, such as make contacts, break contacts, or combinations thereof.
Relay are used where it is necessary to control a circuit by an independent low-power signal, or where
several circuits must be controlled by one signal. Relays were first used in long-distance telegraph circuits as
signal repeaters: they refresh the signal coming in from one circuit by transmitting it on another circuit. Relays
were used extensively in telephone exchanges and early computers to perform logical operations.
A relay switch is an electromechanical device that uses an electromagnet to operate a pair of movable
contacts from an open position to a closed position. Relays are used to control electrical circuits by receiving a
low-power signal and using it to control a high-power circuit. This allows a relatively small amount of current
to be used to control a much larger amount of current. Relays are available in a wide variety of sizes, shapes,
and configurations. They can be used to control a wide variety of electrical loads, including motors, heaters,
lights, and other devices. Relays are also used in many electronic circuits, such as computers, audio
equipment, and security systems.

Fig 2: Relay
3. MANUALLY OPERATED SWITCH: A home switch that is manually operated is a type of switch
that is turned on or off by a person, rather than automatically. This type of switch is often used in homes
for things like lights, appliances, and security systems. Manually operated switches can be either single-
pole or double-pole. Single-pole switches control one circuit, while double-pole switches control
two circuits.

Fig 3: Manually Operated Switch


4. BULB: A bulb, in the context of lighting, refers to a device that produces light through the emission of
electromagnetic radiation, typically in the visible spectrum. It is commonly used as a general term to
describe various types of light sources, including incandescent bulbs, fluorescent bulbs, LED bulbs,
and more.
LED Bulbs: Light Emitting Diode (LED) bulbs are highly energy-efficient and have become increasingly
in recent years. LED bulbs produce light when an electric current passes through a semiconductor material,
causing electrons to release energy in the form of photons. LED bulbs offer a wide range of temperatures,
are available in various shapes and sizes, and have a longer lifespan compared to traditional bulbs. They
are commonly used in homes, commercial buildings, automotive lighting, and many other applications.
Fluorescent Bulbs: Fluorescent bulbs use low-pressure mercury vapor and phosphor coating to produce light.
When the gas inside the bulb is excited by an electric current, it emits ultraviolet (UV) light, which is then
converted into visible light by the phosphor coating. Fluorescent bulbs are more energy-efficient and have a
longer lifespan compared to incandescent bulbs. They are commonly used in offices, commercial buildings,
and residential spaces.

Fig 4: Bulb
5. FAN: A fan is a common household appliance used to create a flow of air for the purpose of cooling or
circulating air within a space. It typically consists of a motor, blades or impellers, and a housing.

Fig 5: Fan
6. CONNECTING WIRES: Connecting wires allows an electrical current or signal to travel from one point
on a circuit to another because signal or current needs a medium through which to move. In basic circuits,
the wire comes from one terminal of a power source, such as a battery.

Fig 6: Connecting Wires


7. Wi-Fi HOTSPOT: Wi-fi hotspot is simply an area with an accessible wireless network. The term is most
often used to refer to wireless networks in public areas like airports and coffee shops. Users can even create
their own mobile hotspot using a cell phone or an external device that can connect to a cellular network.

Fig 7: Wi-Fi Hotspot


8. BREAD BOARD: The breadboard is a white rectangular board with small embedded holes to insert
electronic components. It is commonly used in electronics projects. We can also say that breadboard is
a prototype that acts as a construction base of electronics.

Fig 8: Bread Board


3.SYSTEM DESIGN
Home Automation System (HAS) gains popularity due to communication technology advancement. Smart
Home is one of the Internet of Things (IoT) applications that facilitates the control of home appliances over
the Internet using automation system. This paper proposes a low-cost Wi-Fi based automation system for
Smart Home (SH) in order to monitor and control home appliances remotely using Android-based application. An
Arduino Mega microcontroller provided with Wi-Fi module is utilized to build the automation system. In
addition, several sensors are used to monitor the temperature, humidity and motion in home. A relay board
is exploited to connect the HAS with home under controlled appliances. The proposed automation system,
can easily and efficiently control the electrical appliances via Wi-Fi and Virtuino mobile application.

Home automation is constructing automation for a domestic, mentioned as a sensible home or smart house. In the IoT
home automation ecosystem, you can control your devices like light, fan, TV, etc. A domestic automation system can
monitor and/or manage home attributes adore lighting, climate, enjoyment systems, and appliances. It is very helpful
to control your home devices. It’s going to in addition incorporates domestic security such as access management and
alarm systems. Once it coupled with the internet, domestic gadgets are a very important constituent of the internet of
Things. A domestic automation system usually connects controlled devices to a central hub or gateway.

The program for control of the system makes use of both wall-mounted terminals, tablet or desktop computers, a
smartphone application, or an online interface that may even be approachable off-site through the Internet.
4.DIAGRAMS

Fig 9: Circuit Diagram

The Home automation is operating with Node MCU esp8266 controller and the command is given by the Blynk
android application in a mobile phone using the wi-fi network. The Node MCU esp8266 as inbuilt wi-fi module

and the devices connected with home automation. Both wi-fi is connected with an authentication token. For
demonstration in this project DC appliance and power supply will be given. Digital Pins D0, D1 are connected

to relay IN1, IN2 respectively and VCC and Ground of relays connected parallel to Vin and ground. A home
automation system is an automating the bulk of electronic and electrical tasks with in a home. It uses a

combination of hardware and software to enable control and management over appliances and devices within

a home. Home automation not only refers to reduce human efforts but also energy efficiency and time saving.

Here we are performing home automation by using ESP8266 - wi-fi and home app from play store app.
5.IMPLEMENTATION

#ifdef ENABLE_DEBUG

#define DEBUG_ESP_PORT Serial

#define NODEBUG_WEBSOCKETS

#define NDEBUG

#endif

#include <Arduino.h>

#include <ESP8266WiFi.h>

#include "SinricPro.h"

#include "SinricProSwitch.h"

#include <map>

#define WIFI_SSID "hello"

#define WIFI_PASS "12345678"

#define APP_KEY "991f5961-9a7a-48fe-a1a0-228a727ee056"

// Should look like "de0bxxxx-1x3x-4x3x-ax2x-5dabxxxxxxxx"

#define APP_SECRET

"55cd40bc-d209-4c68-8eb1-29913bea02e5-7b1f7749-0084-455d-a5c0-0eadbc9fab80"

// Should look like "5f36xxxx-x3x7-4x3x-xexe-e86724a9xxxx-4c4axxxx-3x3x-x5xe-x9x3-333d65xxxxxx"

//Enter the device IDs here

#define device_ID_1 "64743105929949c1da76286f"

#define device_ID_2 "647430f1929949c1da762834"

#define device_ID_3 "6474311d743f912070285025"

#define device_ID_4 "SWITCH_ID_NO_4_HERE"

// define the GPIO connected with Relays and switches

#define RelayPin1 D1 //D23


#define RelayPin2 D2 //D22

#define RelayPin3 D3 //D21

#define RelayPin4 19 //D19

#define SwitchPin1 D6 //D13

#define SwitchPin2 D7 //D12

#define SwitchPin3 D5 //D14

#define SwitchPin4 27 //D27

#define wifiLed 2 //D2

// comment the following line if you use a toggle switches instead of tactile buttons

//#define TACTILE_BUTTON 1

#define BAUD_RATE 9600

#define DEBOUNCE_TIME 250

typedef struct { // struct for the std::map below

int relayPIN;

int flipSwitchPIN;

} deviceConfig_t;

// this is the main configuration

// please put in your deviceId, the PIN for Relay and PIN for flipSwitch

// this can be up to N devices...depending on how much pin's available on your device ;)

// right now we have 4 devicesIds going to 4 relays and 4 flip switches to switch the relay manually

std::map<String, deviceConfig_t> devices = {

//{deviceId, {relayPIN, flipSwitchPIN}}

{device_ID_1, { RelayPin1, SwitchPin1 }},

{device_ID_2, { RelayPin2, SwitchPin2 }},

{device_ID_3, { RelayPin3, SwitchPin3 }},


{device_ID_4, { RelayPin4, SwitchPin4 }}

};

typedef struct { // struct for the std::map below

String deviceId;

bool lastFlipSwitchState;

unsigned long lastFlipSwitchChange;

} flipSwitchConfig_t;

std::map<int, flipSwitchConfig_t> flipSwitches;

// this map is used to map flipSwitch PINs to deviceId and handling debounce and last flipSwitch state

checks

// it will be setup in "setupFlipSwitches" function, using informations from devices map

void setupRelays() {

for (auto &device : devices) {

// for each device (relay, flipSwitch combination)

int relayPIN = device.second.relayPIN;

// get the relay pin

pinMode(relayPIN, OUTPUT);

// set relay pin to OUTPUT

digitalWrite(relayPIN, HIGH); }}

void setupFlipSwitches() {

for (auto &device : devices) {

// for each device (relay / flipSwitch combination)

flipSwitchConfig_t flipSwitchConfig;

// create a new flipSwitch configuration

flipSwitchConfig.deviceId = device.first;
// set the deviceId

flipSwitchConfig.lastFlipSwitchChange = 0;

// set debounce time

flipSwitchConfig.lastFlipSwitchState = true;

// set lastFlipSwitchState to false (LOW)—

int flipSwitchPIN = device.second.flipSwitchPIN;

// get the flipSwitchPIN

flipSwitches[flipSwitchPIN] = flipSwitchConfig;

// save the flipSwitch config to flipSwitches map

pinMode(flipSwitchPIN, INPUT_PULLUP);

// set the flipSwitch pin to INT}}

bool onPowerState(String deviceId, bool &state)

Serial.printf("%s: %s\r\n", deviceId.c_str(), state ? "on" : "off");

int relayPIN = devices[deviceId].relayPIN; // get the relay pin for corresponding device

digitalWrite(relayPIN, !state); // set the new relay state

return true;

void handleFlipSwitches() {

unsigned long actualMillis = millis();

// get actual millis

for (auto &flipSwitch : flipSwitches) {

// for each flipSwitch in flipSwitches map

unsigned long lastFlipSwitchChange = flipSwitch.second.lastFlipSwitchChange;

// get the timestamp when flipSwitch was pressed last time (used to debounce / limit events)
if (actualMillis - lastFlipSwitchChange > DEBOUNCE_TIME) {

// if time is > debounce time...

int flipSwitchPIN = flipSwitch.first;

// get the flipSwitch pin from configuration

bool lastFlipSwitchState = flipSwitch.second.lastFlipSwitchState;

// get the lastFlipSwitchState

bool flipSwitchState = digitalRead(flipSwitchPIN);

// read the current flipSwitch state

if (flipSwitchState != lastFlipSwitchState) {

// if the flipSwitchState has changed...

#ifdef TACTILE_BUTTON

if (flipSwitchState) {

// if the tactile button is pressed

#endif

flipSwitch.second.lastFlipSwitchChange = actualMillis;

// update lastFlipSwitchChange time

String deviceId = flipSwitch.second.deviceId;

// get the deviceId from config

int relayPIN = devices[deviceId].relayPIN;

// get the relayPIN from config

bool newRelayState = !digitalRead(relayPIN);

// set the new relay State

digitalWrite(relayPIN, newRelayState);

// set the trelay to the new state


SinricProSwitch &mySwitch = SinricPro[deviceId];

// get Switch device from SinricPro

mySwitch.sendPowerStateEvent(!newRelayState);

// send the event

#ifdef TACTILE_BUTTON

#endif

flipSwitch.second.lastFlipSwitchState = flipSwitchState;

// update lastFlipSwitchState}}}}

void setupWiFi()

Serial.printf("\r\n[Wifi]: Connecting");

WiFi.begin(WIFI_SSID, WIFI_PASS);

while (WiFi.status() != WL_CONNECTED){

Serial.printf(".");

delay(250);

digitalWrite(wifiLed, HIGH);

Serial.printf("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str());

void setupSinricPro()

{for (auto &device : devices)

{const char *deviceId = device.first.c_str();

SinricProSwitch &mySwitch = SinricPro[deviceId];

mySwitch.onPowerState(onPowerState);
}

SinricPro.begin(APP_KEY, APP_SECRET);

SinricPro.restoreDeviceStates(true);

void setup()

Serial.begin(BAUD_RATE);

pinMode(wifiLed, OUTPUT);

digitalWrite(wifiLed, LOW);

setupRelays();

setupFlipSwitches();

setupWiFi();

setupSinricPro();

void loop()

SinricPro.handle();

handleFlipSwitches();

}
Procedure to make coding to ESP8266

● Open Arduino IDE.

● Click on Sketch, select include library and select Manage libraries.

● Users can see the dialog box, search blynk in the search bar.

● Click on Install.

● It took a few minutes depending on the user's data speed.

● Click on File, select preferences paste this link given below in Additional Boards Manager URLs.
http://arduino.esp8266.com/stable/package_esp8266com_index.json

● Click on OK.

● Click on tools, select board managers, search node mcu in the search bar.

● Click on install.

● Click on files, select examples, select Blynk, select board Wi-Fi, select ESP8266_Standalone.

● Users can get code for ESP8266_standalone. Just few will edit i.e., auth token, network name,
network password.
● These two syntax play a major role while operating appliances, whenever Wi-Fi connected Node
MCU with power supply they get automatically operated, to reduce this drawback syntax will
help.

Syntax: digitalWrite (pin no. , HIGH);

● According to your requirement of appliances, users have to include them in programming Node
MCU.
Procedure to make automation via Blynk, Google Assistant

Here there are two way to control our appliances those are through Blynk, Google assistant

Through Blynk:

First install Blynk app in a mobile phone i.e., Android or iPhone.

● Then the user logs in with their respective mail ID.

● Users receive a token in mail which they need for programming.

● Furtherly the user receives an auth token for Blynk this place a major role.

● Add a new project named as Home automation.

● Arrange button according to user requirement.

● Select board, edit pin number.

● Up to here setup of Blynk ready.

● Copy and paste auth token in ESP8266 in Arduino IDE. Up to here automation can control through

mobile phones.

Through Google Assistant:

● For Google assistant service, IFTTT web application will help.

● Users have to create an account, which they can use for their Google assistant.

● Click on explore, select create applet.

● Then the web page displays if this then that.


Pin Diagram of Node MCU with respective to Arduino Uno

Here D0,D1…… are digital pins of Node MCU next to that GPIO16,GPIO5 are pins
to update in URL link in Webhooks. Users have to observe this diagram

Fig 10: Node MCU Pin Diagram

Node MCU provides access to the GPIO (General Purpose Input/Output) and a pin mapping table is part of the

API documentation.
Node MCU provides access to the GPIO (General Purpose Input/Output) and a pin mapping table is part of the

API documentation.

I/O Index ESP8266 PIN


0 GPIO16
1 GPIO5
2 GPIO4
3 GPIO0
4 GPIO2
5 GPIO14
6 GPIO12
7 GPIO13
8 GPIO15
9 GPIO3
10 GPIO1
11 GPIO9
12 GPIO10
WORKING:

The Home Automation System is operating with Node MCU ESP8266 controller and the command is
given by the Blynk application in a mobile phone using the Wi- Fi network. The Node MCU ESP8266 has an
inbuilt Wi-Fi module and the devices connected with Home Automation System. Both Wi-Fi is connected
with an authentication token.
The heart of today’s project is the Wi-Fi enabled board that needs no introduction to the ESP8266
based Node MCU development board. It is an open source platform for developing Wi-Fi based embedded systems
and it is based on the popular ESP8266 Wi-Fi module, running the Node MCU firmware. Node MCU was born
out of the desire to overcome the limitations associated with the first versions of the ESP8266 module which
was not compatible with breadboards. It was difficult to power and even more difficult to program. The
Node MCU board is easy to use. Low cost and that quickly endeared it to the heart of makers and it is one of
the most popular boards today. For this project two channel relay modules are added to the ESP8266 board.
The project flow involves the control of Node MCU’s GPIO from a webpage on any device connected on
the same network as the board. The status of the GPIO’s control the coil of the relays and causes the relay to
alternate between normally open (NO) and normally close (NC) condition depending on the state of the GPIO,
thus effectively turning the connected appliance “ON” or “OFF”.
Now the operation is gone by giving supply either Micro USB or Vin, GND. It can operate by Blynk application in
mobile phone i.e., Android or iPhone by manual and via Google Assistant with voice. The Hardware is well operated
according to our action.

Applications:

 Lightning Control
 Lawn / Gardening Management
 Smart Home Appliances
 Improved home safety and security
 Home air quality and water quality monitoring
 Better infotainment delivery
 Most preferable language based voice assistant
6.TESTING

Fig 11: Testing


7.OUTPUT

Fig 12: Output


Advantages:

 Security against burglars.


 It is available at low cost.
 Voice control home function.
 Managing all of your home devices from one place. The convenience factor here is enormous.
 Flexibility for new devices and appliances.
 Maximizing home security.
 Remote control of home functions.
 Increased energy efficiency.
 Improved appliance functionality.
 Home management insight.
 Reduce human efforts: As this system works automatically humans do not require to apply more
efforts.
 Multitasking: Multiple functions are done at the same time without the efforts of the human.
 Reduce time: As this system is multitasking so the time requires will be less.
8.CONCLUSION

Conclusion: The Home automation using Internet of Things has been experimentally proven to work
satisfactorily by connecting simple appliances to it and the appliances were successfully controlled remotely
through internet. The designed system not only monitors the sensor data like temperature, gas, light, motion sensor
but also actuates a process according to the requirement. For example, the switch gets dark. It also stores the
sensor parameters in the cloud (Gmail) in a timely manner. This will help the user to analyze the condition of
various parameters in the home anytime anywhere.
The home automation using Internet of Things has been experimentally proven to work satisfactorily by
connecting simple appliances to it and the appliances were successfully controlled remotely through Internet.
Home automation is undeniably a resource which can make a home environment automated. People can control
their electrical devices via these home automation devices and set up controlling actions through mobile. In future
this product may have high potential for marketing. Further it can be demonstrated from computer instead of
mobile phones for controlling appliances of any large places like industries, hospitals, institutions etc., centrally.
9.FUTURE SCOPE

Future scope for the home automation systems involves making homes even smarter. More energy can be
conserved by ensuring occupation of the house before turning on devices and turning off lights if not necessary. The
system can be integrated closely with home security solutions to allow greater control and safety for home owners.
The next step would be to extend this system to automate a large scale environment, such as offices and factories.
Home Automation offers a global standard for interoperable products. Standardization enables smart homes that can
control appliances, lighting, environment, energy management and security as well as the expandability to connect
with other networks. Well, no system is ever perfect. It always has a scope for improvement. One just needs to put on
a thinking cap and try and make the system more better.
10.BIBILOGRAPHY

1. Javale, D., Mohsin, M., Nandanwar, S, Shingate, M., 2013 ‘Home Automation and Security System
Using Android ADK’, International Journal of Electronics Communication and Com-puter
Technology (IJECCT),
Vol. 3, Issue 2, pp. 382-385, (Jul 2, 2009)

2. ImplementingAutomatedSoftwareTesting.[Online].Available:https://pythonandtesting.wordpress.com
/2011/01/18/implementing-automated-software testing-con-tinuously-track-progress-and-adjust-accordingly/

3. A. A. R. Richard, M. F. Sadman, I. Rahman, U. H. Mim, A. Ahmed and M. S. R. Zishan, 2021 "


Design and Implementation of Smart Old Age Home," 2021 International Conference on Automation,
Control and Mechatronics for Industry 4.0 (ACMI), pp. 1-5, doi: 10.1109/ACMI53878.2021.9528237.

4. Staroch P., 2013 “A Weather Ontology for Predictive Control in Smart Homes,” MSc dissertation,
Dept. of Software Engineering and Internet Computing, Vienna, Austria.

5. T. Begum, M. S. Hossain, M. B. Uddin and M. S. H. Chowdhury, 2009 "Design and Development


of Activation and Monitoring of Home Automation System via SMS through Microcontrol-ler,"
International Conference on Computers and Devices for Communication.

6. 2015, International Journal of Advanced Research in Electrical, Electronics and


Instrumentation Engineering (An ISO 3297: 2007 Certified Organization) Vol. 4, Issue 4.

7. Design of Arduino Based Home Automation Systems Incorporating Identity Detection,


De-partment of Electrical and Electronic Engineering BRAC University, Dhaka.

8. Home Automation System, Javier Castro and James Psota, Introductory Digital Systems
Laboratory Final Project, Massachusetts Institute of Technology

9. Wireless Control, Partial Fulfillment of the Requirements for the Degree Bachelor of
Engi-neering (Hons) (Electrical & Electronic Engineering).
10. 2020, Smart home guru website. [Online]. Available: https://medium.com/
@smarthome-guru/introduction-to-home-automation-6bdd0a4783c

11. 2020, The History of Home Automation. [Online]. Available: https://myalarm-center.com/blog/the-


history-of-home-automation/

12. 2018, My alarm center website. [Online]. Available: https://myalarmcenter.com/

You might also like