Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

PROJECT REPORT ON

Home Automation Using IOT


Submitted to

Department of Computer Applications

for Completion of Semester 4

Bachelor of Science in Information Technology

Batch (2021-2024)

Submitted by

Name of the student: Ansh Gujral

Enrollment Number: GE-21220709

Under the Guidance of

DR. Kamlesh Chandra Purohit

GRAPHIC ERA DEEMED TO BE UNIVERSITY DEHRADUN

June -2023
CANDIDATE’S DECLARATION
I hereby certify that the work presented in this project report entitled
“_______________________________________________________” in partial fulfilment of
the requirements for the award of the degree of Master of Computer Applications is a
Bonafede work carried out by me during the period of January 2020 to June 2020 under the
supervision of _______________, Department of Computer Application, Graphic Era
Deemed to be University, Dehradun, India.

This work has not been submitted elsewhere for the award of a degree/diploma/certificate.

Name and Signature of Candidate

This is to certify that the above-mentioned statement in the candidate’s declaration is correct
to the best of my knowledge.

Date: ____________ Name and Signature of Guide

Signature of Supervisor Signature of External Examiner

HOD

ii
Acknowledgement

A student of a university will have to write the acknowledgement for their project or research
paper stating that the submission is done and is not copied. The acknowledgement sample for
the university project is mostly attached after the dedication page thanking all the faculty
members of the department, HOD, the Dean and the mentor.

I would like to express my profound gratitude to Mr. Sanjiv Chauhan Sir, HOD Computer
Application department(UG).

I would like to express my special thanks to my mentor DR.Kamlesh Chandra Purohit for his
time and efforts he/she provided throughout the year. Your useful advice and suggestions
were really helpful to me during the project’s completion. In this aspect, I am eternally
grateful to you.

I would like to acknowledge that this project was completed entirely by me and not by
someone else.

Candidate Name and Signature

iii
Table of Contents

Candidate’s Declaration ii
Acknowledgements iii
Table of Contents iv
Abstract v
Chapter1. 1

1.1 Introduction 1

1.2 Background 2

1.3 Project Objective 2

1.3.1 Scope 3

1.4 3
Project Management
1.4 Overview and Benefit 4

Chapter 2. Theory 5

Chapter 3. Hardware and Setup 19

Chapter 4. Testing 32

Chapter 5. Conclusion and Future Scope 37

Chapter 6. References 40
ABSTRACT
This project presents the overall design of Home Automation System (HAS) with low cost
and wireless system. It specifically focuses on the development of an IOT based home
automation system that is able to control various components via internet or be automatically
programmed to operate from ambient conditions. In this project, we design the development
of a firmware for smart control which can successfully be automated minimizing human
interaction to preserve the integrity within whole electrical devices in the home. We used
Node MCU, a popular open source IOT platform, to execute the process of automation.
Different components of the system will use different transmission mode that will be
implemented to communicate the control of the devices by the user through Node MCU to
the actual appliance. The main control system implements wireless technology to provide
remote access from smart phone. We are using a cloud server-based communication that
would add to the practicality of the project by enabling unrestricted access of the appliances
to the user irrespective of the distance factor. We provided a data transmission network to
create a stronger automation. The system intended to control electrical appliances and devices
in house with relatively low cost design, user-friendly interface and ease of installation. The
status of the appliance would be available, along with the control on an android platform.
This system is designed to assist and provide support in order to 1fulfil the needs of elderly
and disabled in home. Also, the smart home concept in the system improves the standard
living at home.

v
Chapter 1

Introduction
1.1 Introduction

Internet of Things (IOT) is a concept where each device is assign to an IP


address and through that IP address anyone makes that device identifiable on
internet. The mechanical and digital machines are provided with unique
identifiers (UIDs) and the ability to transfer data over a network without
requiring human-to-human or human-to-computer interaction. Basically, it
started as the “Internet of Computers.” Research studies have forecast an
explosive growth in the number of “things” or devices that will be connected
to the Internet. The resulting network is called the “Internet of Things” (IoT).
The recent developments in technology which permit the use of wireless
controlling environments like, Bluetooth and Wi-Fi that have enabled different
devices to have capabilities of connecting with each other. Using a WIFI
shield to act as a Micro web server for the Arduino which eliminates the need
for wired connections between the Arduino board and computer which reduces
cost and enables it to work as a standalone device. The Wi-Fi shield needs
connection to the internet from a wireless router or wireless hotspot and this
would act as the gateway for the Arduino to communicate with the internet.
With this in mind, an internet based home automation system for remote
control and observing the status of home appliances is designed.
Due to the advancement of wireless technology, there are several different
type of connections are introduced such as GSM, WIFI, and BT. Each of the
connection has their own unique specifications and applications. Among the
four popular wireless connections that often implemented in HAS project,
WIFI is being chosen with its suitable capability. The capabilities of WIFI are
more than enough to be implemented in the design. Also, most of the current
laptop/notebook or Smartphone come with built-in WIFI adapter. It will
indirectly reduce the cost of this system.
1
1.2 Background

The concept of “Home Automation” has been in existence for several years.
“Smart Home”, “Intelligent Home” are terms that followed and is been used
to introduce the concept of networking appliance within the house. Home
Automation Systems (HASs) includes centralized control and distance status
monitoring of lighting, security system, and other appliances and systems
within a house. HASs enables energy efficiency, improves the security
systems, and certainly the comfort and ease of users. In the present
emerging market, HASs is gaining popularity and has attracted the interests
of many users. HASs comes with its own challenges.
1.3 PROJECT OBJECTIVES

Design of an independent HAS


