Project Report Iot Based Home Automation System
Project Report Iot Based Home Automation System
Project Report Iot Based Home Automation System
On
IOT BASED HOME AUTOMATION SYSTEM
In the partial fulfillment for the award of
BACHELOR OF ENGINEERING
IN
COMPUTER SCIENCE & ENGINEERING
Submitted by-
1
ACKNOWLEDGEMENT
We express our sincere gratitude to Prof. Jaspal Singh, Assistant Professor, Department of computer
science &Engineering, Sant Longwal Institute of Engineering Technology, as the mentor for our
project. It is our great fortune that we have got opportunity to carry out this project work under the
supervision. We express our sincere thanks for the encouragement, support and the guidance. We
would further like to thank all the faculty member for their cooperation and extended support in
undergoing the project work. We also would thank our department of Engineering to provide the
infrastructure and facility in carrying the projects like these.
2
Abstract
This project presents the overall design of Home Automation System 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.
3
Index
Topic PageNo
Chapter 1 (Introduction) 6
1.1 Introduction
1.2 Background
1.5 Scope
Chapter 2 (Theory) 10
2.1 IOT Internet of Things
4
3.2 Project Layout
3.4 Flutter
5.1 Result
5.3 Conclusion
Chapter 6 (References) 43
5
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.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 includes centralized control
and distance status monitoring of lighting, security system, and other appliances and systems
within a house.It enables energy efficiency, improves the security systems, and certainly the
comfort and ease of users. In the present emerging market,It is gaining popularity and has
attracted the interests of many users. Mainly being, in the present day, end users especially
elderly and disabled, even though hugely benefited, aren’t seen to accept the system due to the
complexity and cost factors.
6
1.3 PROJECT OBJECTIVES
The concept of Home Automation aims to bring the control of operating your everyday home
electrical appliances to the tip of your finger, thus giving user affordable lighting solutions, better
energy conservation with optimum use of energy. Apart from just lighting solutions, the concept also
further extends to have overall control over your home security as well as build a centralized home
entertainment system and much more. The Internet of Things based Home Automation system, as
the name suggests aims to control all the devices of your smart home through internet protocols or
cloud based computing.
The IoT based Home Automation system offer a lot of flexibility over the wired systems s it comes
with various advantages like ease-of-use, ease-of-installation, avoid complexity of running through
wires or loose electrical connections, easy fault detection and triggering and above and all it even
offers easy mobility.
Advantages:
1. Managing all of your home devices from one place. The convenience factor here is enormous.
Being able to keep all of the technology in your home connected through one interface is a massive
step forward for technology and home management. Theoretically, all you’ll have to do is learn how
to use one app on your smartphone and tablet, and you’ll be able to tap into countless functions and
devices throughout your home. This cuts way back on the learning curve for new users, makes it
easier to access the functionality you truly want for your home.
2. Flexibility for new devices and appliances. Smart home systems tend to be wonderfully flexible
when it comes to the accommodation of new devices and appliances and other technology. No matter
how state-of-the-art your appliances seem today, there will be newer, more impressive models
developed as time goes on. Beyond that, you’ll probably add to your suite of devices as you replace
the older ones or discover new technology to accompany your indoor and outdoor spaces. Being able
to integrate these newcomers seamlessly will make your job as a homeowner much easier, and allow
you to keep upgrading to the latest lifestyle technology.
3. Maximizing home security. When you incorporate security and surveillance features in your smart
home network, your home security can skyrocket. There are tons of options here -- only a few dozen
of which are currently being explored. For example, home automation systems can connect motion
detectors, surveillance cameras, automated door locks, and other tangible security measures
throughout your home so you can activate them from one mobile device before heading to bed. You
can also choose to receive security alerts on your various devices depending on the time of day an
alert goes off, and monitor activities in real-time whether you’re in the house or halfway around the
globe.
4. Remote control of home functions. Don’t underestimate the power of being able to control your
home’s functions from a distance. On an exceptionally hot day, you can order your house to become
cooler in just enough time before you get home from work. If you’re in a hurry to get dinner started
7
but you’re still at the store, you can have your oven start to preheat while you’re still on your way
home. You can even check to see if you left the lights on, who is at your front door, or make sure you
turned off all your media while you’re away.
5. Increased energy efficiency. Depending on how you use your smart-home technology, it’s possible
to make your space more energy-efficient. For example, you can have more precise control over the
heating and cooling of your home with a programmable smart thermostat that learns your schedule
and temperature preferences, and then suggests the best energy efficient settings throughout the day.
Lights and motorized shades can be programed to switch to an evening mode as the sun sets, or lights
can turn on and off automatically when you enter or leave the room, so you never have to worry
about wasting energy.
6. Improved appliance functionality. Smart homes can also help you run your appliances better. A
smart TV will help you find better apps and channels to locate your favorite programming. A smart
oven will assist you with cooking your chicken to perfection -- without ever worrying about
overcooking or undercooking it. An intelligently designed home theater and audio system can make
managing your movie and music collection effortless when entertaining guests. Ultimately,
connecting your appliances and other systems with automation technology will improve your
appliance effectiveness and overall make your home life much more easier and enjoyable!
7. Home management insights. There’s also something to be said for your ability to tap into insights
on how your home operates. You can monitor how often you watch TV (and what you watch), what
kind of meals you cook in your oven, the type of foods you keep in your refrigerator, and your
energy consumption habits over time. From these insights, you may be able to analyze your daily
habits and behaviors, and make adjustments to live the lifestyle you desire.
8. The objective of this is to develop safety and security system for our home
9. We are developing a plant watering system for our home to protect our plants from getting dry.
10. In project We are developing a water tank level monitoring system and to provide ease to human
to human ease
2.)PLANT WATERING MANAGEMENT SYSTEM: Had to ever planted a plant and forgot to
water it and it was dried and dead? yes it happens many times as we are involved in our tight daily
routine but we are higly interested in growing plants. in the other case, if you are a farmer and
growing a crop it is hard to know the status of the soil from home.
8
Taking it into consideration we are creating a automated plant water system which uses nodemcu
interfacing with a capacitive soil moisture indicating sensor and connecting them to water pump so
when is soil state becomes dry the water pump automatically starts and when the soil is wet the pump
will be turned off automatically.
3.) MOTION DETECTION SYSTEM: The project can be taken as a small security system and could
be installed in garage, garden(to check the presence of wild animals dogs, cats, pigs, birds etc),
house, pet house, shops and stores. Every body emits heat waves and heat waves contains infrared
rations. The more the body emitting heat the more the infrared radiations. Generally the living bodies
emit more heat than the raw materials. So pir sensor can be used to detect the motion of living bodies
and after detecting the motion, an alert is send on our smartphone.
4.)GAS LEAKAGE DETECTION SYSTEM: Liquefied Petroleum Gas which is popularly known as
LPG is a clean source of energy which is highly flammable and usually compressed into storage
tanks. Due to the flammable nature of LPG it can easily lead to uncontrollable explosions in the
presence of any ignition action or may lead to complete depletion of oxygen in a particular area. This
project is also focused on the fabrication of a system that would detect and monitor LPG gas leakages
for domestic gas cylinders. A MQ-2 gas sensor was used for the detection of LPG gas leakage and
flutter Application is build to show the alert on smartphone.
1.5 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 device 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 application, 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 technology friendly environment. The system incorporates the use of
technology. By the use of day to day gadgets we can utilize them for a different perspective.
9
• Information Gathering
ENVISIONED PHASE • Project Initiation
• Analysis of project
MODELLING PHASE • Design and architechture of project
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 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.
10
1.7 BENEFITS
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.
Integrable and extensive nature
The prototype designed can be integrated to a larger scale. Also it has an extensive nature being
able to add or remove the appliances under control according to application.
11
CHAPTER 2 : THEORY
2.1.1.1 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.
2.1.1.2 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 the
networking of smart things and applications.
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.
12
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 the number of connected
devices will reach 20.8 billion by 2020.
2.1.1.5 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.
2.1.1.6 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.
2.1.1.7 Security
IOT devices are naturally vulnerable to security threats. As we gain efficiencies, novel experiences,
and other benefits from the IOT, it would be a mistake to forget about security concerns associated
with it. There is a high level of transparency and privacy issues with IOT. It is important to secure
the endpoints, the networks, and the data that is transferred across all of it means creating a security
paradigm.
2.1.2.1 Communication
IOT encourages the communication between devices, also famously known as Machine-to-Machine
(M2M) communication. Because of this, the physical devices are able to stay connected and hence
the total transparency is available with lesser inefficiencies and greater quality.
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.
13
2.1.2.3 Information
It is obvious that having more information helps making better decisions. Whether it is mundane
decisions as needing to know what to buy at the grocery store or if your company has enough
widgets and supplies, knowledge is power and more knowledge is better.
2.1.2.4 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.
2.1.2.5 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.
2.1.2.6 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.
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.
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.
14
Optimum utilization of energy and resources can be achieved by adopting this technology and
keeping 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.
All the applications of this technology culminate in increased comfort, convenience, and better
management, thereby improving the quality of life.
2.1.3.1 Compatibility
Currently, there is no international standard of compatibility for the tagging and monitoring
equipment. I believe this disadvantage is the most easy to overcome. The manufacturing companies
of these equipment just need to agree to a standard, such as Bluetooth, USB, etc. This is nothing new
or innovative needed.
2.1.3.2 Complexity
As with all complex systems, there are more opportunities of failure. With the Internet of Things,
failures could sky rocket. 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 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 need a
single replacement.
2.1.3.3 Privacy/Security
With all of this IOT data being transmitted, the risk of losing privacy increases. For instance, how
well encrypted will the data be kept and transmitted with? Do you want your neighbours or
employers to know what medications that you are taking or your financial situation?
2.1.3.4 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 flavour 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 any and all
automation.
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 available
15
on it. This information is prone to attack by hackers. It would be very disastrous if private and
confidential information is accessed by unauthorized intruders.
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 of
any 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.
2.1.4.1 Wearables
Wearable technologies is 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.
This area of application concerned to this particular 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.
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
16
Figure 2. Working of IOT enables care devices.
2.1.4.4 Agriculture
For a higher return of investment this field requires both fast developments and quality of products.
This vitality thus coined the term IIOT. This whole schematic is re-engineered by IOT applications.
Following are the domains of IOT applications in industrial automation
17
• Factory Digitalization
• Product flow Monitoring
• Inventory Management
• Safety and Security
• Quality Control
• Packaging optimization
• Logistics and Supply Chain Optimization
IOT applied to government and safety allows improved law enforcement, defence, city planning, and
economic management. The technology fills in the current gaps, corrects many current flaws, and
expands the reach of these efforts. For example, IOT can help city planners have a clearer view of
the impact of their design, and governments have a better idea of the local economy.
Several communication protocols and technologies cater to and meet the specific functional
requirements of IOT system.
2.1.5.1 Bluetooth
2.1.5.2 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.
2.1.5.3 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 ZWave
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.
18
2.1.5.4 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 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.
2.1.5.5 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.
2.1.5.6 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 devices to share information at a distance that is less than 4cm.
2.1.5.7 LoRaWAN
LoRaWAN is one of popular IOT Technology, targets wide-area network (WAN) applications. The
LoRaWAN 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.
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.
19
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, machineto-
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.
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.
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.
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.
20
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.
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 luacjson 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.
[*] D0 (GPIO16) can only be used for GPIO read/write. It does not support
opendrain/interrupt/PWM/I²C or 1-Wire.
21
The ESP8266 Node MCU has total 30 pins that interface it to the outside world. The pins are
grouped by their functionality as:
Power pins: There are four power pins viz. one VIN pin & three 3.3V pins. The VIN pin can be used
to directly supply the ESP8266 and its peripherals, if you have a regulated 5V voltage source. The
3.3V pins are the output of an on-board voltage regulator. These pins can be used to supply power to
external components.
GND: is a ground pin of ESP8266 Node MCU development board.
12 IC Pins: are used to hook up all sorts of I2C sensors and peripherals in your project. Both I2C
Master and I2C Slave are supported. I2C interface functionality can be realized programmatically,
and the clock frequency is 100 kHz at a maximum. It should be noted that I2C clock frequency
should be higher than the slowest clock frequency of the slave device.
GPIO Pins: ESP8266 Node MCU has 17 GPIO pins which can be assigned to various functions
such as I2C, I2S, UART, PWM, IR Remote Control, LED Light and Button programmatically. Each
digital enabled GPIO can be configured to internal pull-up or pull-down, or set to high impedance.
When configured as an input, it can also be set to edge-trigger or level-trigger to generate CPU
interrupts.
ADC Channel: The Node MCU is embedded with a 10-bit precision SAR ADC. The two functions
can be implemented using ADC viz. Testing power supply voltage of VDD3P3 pin and testing input
voltage of TOUT pin. However, they cannot be implemented at the same time.
UART Pins: ESP8266 Node MCU has 2 UART interfaces, i.e. UART0 and UART1, which provide
asynchronous communication (RS232 and RS485), and can communicate at up to 4.5 Mbps. UART0
(TXD0, RXD0, RST0 & CTS0 pins) can be used for communication. It supports fluid control.
However, UART1 (TXD1 pin) features only data transmit signal so, it is usually used for printing
log.
SPI Pins: ESP8266 features two SPIs (SPI and HSPI) in slave and master modes. These SPIs also
support the following general-purpose SPI features:
SDIO Pins: ESP8266 features Secure Digital Input/output Interface (SDIO) which is used to directly
interface SD cards. 4-bit 25 MHz SDIO v1.1 and 4-bit 50 MHz SDIO v2.0 are supported.
PWM Pins: The board has 4 channels of Pulse Width Modulation (PWM). The PWM output can be
implemented programmatically and used for driving digital motors and LEDs. PWM frequency range
is adjustable from 1000 μs to 10000 μs, i.e., between 100 Hz and 1 kHz.
22
Control Pins: are used to control ESP8266. These pins include Chip Enable pin (EN), Reset pin
(RST) and WAKE pin.
• EN pin – The ESP8266 chip is enabled when EN pin is pulled HIGH. When pulled
LOW the chip works at minimum power.
• RST pin – RST pin is used to reset the ESP8266 chip.
• WAKE pin – Wake pin is used to wake the chip from deep-sleep.
23
There’s also 128 KB RAM and 4MB of Flash memory (for program and data storage) just enough to
cope with the large strings that make up web pages, JSON/XML data, and everything we throw at
IOT devices nowadays.
The ESP8266 Integrates 802.11b/g/n HT40 Wi-Fi transceiver, so it can not only connect to a Wi-Fi
network and interact with the Internet, but it can also set up a network of its own, allowing other
devices to connect directly to it. This makes the ESP8266 Node MCU even more versatile.
• 4 MB external flash
24
• Operating voltage 2.5V to 3.6V
• 80 mA operating current
The ESP8266 Node MCU has total 17 GPIO pins broken out to the pin headers on both sides of the
development board. These pins can be assigned to all sorts of peripheral duties, including:
As a result of the pin multiplexing feature (Multiple peripherals multiplexed on a single GPIO pin), a
single GPIO pin can act as PWM/UART/SPI.
25
Figure 8. GPIO pins on Node MCU development board.
The ESP8266 Node MCU features two buttons. One marked as RST located on the top left corner is
the Reset button, used of course to reset the ESP8266 chip. The other FLASH button on the bottom
left corner is the download button used while upgrading firmware. The board also has a LED
indicator which is user programmable and is connected to the D0 pin of the board.
Figure 9. ON board switches and LED indicators on Node MCU development board.
26
2.2.2.5 Serial Communication
The board includes CP2102 USB-to-UART Bridge Controller from Silicon Labs, which converts
USB signal to serial and allows your computer to program and communicate with the ESP8266 chip.
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 is 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.
27
2.3 BLOCK DIAGRAM
2.3.1 Block diagram of the proposed system
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.
28
2.3.2 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.
29
2.4.1 CIRCUIT DIAGRAM
Figure 14. Connection diagram of Node MCU controlling 4 channel relay module.
30
1.)MQ5 Gas Sensor:
31
3.)PIR Sensor / HC-SR501:
32
CHAPTER 3 : HARWARE MODELLING AND SETUP
Project
module
Hardware Flutter
module module
Node MCU is the microcontroller unit in the prototype. It has an in built Wi-Fi module (ESP8266) that
establishes wireless remote switching of home appliances.
33
Four channel relay module consists 4 individual relays physically connected between Node MCU and the
home appliances. It takes signals form GPIO pins of Node MCU and accordingly connects or disconnects
home appliances from the supply. They act as the switching device.
LED and resistors are used in this prototype to replace real appliances. They indicate power being turned on
and off to the appliances. In real time operation they would be replaced by actual home appliances.
Flutter application was designed for the Internet of Things. It can control hardware remotely, it can display
sensor data, it can store data, visualize it, etc. the prototype primarily uses Flutter application to sense
commands from user to the hardware over wireless network.
34
Features:
• Wide detecting scope
• Stable and long life
• Fast response and High sensitivity
Applications:
1 Gas leakage detection.
2 Toys.
35
3.7 PIR Sensor / HC-SR501:
The HC-SR501 auto-senses light in various applications (in house, basement, outdoor, warehouse,
garage, etc,) for ventilator control, alarm, etc.
Features:
• Automatic infrared detection (LHI778 probe design)
Output goes high when objects enter the sensing range, and automatically returns to low when object
leaves
• Optional photosensitive control
• Optional temperature compensation
• Trigger mode jumper
• L: Non-repeatable / delay mode: sensor goes low after the delay, regardless of the presence of the
object.
• H: Repeatable: sensor stays high as long as any object is detected during the delay time.
• Wide operating voltage range
• Micro-amp power
• Output high signal: easy to achieve docking with the various types of circuit.
• Infrared technology (LHI778 probe design)
• high sensitivity | high reliability
36
HC-SR501 PIR Motion Sensor Module
This is Soil Moisture Meter, Soil Humidity Sensor, Water Sensor, Soil Hygrometer for Ardunio.
With this module, you can tell when your plants need watering by how moist the soil is in your pot,
garden, or yard. The two probes on the sensor act as variable resistors. Use it in a home automated
watering system, hook it up to IoT, or just use it to find out when your plant needs a little love.
Installing this sensor and its PCB will have you on your way to growing a green thumb!
37
The soil moisture sensor consists of two probes which are used to measure the volumetric content of
water. The two probes allow the current to pass through the soil and then it gets the resistance value
to measure the moisture value.
When there is more water, the soil will conduct more electricity which means that there will be less
resistance. Therefore, the moisture level will be higher. Dry soil conducts electricity poorly, so when
there will be less water, then the soil will conduct less electricity which means that there will be more
resistance. Therefore, the moisture level will be lower.
Features
1.) Dual output mode, analog output more accurate
2.) A fixed bolt hole for easy installation
3.) With power indicator (red) and digital switching output indicator (green)
4.) Having LM393 comparator chip, stable.
3.9.1 Firebase:
Firebase can power your app's backend, including data storage, user authentication, static
hosting, and more. Focus on creating extraordinary user experiences. We will take care of
the rest. Build cross-platform native mobile and web apps with our Android, iOS, and
JavaScript SDKs. You can also connect Firebase to your existing backend using our server-
side libraries or our REST API.
Firebase Features
Real-time Database − Firebase supports JSON data and all users connected to it
receive live updates after every change.
Authentication − We can use anonymous, password or different social
authentications.
Hosting − The applications can be deployed over secured connection to Firebase
servers.
Firebase Advantages
It is simple and user friendly. No need for complicated configuration.
The data is real-time, which means that every change will automatically update
connected clients.
Firebase offers simple control dashboard.
There are a number of useful services to choose.
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.
38
• 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.
To begin with the latest Arduino IDE version, we’ll need to update the board manager with a custom
URL. Open up Arduino IDE and go to File > Preferences. Then, copy below URL into the Additional
Board Manager URLs text box situated on the bottom of the
window: http://arduino.esp8266.com/stable/package_esp8266com_index.json
39
Figure 18. ESP8266 board installation in Arduino IDE.
Before we get to uploading sketch & playing with LED, we need to make sure that the board is selected
properly in Arduino IDE. Open Arduino IDE and select Node MCU 0.9 (ESP-12 Module) option under your
Arduino IDE > Tools > Board menu.
40
Figure 20. Assigning communication port on Arduino IDE.
• Now, we’ll set up the Arduino IDE by changing some settings. So, open up the
Arduino IDE. Select Tools > Board and select ‘NodeMCU 1.0 (ESP-12E Module)’ as
the board. And that’s all the settings we need to change. So now we begin writing the
code.
• Select Files > Examples > Blynk > Boards_WIFI > ESP8266_Standalone. A new file
with some prewritten code opens. The following changes to the code are made.
1. The line which says ‘char auth[] = “YourAuthToken”, replace YourAuthToken part
with your Blynk’s authentication token that was generated by the Blynk server.
2. The line which says char ssid[] = “YourNetworkName”, replace
YourNetworkName part with the name of Wi-Fi network that the Node MCU must
connect to.
3. The line where it says char pass[] = “YourPassword” and replace the
YourPassword part with the password of the Wi-Fi network.
41
Figure 21. Code in Arduino IDE to be installed to Node MCU.
• The code is ready to be uploaded to the hardware. On clicking upload button, the
code is uploaded to Node MCU and the next time it’s powered on, it automatically
connects to the assigned Wi-Fi network.
42
Figure 24. Node MCU & 4 channel relay connection.
In this prototype instead of real home appliances, we connect the relays to LEDs,
(according to circuit diagram) to just ensure the functionality of the prototype. The
prototype is given a supply from a 9V battery.
43
CHAPTER 4 : LOGIC AND OPERATION
This flow chart shows the working of the project. The process starts be initializing the Wi-Fi, the
network name and password are written in the code and uploaded to Node MCU. The android device
is connected to Node MCU over Wi-Fi. The firebase server is set up and connection is made, the
devices is identified in the firebase server using the generated authentication token. The command
for controlling the load is given to the application, and this command, over Wi-Fi network is sent to
the Node MCU.
Node MCU is an open source IOT platform. It includes firmware which runs on the ESP8266 Wi-Fi
SoC from Espressif Systems, and hardware which is based on the ESP-12 module. The term “Node
MCU” by default refers to the firmware rather than the development kits. The firmware uses the Lua
scripting language. It is based on the eLua project, and built on the Espressif Non-OS SDK for
ESP8266.
44
It uses many open source projects, such as lua-cjson, and spiffs.
• Low cost, the Node MCU is less costly compared to any other IOT based device.
• Node MCU has Arduino Like hardware I/O. It is becoming very popular in these days that
Arduino IDE has extended their software to work in the field of ESP 8266 Field module
version.
• Node MCU has easily configurable network API.
• Integrated support for Wi-Fi network: ESP 8266 is incorporated in Node MCU, which is an
easily accessible Wi-Fi module.
• Reduced size of board.
• Low power consumption.
• The operation of the circuit depends on the working internet connection. If the working
internet connection is not available then it will not run.
• Node MCU also depends on the free server provided by the third party, if the free server is
not working then it will not run.
• Node MCU has less resources of official documentation
The prototype aims to wireless control over home appliances with the technology of IOT. As
discussed earlier, IOT supports various wireless communication protocols, like Bluetooth, Z-Wave,
Zigbee etc. this prototype uses Wi-Fi as wireless communication network to establish remote access
over home appliances. This is because Wi-Fi has its own advantages over other wireless
communication protocols.
45
Advantages of Wi-Fi over other wireless technologies like Bluetooth and ZigBee
Bluetooth is generally used for point to point networks and Bluetooth operates at a much
slower rate of around 720 Kbps which is very small for video transfer or moving large amount of
data like the image captured from a camera, whereas the bandwidth of Wi-Fi can be up to 150Mbps
and very ideal for video transmission.
Wi-Fi connection to send video, audio, and telemetry operation, while accepting remote control
commands from an operator who can be located virtually anywhere in the world.
Frequency band 2.4 GHz 3.1-10.6 GHz 868/915 MHz; 2.4 GHz; 5 GHz
2.4 GHz
Data protection 16-bit CRC 32-bit CRC 16-bit CRC 32-bit CRC
Table 3. Comparison chart of Wi-Fi with other wireless communication protocols.
46
47
48
4.4.2 Screenshot of real time database:
49
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.The switch mode successfully
achieved. The Flutter application was also successful in connecting with firebase, controlling the
electric devices and displaying the status of every application.
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
5.3 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.
CHAPTER 6 : REFFERENCES
50
1. Wikipedia(2009). HomeAutomation. From https://en.wikipedia.org/wiki/Home_automation
51
52
4.4.2 Screenshot of real time database:
53
CHAPTER 5 : CONCLUSION AND FUTURE SCOPE
54
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.The switch mode successfully
achieved. The Flutter application was also successful in connecting with firebase, controlling the
electric devices and displaying the status of every application.
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
5.3 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.
CHAPTER 6 : REFFERENCES
55
2. Theory of IOT from :https://internetofthingsagenda.techtarget.com/definition/Internet-of-
Things-IoT
56