To formulate the design of an interconnected network of home appliance
to be integrated into the HAS. The objective to account for every appliance
and its control to be automated and integrated into the network further
formulated into the HAS.

Wireless control of home appliances (Switch and Voice mode)


To develop the application that would include features of switch and/or
voice modes to control the applications.
Monitoring status of appliances
Being able to view the status of home appliances on the application, in order have
a better HAS.
Secure connection channels between application and Node MCU
Use of secure protocols over Wi-Fi so that other devices are prevented to
achieve control over the HAS. Secure connections are obtained by SSL over
TCP, SSH.
Controlled by any device capable of Wi-Fi (Android, iOS, PC)
To achieve flexibility in control of the home appliances, and device capable

2
of Wi-Fi connectivitywill be able to obtain a secure control on the HAS.
Extensible platform for future enhancement
With a strong existing possibility of adding and integrating more features
and appliances to the system, the designed system needs to be highly
extensible in nature.

1.3.1 SCOPE

The aim is to design a prototype that establishes wireless remote control over a
network of home appliances. The application is designed to run on android
devices providing features like, switch mode control, voice command control
and a provision to view the status of the devices on the application itself.
Considering its wide range of applications, following are the scope of this
prototype.
The system can be implemented in homes, small offices, and malls as well, being
in-charge of control of the electrical appliances.

For remote access of appliances in internet or intranet. The appliances in the


above-mentioned environment can be controlled in intra-network or can be
accessed via internet.

The development of a technologically friendly environment. The system


incorporates the use of technology and making HAS. By the use of day-to-day
gadgets we can utilize them for a different perspective.
1.4 PROJECT MANAGEMENT

Experimentation

This phase involved discussions regarding necessary equipment regarding the project.
The study of related already existing projects, gathering required theoretical learning.
It also included figuring out the coding part, by developing simple algorithms and
flowcharts to design the whole process

3
Design

This phase was, designing layout of the application, and the necessary features to be
included. This involved the complete hardware assembly and installing the code to
Node MCU. The power strip was designed to connect the home appliances that can be
controlled via GPIO pins.

Development and testing

This phase had the development of the application. The android device was connected
to the Node MCU via wireless network (Wi-Fi) and the whole prototype was tested for
identification and removal of bugs.

Real world testing

The prototype was ready to be tested into the real world and integrated with various
real time electrical appliances.
1.5 OVERVIEW AND BENEFIT

The benefits of an established wireless remote switching system of home appliances include:
No legal issues
Obtaining access to or traversing properties with hard lines is extremely difficult.
Reduced wiring issues
Considering the increase in price of copper, thus increases the possibility of the wire to
be stolen. The use of a wireless remote system to control home appliances means no
wire for thieves to steal.
Extended range
As the system establishes control over Wi-Fi, it was a generally considered descent
range. That is 150 feet indoors. Outdoors it can be extended to 300 feet, but since the
application is of a HAS, an indoor range is considered.
Security
As the connection of the control of the HAS is established over a secure network the
system ensures security to the maximum extent.
Integrable and extensive nature
The prototype designed can be integrated to a larger scale.
4
Chapter 2

Theory

2.1 IOT (INTERNET OF THINGS)

IOT as a term has evolved long way as a result of convergence of multiple


technologies, machine learning, embedded systems and commodity sensors. IOT is a
system of interconnected devices assigned a UIDS, enabling data transfer and control
of devices over a network. It reduced the necessity of actual interaction in order to
control a device. IOT is an advanced automation and analytics system which exploits
networking, sensing, big data, and artificial intelligence technology to deliver
complete systems for a product or service. These systems allow greater transparency,
control, and performance when applied to any industry or system.

2.1.1 Features of IOT

Intelligence
IOT comes with the combination of algorithms and computation, software &
hardware that makes it smart. Ambient intelligence in IOT enhances its capabilities
which facilitate the things to respond in an intelligent way to a particular situation
and supports them in carrying out specific tasks. In spite of all the popularity of smart
technologies, intelligence in IOT is only concerned as a means of interaction between
devices, while user and device interaction are achieved by standard input methods
and graphical user interface.
Connectivity
Connectivity empowers the Internet of Things by bringing together everyday objects.
Connectivity of these objects is pivotal because simple object level interactions
contribute towards collective intelligence in the IOT network. It enables network
accessibility and compatibility in the things.
With this connectivity, new market opportunities for the Internet of things can be created by
5
the networking of smart things and applications.
Dynamic Nature
The primary activity of Internet of Things is to collect data from its environment, this
is achieved with the dynamic changes that take place around the devices. The state of
these devices change dynamically, example sleeping and waking up, connected
and/or disconnected as well as the context of devices including temperature, location
and speed. In addition to the state of the device, the number of devices also changes
dynamically with a person, place and time.
Enormous Scale
The number of devices that need to be managed and that communicate with each other
will be much larger than the devices connected to the current Internet. The
management of data generated from these devices and their interpretation for
application purposes becomes more critical. Gartner (2015) confirms the enormous
scale of IOT in the estimated report where it stated that 5.5 million new things will get
connected every day and 6.4 billion connected things will be in use worldwide in
2016, which is up by 30 percent from 2015. The report also forecasts that thenumber
of connected devices will reach 20.8 billion by 2
Sensing
IOT wouldn’t be possible without sensors that will detect or measure any changes in
the environment to generate data that can report on their status or even interact with
the environment. Sensing technologies provide the means to create capabilities that
reflect a true awareness of the physical world and the people in it. The sensing
information is simply the analog input from the physical world, but it can provide a
rich understanding of our complex world.
Heterogeneity
Heterogeneity in Internet of Things as one of the key characteristics. Devices in IOT
are based on different hardware platforms and networks and can interact with other
devices or service platforms through different networks. IOT architecture should
support direct network connectivity between heterogeneous networks. The key design
requirements for heterogeneous things and their environments in IOT are scalabilities,
modularity, extensibility, and interoperability.

6
2.1.2 Advantages of IOT
Communication
IOT encourages the communication between devices, also famously known as
Machine-to-Machine (M2M) communication. Because of this, the physical devices
can stay connected and hence the total transparency is available with lesser
inefficiencies and greater quality.
Automation and Control
Due to physical objects getting connected and controlled digitally and centrally
with wireless infrastructure, there is a large amount of automation and control in
the workings. Without human intervention, the machines are able to
communicate with each other leading to faster and timely output.
Monitor
The second most obvious advantage of IOT is monitoring. Knowing the exact
quantity of supplies or the air quality in your home, can further provide more
information that could not have previously been collected easily. For instance,
knowing that you are low on milk or printer ink could save you another trip to the
store in the near future. Furthermore, monitoring the expiration of products can
and will improve safety.
Time
As hinted in the previous examples, the amount of time saved because of IOT
could be quite large. And in today’s modern life, we all could use more time.
Money
The biggest advantage of IOT is saving money. If the price of the tagging and
monitoring equipment is less than the amount of money saved, then the Internet of
Things will be very widely adopted.
IOT fundamentally proves to be very helpful to people in their daily routines by
making the appliances communicate to each other in an effective manner thereby
saving and conserving energy and cost. Allowing the data to be communicated
and shared between devices and then translating it into our required way, it makes
our systems efficient.
Automation of daily tasks leads to better monitoring of devices.

7
The IOT allows you to automate and control the tasks that are done on a daily
basis, avoiding human intervention. Machine-to-machine communication helps to
maintain transparency in the processes. It also leads to uniformity in the tasks. It
can also maintain the quality of service. We can also take necessary action in case
of emergencies.
Efficient and Saves Time
The machine-to-machine interaction provides better efficiency, hence; accurate
results can be obtained fast. This results in saving valuable time. Instead of
repeating the same tasks every day, it enables people to do other creative jobs.
Saves Money
Optimum utilization of energy and resources can be achieved by adopting this
technology andkeeping the devices under surveillance. We can be alerted in case
of possible bottlenecks, breakdowns, and damages to the system. Hence, we can
save money by using this technology.
Better Quality of Life
All the applications of this technology culminate in increased comfort, convenience, and
bettermanagement, thereby improving the quality of life.

2.1.3 Disadvantages of IOT


Compatibility
Currently, there is no international standard of compatibility for the tagging and
monitoring equipment. I believe this disadvantage is the easiest to overcome. The
manufacturing companiesof these equipment just need to agree to a standard,
such as Bluetooth, USB, etc. This is nothing new or innovative needed.
Complexity
As with all complex systems, there are more opportunities of failure. With the
Internet of Things, failures could skyrocket. For instance, let’s say that both you
and your spouse each get a message saying that your milk has expired, and both
of you stop at a store on your way home, and you both purchase milk. As a result,
you and your spouse have purchased twice the amount that you both need. Or

8
maybe a bug in the software ends up automatically ordering a new ink cartridge
for your printer each and every hour for a few days, or at least after each power
failure, when you only needa single replacement.
Privacy/Security
With all this IOT data being transmitted, the risk of losing privacy increases. For
instance, howwell encrypted will the data be kept and transmitted with? Do you
want your neighbors or employers to know what medications that you are
taking or your financial situation?
Safety
Imagine if a notorious hacker changes your prescription. Or if a store
automatically ships you an equivalent product that you are allergic to, or a flavor
that you do not like, or a product that is already expired. As a result, safety is
ultimately in the hands of the consumer to verify allautomation.
As all the household appliances, industrial machinery, public sector services like
water supply and transport, and many other devices all are connected to the
Internet, a lot of information is availableon it. This information is prone to attack
by hackers. It would be very disastrous if private and confidential information is
accessed by unauthorized intruders.
Lesser Employment of Menial Staff
The unskilled workers and helpers may end up losing their jobs in the effect of
automation of daily activities. This can lead to unemployment issues in the society. This
is a problem with the advent ofany technology and can be overcome with education.
With daily activities getting automated, naturally, there will be fewer requirements of
human resources, primarily, workers and less educated staff. This may create
Unemployment issue in the society.

9
2.2 Application Grounds of IOT

Wearables

Wearable technologies are a hallmark of IOT applications and is one of the


earliest industries to have deployed IOT at its services. Fit Bits, heart rate
monitors, smartwatches, glucose monitoring devices reflect the successful
applications of IOT.

Smart homes

This area of application concerned to this project, so a detailed application is


discussed further. Jarvis, an AI home automation employed by Mark Zuckerberg,
is a remarkable example in this field of application.

Health care

IOT applications have turned reactive medical based system into proactive
wellness-based system. IOT focuses on creating systems rather than equipment.
IOT creates a future of medicine and healthcare which exploits a highly integrated
network of sophisticated medical devices. The integration of all elements provides
more accuracy, more attention to detail, faster reactions to events, and constant
improvement while reducing the typical overhead of medical research and
organizations.

Agriculture
A greenhouse farming technique enhances the yield of crops by controlling
environmental parameters. However, manual handling results in production loss,
energy loss, and labor cost, making the process less effective. A greenhouse with
embedded devices not only makes it easier to be monitored but also, enables us to
control the climate inside it. Sensors measure different.

10
2.2.1 IOT Technologies and Protocols
Bluetooth

Bluetooth is a short range IOT communication protocol/technology that is


profound in many consumer product markets and computing. It is expected to be
key for wearable products in particular, again connecting to the IOT albeit
probably via a smartphone in many cases. The new Bluetooth Low-Energy (BLE)
– or Bluetooth Smart, as it is now branded – is a significant protocol for IOT
applications. Importantly, while it offers a similar range to Bluetooth it has been
designed to offer significantly reduced power consumption.

Zigbee

ZigBee is similar to Bluetooth and is majorly used in industrial settings. It has


some significant advantages in complex systems offering low-power operation,
high security, robustness and high and is well positioned to take advantage of
wireless control and sensor networks in IOT applications. The latest version of
ZigBee is the recently launched 3.0, which is essentially the unification of the
various ZigBee wireless standards into a single standard.

Z-Wave

Z-Wave is a low-power RF communications IOT technology that primarily design


for home automation for products such as lamp controllers and sensors among
many other devices. A Z- Wave uses a simpler protocol than some others, which
can enable faster and simpler development, but the only maker of chips is Sigma
Designs compared to multiple sources for other wireless technologies such as
ZigBee and others.

Wi-Fi

Wi-Fi connectivity is one of the most popular IOT communication protocol, often
an obvious choice for many developers, especially given the availability of Wi-Fi
within the home environment within LANs. There is a wide existing
infrastructure as well as offering fast data transfer and the ability to handle high

11
quantities of data. Currently, the most common Wi-Fi standard used in homes and
many businesses is 802.11n, which offers range of hundreds of megabit per
second, which is fine for file transfers but may be too power-consuming for many
IOT applications.
Cellular
Any IOT application that requires operation over longer distances can take
advantage of GSM/3G/4G cellular communication capabilities. While cellular is
clearly capable of sending high quantities of data, especially for 4G, the cost and
also power consumption will be too high for many applications. But it can be ideal
for sensor-based low-bandwidth-data projects that will send very low amounts of
data over the Internet.
NFC
NFC (Near Field Communication) is an IOT technology. It enables simple and
safe communications between electronic devices, and specifically for smartphones,
allowing consumers to perform transactions in which one does not have to be
physically present. It helps the user to access digital content and connect electronic
devices. Essentially it extends the capability of contactless card technology and
enables.

Lora WAN

is one of popular IOT Technology, targets wide-area network (WAN)


applications. The Lora WAN design to provide low-power WANs with features
specifically needed to support low-cost mobile secure communication in IOT,
smart city, and industrial applications. Specifically meets requirements for low-
power consumption and supports large networks with millions and millions of
devices, data rates range from 0.3 kbps to 50 kbps.

12
IOT software

IOT software addresses its key areas of networking and action through platforms,
embedded systems, partner systems, and middleware. These individual and
master applications are responsible for data collection, device integration, real-
time analytics, and application and process extension within the IOT network.
They exploit integration with critical business systems (e.g., ordering systems,
robotics, scheduling, and more) in the execution of related tasks.

Data Collection

This software manages sensing, measurements, light data filtering, light data
security, and aggregation of data. It uses certain protocols to aid sensors in
connecting with real-time, machine- to-machine networks. Then it collects data
from multiple devices and distributes it in accordance with settings. It also works
in reverse by distributing data over devices. The system eventually transmits all
collected data to a central server.

Device Integration

Software supporting integration binds (dependent relationships) all system devices


to create the body of the IOT system. It ensures the necessary cooperation and
stable networking between devices. These applications are the defining software
technology of the IOT network because without them, it is not an IOT system.
They manage the various applications, protocols, and limitations of each device to
allow communication.

Real-Time Analytics

These applications take data or input from various devices and convert it into
feasible actions or clear patterns for human analysis. They analyse information
based on various settings and designs in order to perform automation-related tasks
or provide the data required by industry.

13
2.2.2 Application and Process Extension

These applications extend the reach of existing systems and software to allow a
wider, more effective system. They integrate predefined devices for specific
purposes such as allowing certain mobile devices or engineering instruments
access. It supports improved productivity and more accurate data collection.

2.2.3 NODE MCU

NodeMCU (Node Microcontroller Unit) is a low-cost open source IOT


platform. It initially included firmware which runs on the ESP8266 Wi-Fi SoC
from Espressif Systems, and hardware which was based on the ESP-12 module.
Later, support for the ESP32 32-bit MCU was added.

Figure 1. Node MCU Development Board.

NodeMCU is an open source firmware for which open source prototyping board
designs are available. The name “NodeMCU” combines “node” and “MCU”
(micro-controller unit). The term “NodeMCU” strictly speaking refers to the
firmware rather than the associated development kits.

Both the firmware and prototyping board designs are open source.

14
The firmware uses the Lua scripting language. The firmware is based on the eLua
project and built on the Espressif Non-OS SDK for ESP8266. It uses many
open source projects, such as lua- cjson and SPIFFS. Due to resource
constraints, users need to select the modules relevant for their project and build a
firmware tailored to their needs. Support for the 32-bit ESP32 has also been
implemented.

The prototyping hardware typically used is a circuit board functioning as a dual in-
line package (DIP) which integrates a USB controller with a smaller surface-
mounted board containing the MCU and antenna. The choice of the DIP format
allows for easy prototyping on breadboards. The design was initially was based
on the ESP-12 module of the ESP8266, which is a Wi-Fi SoC integrated with
a Tensilica Xtensa LX106 core, widely used in IOT applications.

Pin Configuration of Node MCU Development Board

This module provides an access to the GPIO subsystem. All the access is based on
I/O index number of Node MCU kits, not the internal GPIO pins. For example, the
D0 pin on the development kit is mapped to GPIO pin 16. Node MCU provides
access to the GPIO pins, and the following pin mapping table is a part of the API
documentation.

15
2.4 Installation of Node MCU
Mostly these days devices download and install drivers on their own, automatically.
Windows doesn’t know how to talk to the USB driver on the Node MCU so it
can’t figure out that the board is a Node MCU and proceed normally. Node MCU
Amica is an ESP8266 Wi-Fi module based development board. It has got Micro
USB slot that can directly be connected to the computer or other USB host
devices. Ti has got 15X2 header pins and a Micro USB slot, the headers can be
mounted on a breadboard and Micro USB slot is to establish connection to USB
host device. It has CP2120 USB to serial converter. In order to install CP2120
(USB to serial converter), user is needed to download the driver for the same. Once
user downloads drivers as per its respective operating system, the system
establishes connection to Node MCU. The user needs to node down the COM post
allotted to newly connected USB device (Node MCU) from device manager of the
system. This com port number will be required while using Node MCU Amica. As
the CP2120 driver has been installed, the Node MCU can be programmed using
Arduino IDE software by coding in embedded C. this requires ESP8266 board
installation in Arduino IDE from board manager, and assigning communication
port.

16
BLOCK DIAGRAM

Figure 2. Block diagram


The block diagram gives the functionality of the overall project. The Node MCU
unit is the microcontroller or the main controlling unit of the system. The user uses
the mobile application in setting commands for functioning of the appliances. The
mobile application interprets the command form in user in voice or switch mode
and sends signal to the Node MCU unit, over a wireless network established by Wi-
Fi communication. Hence the Wi-Fi module (actually inbuilt into Node MCU),
helps the microcontroller establish Wi-Fi communication with a device and take
commands from an application over wireless network. The Node MCU on further
receiving the signal then turns on/off the appliance with the help of relay. The
Node MCU, relay and the final appliances are physically connected. There is a
power supply unit that powers the microcontroller, the relay as well as the final
appliances. There is also a display unit that displays the status of the application.

17
Proposed system
The android OS provides the flexibility of using the open source. The inbuilt
sensors can be accessed easily. The application used to control the system has the
following features. Android Phone acts as a client and data are sent via sockets
programming. The application takes command from user in two different modes.

Switch mode: Switch mode uses the radio buttons that are used to control the
home appliances. The radio button sends the status of the switch.

Voice mode: Voice Mode is used to control the home appliances using voice
command. Using the inbuilt microphone of Smartphone, the application creates an
intent that fetches the speech data to the Google server which responds with a
string data. The string data are further analysed and then processed.

More detailed discussion about the modes of control and how they actually control the
system is discussed if coming chapters.

18
CHAPTER 3

Hardware and Setup

3.1 MAIN FEATURES OF THE PROTOTYPE

The features of the developed prototype are:

The prototype establishes a wireless remote switching system of home appliances.

The prototype uses Wi-Fi to establish wireless control, which gives an indoor
range to about150 feet.

The command to switch on and off an appliance can be given from radio
buttons on the application from one’s smartphone.

There is also a provision developed to use voice commands on smartphone to


remotely switch home appliances

Any device capable of Wi-Fi connectivity can be used to control the prototype.

The control over home appliances is obtained over secure connections, by SSL over TCP,
SSH.

Simple design easy to integrate into a verity of appliances and extend on further range.

Displays the status of each appliances on the application in smartphone

Cost effective.

19
3.2 Google Firebase

The Firebase Realtime Database is a cloud-hosted NoSQL database provided by Google.


It allows developers to store and synchronize data in real-time across multiple clients. The
database is built on a hierarchical JSON-like structure, which enables efficient data
storage and retrieval. Realtime updates ensure that changes made to the database are
immediately reflected across all connected clients. It provides seamless data
synchronization across web, mobile, and server platforms. The Realtime Database
supports offline capabilities, allowing clients to access and modify data even when
offline. When the device reconnects, the database automatically synchronizes the changes
with the server. The database provides client-side SDKs for various platforms, including
Android, iOS, and web. It offers simple and powerful APIs for reading and writing data,
making it easy to integrate into applications. The Firebase Realtime Database uses
WebSockets for real-time communication between clients and the server. It ensures
efficient and low-latency data synchronization. The database allows developers to define
security rules to control access to the data. These rules can be customized based on
specific user roles and permissions. It provides a scalable and reliable infrastructure,
handling data storage and synchronization at scale. The Realtime Database supports
automatic scaling, ensuring optimal performance for applications with varying user loads.
It offers built-in data validation and synchronization, reducing the need for manual error
handling and conflict resolution. The database supports transactions, allowing developers
to perform atomic operations on data. Transactions ensure data integrity and consistency
in multi-client environments. It provides listeners and event-based triggers to receive real-
time updates when data changes. Developers can subscribe to specific data paths and
receive notifications when changes occur. The Realtime Database supports indexing and
querying of data, enabling efficient data retrieval. It allows sorting, filtering, and
searching of data based on specific criteria. The database supports nested and complex
data structures, enabling flexible data modeling. Developers can create relationships
between data nodes for better organization and retrieval. The Realtime Database offers a
scalable and cost-effective solution, with a free tier available for small-scale applications.
It seamlessly integrates with other Firebase services, such as Authentication, Cloud
Functions, and Cloud Messaging. The database can be used in a wide range of
20
applications, including chat apps, collaborative tools, and real-time analytics. It provides
strong data consistency guarantees, ensuring that clients always see the most up-to-date
data. The Realtime Database supports backups and data restoration, providing data
durability and resilience. It offers a graphical interface, the Firebase console, for
managing and monitoring the database. The console allows developers to view and edit
data, monitor usage, and configure security rules. The Realtime Database provides
analytics and insights into user engagement and behavior. Developers can track and
analyze data changes, user interactions, and performance metrics. It supports data export
and import, facilitating data migration and backups. The database allows data sharing and
collaboration between different Firebase projects. Developers can securely share data
across different applications and environments. The Realtime Database offers SDKs and
client libraries in multiple programming languages, providing flexibility for developers.

3.2.1 Integrate Firebase with ESP8266

Set up Firebase Project:

Go to the Firebase Console (console.firebase.google.com) and create a new project.

Enable the Realtime Database feature for your project.

Configure Firebase Realtime Database:

In the Firebase Console, navigate to the Realtime Database section.

Set up the database rules to define read and write permissions.

Take note of your Firebase project's credentials, including the database URL.

Set up ESP8266:

Connect the ESP8266 module to your computer.

Install the Arduino IDE (if not already installed) and open it.

21
Go to "File" -> "Preferences" and enter the following URL in the "Additional Boards
Manager URLs" field:
"http://arduino.esp8266.com/stable/package_esp8266com_index.json".

Go to "Tools" -> "Board" -> "Boards Manager" and search for "esp8266". Install the
"esp8266" board package.

Select the appropriate ESP8266 board from the "Tools" -> "Board" menu.

Install Required Libraries:

In the Arduino IDE, go to "Sketch" -> "Include Library" -> "Manage Libraries".

Search and install the following libraries:

Firebase ESP8266

ArduinoJson

ESP8266WiFi

ESP8266HTTPClient

Set up Wi-Fi Credentials:

In your Arduino sketch, include the necessary libraries:

#include <ESP8266WiFi.h> #include <FirebaseESP8266.h>

Set up your Wi-fi

const char* ssid = "Your WiFi SSID"; const char* password = "Your WiFi
Password";

Configure Firebase Credentials:

22
In the Arduino sketch, include Firebase and define Firebase credentials:

#include <FirebaseESP8266.h> #define FIREBASE_HOST "your-


project.firebaseio.com" #define FIREBASE_AUTH "your-auth-token"

Note: Replace "your-project" with your actual Firebase project name and "your-auth-token"
with the authentication token from your project's settings.

Connect to Wi-Fi:

Add the following code in your setup() function to connect to Wi-Fi:

WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) {


delay(500); }

Initialize Firebase:

In the setup() function, initialize the Firebase object:

Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);

Reading and Writing Data:

You can now read or write data from/to Firebase using Firebase methods.

For example, to read data from a specific node:

Firebase.getString("node/path");

To write data to a specific node:

Firebase.setString("node/path", "data");

Upload and Run:

Connect your ESP8266 to your computer and upload the code.

23
Open the serial monitor to see the ESP8266's connection status and any debugging
information.

3.1.2 Source Code ESP8266:-

#include <ESP8266WiFi.h>

#include <FirebaseArduino.h>

#define FIREBASE_HOST "node-3c895-default-rtdb.asia-


southeast1.firebasedatabase.app"

#define FIREBASE_AUTH "jCzEbGd2M2PAeiiCU2a4dzo4Y7h5PtWsT3fxl2QM"

#define WIFI_SSID "Anshgujral"

#define WIFI_PASSWORD "ansh1234"

String fireStatus = "";

int led = 5;

int fan=4;

void setup()

Serial.begin(9600);

delay(1000);

pinMode(led, OUTPUT);

pinMode(fan,OUTPUT);

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

Serial.print("Connecting to ");

24
Serial.print(WIFI_SSID);

while (WiFi.status() != WL_CONNECTED)

Serial.print(".");

delay(500);

Serial.println();

Serial.print("Connected to ");

Serial.println(WIFI_SSID);

Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);

Firebase.setString("LED_STATUS", "OFF");

Firebase.setString("FAN_STATUS", "OFF");

void loop()

fireStatus = Firebase.getString("LED_STATUS");

if (fireStatus == "OFF")

Serial.println("Led Turned OFF");

delay(1000);

digitalWrite(led, HIGH);

25
}

else if (fireStatus == "ON")

Serial.println("Led Turned on");

delay(1000);

digitalWrite(led, LOW);

else

Serial.println("Command Error! Please send ON/OFF");

fireStatus = Firebase.getString("FAN_STATUS");

if (fireStatus == "OFF")

Serial.println("fan Turned OFF");

delay(1000);

digitalWrite(fan, HIGH);

else if (fireStatus == "ON")

Serial.println("fan Turned ON");

delay(1000);
26
digitalWrite(fan, LOW);

else

Serial.println("Command Error! Please send ON/OFF");

3.1.3 Integrating Firebase With Android Studio

Set up Firebase Project:

Go to the Firebase Console (console.firebase.google.com) and create a new project.

Register your Android app with Firebase by providing the package name and SHA-1
fingerprint.

Add Firebase to Android Studio Project:

In Android Studio, open your project.

In the Project view, right-click on the app module and select "Open Module Settings" (F4).

Click on the "Dependencies" tab, then the "+" button, and choose "Library Dependency".

Search for "firebase" and select the desired Firebase libraries to include in your project.

Click "OK" to add the dependencies.

Download and Sync Configuration Files:

In the Firebase Console, navigate to your project's settings.

Click on the "google-services.json" download button to obtain the configuration file for your
Android app.

Move the downloaded file to the "app" module of your Android project.
27
In your project's build.gradle file (project-level), add the following classpath dependency:

classpath 'com.google.gms:google-services:4.3.10'

In your app's build.gradle file (module-level), add the following plugins and apply plugin:

apply plun: 'com.google.gms.google-services'

Sync your project to apply the changes.

Use Firebase Services in your Android App:

Depending on the Firebase services you want to use, you may need to add additional
dependencies or configurations.

For example, to use Firebase Authentication, add the following dependency:

implementation 'com.google.firebase:firebase-auth:21.0.1'

Follow the documentation and guides provided by Firebase to integrate and use specific
services in your app.

Initialize Firebase in your app's main Application class or MainActivity:

FirebaseApp.initializeApp(this);

Test and Run:

Ensure that your Android device or emulator is connected and running.

Build and run your Android app from Android Studio.

Monitor the logs and verify the Firebase integration by checking the Firebase Console for
data updates and events.

Remember to follow the Firebase documentation and specific guides for each Firebase
service you want to integrate. Each service may have additional steps, such as configuration,
authentication setup, and API usage.

Android (JAVA) Source Code:

package com.example.myhomeapp;

28
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

import com.google.firebase.database.DatabaseReference;

import com.google.firebase.database.FirebaseDatabase;

public class MainActivity extends AppCompatActivity {

Button b1,b2,b3,b4;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

b1=findViewById(R.id.button3);

b2=findViewById(R.id.button4);

b3=findViewById(R.id.button5);

b4=findViewById(R.id.button6);

final FirebaseDatabase database = FirebaseDatabase.getInstance();

b1.setOnClickListener(new View.OnClickListener() {

@Override

29
public void onClick(View view) {

// Write a message to the database

DatabaseReference LED = database.getReference("LED_STATUS");

LED.setValue("ON");

});

b2.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

// Write a message to the database

DatabaseReference LED = database.getReference("LED_STATUS");

LED.setValue("OFF");

});

b3.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

// Write a message to the database

DatabaseReference FAN = database.getReference("FAN_STATUS");

30
FAN.setValue("ON");

});

b4.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

// Write a message to the database

DatabaseReference FAN = database.getReference("FAN_STATUS");

FAN.setValue("OFF");

});

31
Chapter 4

Testing

4.1 TYPES OF TESTING

UNIT TESTING

Unit testing includes the plan of experiments that approve that the inner program rationale is
working legitimately and that program inputs produce substantial yields. All decision
branches and interior code stream ought to be approved. It is the trying of person
programming units of the application .it is done after the fruition of an individual unit prior to
incorporation. This is basic testing, that depends on information about its construction and is
obtrusive. Unit tests perform fundamental tests at part level and test a particular business
procedure, application, or potentially framework setup. Unit tests guarantee that each one of a
kind way of a business procedure performs precisely to the archived determinations also,
contains obviously characterized data sources and anticipated outcomes.

INTEGRATION TESTING

Combination tests are intended to test incorporated programming parts to decide whether they
really keep running as one program. Testing is occasion driven and is progressively
Concerned with the fundamental result of screens or fields. Mix tests exhibit that despite the
fact that the parts were separately fulfillment, as appeared by effectively unit testing, the mix
of parts is right and steady. Coordination testing is explicitly gone for uncovering the issues
that emerge from the mix of segments.

FUNCTIONAL TESTING

Blend tests are planned to test fused programming parts to choose whether they truly continue
running as one program. Testing is event-driven and is dynamically Concerned with the
major aftereffect of screens or fields. Blend tests show that regardless of the way that the
parts were independently satisfaction, as showed up by adequately unit testing, the blend of
32
parts is correct and unfaltering. Coordination testing is unequivocally gone for revealing the
issues that rise up out of the blend of portions.

SYSTEM TESTING

Framework testing guarantees that the whole incorporated programming framework meets
necessities. It tests an arrangement to guarantee known and unsurprising outcomes. A case of
framework testing is the setup situated framework incorporation test. Framework testing
depends on process portrayals and streams, accentuating pre-driven procedure connections
and combination focuses.

WHITEBOX TESTING

White Box Testing is a trying in which the product analyzer knows about the inward
activities, structure, and language of the product, or possibly its motivation. It is the reason. It
is utilized to test zones that can't become to from a discovery level

BLACK BOX TESTING

Discovery Testing will be trying the product with no learning of the inward functions,
structure or language of the module being tried. Discovery tests, as most different sorts of
tests, must be composed of a conclusive source report, for example, particular or necessities
report, for example, particular or prerequisites record. It is a trying in which the product
under test is dealt with, as a discovery you can't "see" into it. The test gives data sources and
reacts to yields without thinking about how the product works.

INTEGRATION TESTING

Programming joining testing is the gradual combination testing of at least two integround
programming segments on a solitary stage to create disappointments brought about by
interface abandons. The undertaking of the mixed test is to watch that parts or programming
applications, e.g: segments in a product framework or – one stage up – programming
applications at the organization level – associate without mistake.

33
ACCEPTANCE TESTING

Client Acceptance Testing is a basic period of any task and requires huge standard ticipation
by the end client. It additionally guarantees that the framework meets the practical
requirements.

ALPHA TESTING

In programming improvement, alpha test will be a test among the groups to affirm that your
item works. Initially, the term alpha test implied the main period of testing in a product
improvement process. The primary stage incorporates unit testing, part testing, and
framework testing. It additionally empowers us to test the item on the most reduced normal
denominator machines to ensure download times are satisfactory and preloads work.

BETA TESTING

In programming improvement, a beta test is the second period of programming testing in


which an examining of the target group attempts the item out. Beta testing can be considered
∧ quot; pre-discharge testing. Beta test variants of programming are currently dispersed to
educational programs authorities and educators to give the program a ∧ quot; genuine world
∧ amount; test. 37 C

4.2 Testing Methodology

Define a set of test cases to cover different functionalities and scenarios of the project.

Create a test plan that outlines the objectives, test cases, and expected outcomes.

Perform functional testing to verify that all features and components work as intended.

Conduct performance testing to evaluate the system's responsiveness, latency, and scalability.

Test the system under various network conditions, including both local and remote
connections.

34
Validate the integration between the ESP8266 hardware, Firebase Realtime Database, and the
Android application.

Document any bugs or issues encountered during testing.

4.2.1 Test Cases and Results:

Test Case 1: Wi-Fi Connection

Objective: Ensure that the ESP8266 module can establish a stable connection to the Wi-Fi
network.

Expected Result: ESP8266 successfully connects to the specified Wi-Fi network.

Actual Result: ESP8266 establishes a reliable Wi-Fi connection.

Test Case 2: Data Reading from Firebase

Objective: Verify that the ESP8266 can retrieve data from the Firebase Realtime Database.

Expected Result: ESP8266 reads the correct data from the designated Firebase database node.

Actual Result: ESP8266 successfully retrieves the expected data from Firebase.

Test Case 3: Data Writing to Firebase

Objective: Ensure that the ESP8266 can write data to the Firebase Realtime Database.

Expected Result: ESP8266 writes the specified data to the designated Firebase database node.

Actual Result: ESP8266 successfully writes data to the Firebase Realtime Database.

Test Case 4: Mobile App Integration

Objective: Validate the integration between the Android application and the ESP8266.

35
Expected Result: The Android app can send commands to the ESP8266 and receive real-time
updates from the device.

Actual Result: The Android application effectively communicates with the ESP8266 module.

Test Case 5: Performance and Scalability

Objective: Evaluate the system's performance and scalability under various loads.

Expected Result: The system maintains consistent performance and responsiveness, even
with multiple concurrent users and data updates.

Actual Result: The system handles increased loads and multiple users, maintaining
satisfactory performance.

36
Chapter 5

Conclusion and Future Scope

5.1 RESULT

The experimental model was made according to the circuit diagram and the results
were as expected. The home appliances could be remotely switched over Wi-Fi
network. Both the switch mode and the voice mode control methodologies were
successfully achieved. The Blynk application was also successful in displaying the
status of every application.

5.2 LIMITATIONS

Android devices having lower API version than 16 requires internet access to
convert the speech data to string data. Currently, the application is made for
Android Smart Phones; other OS platform doesn’t support our application. During
voice mode, external noises (voice) may affect our result. The speech instruction
that we command in our voice mode may not give exact result as expected. There
hence lies an ambiguity in result.

5.3 FURTHER ENHANCEMENT AND FUTURE SCOPE

Looking at the current situation we can build cross platform system that can be
deployed on various platforms like iOS, Windows. Limitation to control only
several devices can be removed by extending automation of all other home
appliances. The prototype can include sensors to implement automatic control of
the home appliances like; an LDR that can sense daylight and switch lamp
accordingly, a PIR to detect motion and be used for security purposes making an
alarm buzz, or a DHT11 sensor that’s senses ambient temperature and humidity of
atmosphere and switch fan/air conditioner accordingly. Scope of this project can
be expanded to many areas by not restricting to only home, but to small offices

37
CONCLUSION

It is evident from this project work that an individual control home automation
system can be cheaply made from low-cost locally available components and can
be used to control multifarious home appliances ranging from the security lamps,
the television to the air conditioning system and even the entire house lighting
system. And better still, the components required are so small and few that they can
be packaged into a small inconspicuous container. The designed home automation
system was tested a number of times and certified to control different home
appliances used in the lighting system, air conditioning system, home
entertainment system and many more . Hence, this system is scalable and flexible.

38
Image Representation of Project

Chapter 6
39
References
“Smart Energy Efficient Home Automation System using IOT”, by Satyendra K.
Vishwakarma, Prashant Upadhyaya, Babita Kumari, Arun Kumar Mishra.

“IOT Based Smart Security and Home Automation”, by Shardha Somani, Parikshit
Solunke, Shaunak Oke, Parth Medhi, Prof. P. P. Laturkar.

“A Dynamic Distributed Energy Management Algorithm of Home Sensor Network for


Home Automation System”, by Tui-Yi Yang, Chu-Sing Yang, Tien-Wen Sung; in
2016 Third International Conference on Computing Measurement Control and Sensor
Network.

“Enhance Smart Home Automation System based on Internet of Things”, by Tushar


Churasia and Prashant Kumar Jain; in Proceedings of the Third International
Conference on I-SMAC (IoT in Social, Mobile, Analytics and Cloud) (I-SMAC 2019)
IEEE Xplore Part Number:CFP19OSV- ART; ISBN:978-1-7281-4365-1

“Visual Machine Intelligence for Home Automation”, by Suraj, Ish Kool, Dharmendra
Kumar, Shovan Barman.

“A Low Cost Home Automation System Using Wi-Fi based Wireless Sensor Network
Incorporating internet of Things”, by Vikram.N, Harish.K.S, Nihaal.M.S, Raksha
Umesh, Shetty Aashik Ashok Kumar; in 2017 IEEE 7th International Advance
Computing Conference.

“Voice Controlled Home Automation System using Natural Language Processing and
Internet of Things”, by Mrs. Paul Jasmin Rani, Jason Bakthakumar, Praveen
Kumaar.B, Praveen Kumaar.U, Santhosh Kumar; in 2017 Third International
Conference on Science Technology Engineering & Management (ICONSTEM)

40
Thank You

41

You might also like