Documente Academic
Documente Profesional
Documente Cultură
Overview of project
1.1 Introduction
The Internet of Things (IoT) is becoming popular with research and industries.
The basic idea is that IoT will connect objects around us (electronic and electrical) to
provide seamless communication and contextual services provided by them. The
objective of this paper is to build Home automation using IoT using ESP8266 Wi-Fi
module and control it wirelessly using the smart phone. The forces that are driving it and
the benefits that are motivating it are increasingly numerous. The number of connected
devices on the IoT network will be huge. One estimate says that the number will be
nearly 40 billion, which is approximately 30 devices for each and every active social
network user in the world.
The main objective of this system is to automate the home appliances using
NodeMCU board which is being controlled by an android app through internet. This
reduces the manual work and reduces the power wastage.
1.3. Methodology
The problems that surfaced during the project were selecting the right kind of device
and interfacing these devices appropriately. The approach used was to minimize costs and
complexity and at the same time not sacrifice the objectives of the project.
Hardware Specifications:
NodeMCU
Relay Module
1
Software Specifications:
Arduino IDE
Language: Embedded C or Assembly Language
1.4. Significance of the project
To control the electronic devices through android mobile device via wifi module.
2
CHAPTER 2
Hardware Description
2.2.1. Introduction
NodeMCU is an open source development board and firmware based on the
widely used ESP8266 -12E WiFi module. It allows you to program the ESP8266 WiFi
module with the simple and powerful LUA programming language or Arduino IDE.
With just a few lines of code WiFi connection can be established and input/output
pins should be defined according to user needs exactly like arduino, turning ESP8266 into
a web server and a lot more. It is the WiFi equivalent of ethernet module. Now internet of
things (IoT) real tool is implemented.
With its USB-TTL , the NodeMCU Dev board supports directly flashing from
USB port. It combines features of WIFI accesspoint and station + microcontroller. These
features make the NodeMCU extremly powerful tool for Wifi networking. It can be used
as access point and/or station, host a webserver or connect to internet to fetch or upload
data.
3
2.2.2. Pin Diagram
While writing GPIO code on NodeMCU, addressing cant be done with actual
GPIO Pin Numbers. There are different I/O Index numbers assigned to each GPIO Pin
which is used for GPIO Pin addressing. Refer following Fig 2.3 to check I/O Index of
NodeMCU GPIO Pins –
NodeMCU has general purpose input output pins on its board as shown in above
pinout diagram. It can be made digital high/low and control things like LED or switch on
it. Also, PWM signal on these GPIO pins can also be generated.
4
Fig 2.3. pin specification of NodeMCU
NodeMCU based ESP8266 has Hardware SPI (HSPI) with four pins available for
SPI communication. It also has SPI pins for Quad-SPI communication. With this SPI
interface, any SPI enabled device can be connected with NodeMCU and make
communication possible with it.
5
I2C (Inter-Integrated Circuit) Pins:
Node MCU has I2C functionality support on ESP8266 GPIO pins. Due to internal
functionality on ESP-12E and all its GPIOs cannot be used for I2C functionality. So, do
tests before using any GPIO for I2C applications.
NodeMCU based ESP8266 has two UART interfaces, UART0 and UART1. Since
UART0 (RXD0 & TXD0) is used to upload firmware/codes to board, they can‟t be used
in applications while uploading firmware/codes.
2.2.3. Features
7
Set of easy-to-use Widgets
Direct pin manipulation with no code writing
Easy to integrate and add new functionality using virtual pins
History data monitoring via History Graph widget
Device-to-Device communication using Bridge Widget
Sending emails, tweets, push notifications, etc.
2.3.4.1. Hardware
An Arduino, Raspberry Pi, NodeMCU or a similar development kit.Blynk works over the
Internet. This means that the hardware chosen should be able to connect to the internet.
Some of the boards, like Arduino Uno will need an Ethernet or Wi-Fi Shield to
communicate, others are already Internet-enabled: like the ESP8266, Raspberri Pi with
WiFi dongle, Particle Photon or SparkFun Blynk Board.
2.3.4.2. A Smartphone
The Blynk App is a well designed interface builder. It works on both iOS and
Android. Blynk app should be installed in smart phone.
8
2.3.5. Procedure to interface android app with NodeMCU
Create a Blynk Account
After downloading the Blynk App, new Blynk account need to be created. This
account is separate from the accounts used for the Blynk Forums.It is recommended to
use a real email address because it will simplify things later.
9
Give it a name.
10
Auth Token
It is a unique identifier which is needed to connect our hardware to our
smartphone. Every new project created will have its own Auth Token. Auth Token
automatically appears on email after project creation. It can also be copied manually.
Click on devices section :
14
Upload the sketch to the board and open Serial Terminal. Wait until something like this is
found:
Blynk v.X.X.X
Your IP is 192.168.0.11
Connecting…
Blynk connected!
Go back to the Blynk App, push the button and turn the LED on and off! It should be
Blynking.
16
2.4.3. Specifications
VCC: 5V DC
COM: 5V DC
IN1: high/low output
IN2: high/low output
GND: ground
2.4.4. Basic design
A simple electromagnetic relay consists of a coil of wire wrapped around a soft
iron core (a solenoid), an iron yoke which provides a low reluctance path for magnetic
flux, a movable iron armature, and one or more sets of contacts (there are two contacts in
the relay pictured). The armature is hinged to the yoke and mechanically linked to one or
more sets of moving contacts. The armature is held in place by a spring so that when the
relay is de-energized there is an air gap in the magnetic circuit. In this condition, one of
the two sets of contacts in the relay pictured is closed, and the other set is open. Other
relays may have more or fewer sets of contacts depending on their function. The relay in
the picture also has a wire connecting the armature to the yoke. This ensures continuity of
the circuit between the moving contacts on the armature, and the circuit track on
the Printed Circuit Board (PCB) via the yoke, which is soldered to the PCB.
2.4.5.Working
Relay acts as an electromagnetic switch which acts as a medium between Node
MCU board and AC devices. As per the programming, the loads are turned on and off
17
with the help of relays. Relays controls the voltage supply given to loads. When relay
switch is closed, load turns ON.When relay switch is opened, load turns OFF.
2.4.6. Applications
Relays are used wherever it is necessary to control a high power or high voltage
circuit with a low power circuit, especially when galvanic isolation is desirable.
The first application of relays was in long telegraph lines, where the weak signal
received at an intermediate station could control a contact, regenerating the signal
for further transmission. High-voltage or high-current devices can be controlled
with small, low voltage wiring and pilots switches. Operators can be isolated from
the high voltage circuit. Low power devices such as microprocessors can drive
relays to control electrical loads beyond their direct drive capability. In an
automobile, a starter relay allows the high current of the cranking motor to be
controlled with small wiring and contacts in the ignition key.
As relays are much more resistant than semiconductors to nuclear radiation, they
are widely used in safety-critical logic, such as the control panels of radioactive
waste-handling machinery. Electromechanical protective relays are used to detect
overload and other faults on electrical lines by opening and closing circuit
breakers.
2.4.7. Conclusion
Isolate controlling circuit from controlled circuit
Control high voltage system with low voltage
Control high current system eith low current
Safety is increased
Protective relays are essential for keeping the faults in the system isolated and
keep equipment from not being damaged
Electromgnetic relays are best suitable for high frequency switching applications
and do have a limited life due to wear on the contacts inside the relay.
18
CHAPTER 3
Software Description
19
Open source and extensible software - The Arduino software is published as
open source tool and the language can be expanded through C++ libraries.
Node MCU Dev Board is based on widely explored esp8266 System on Chip
from Expressif. It combined features of WIFI accesspoint and station + microcontroller
and uses simple LUA based programming language. ESP8266 Node MCU offers-
10 GPIOs D0-D10, PWM functionality, IIC and SPI communicaiton, 1-Wire and
ADC A0 etc. all in one board
Wifi networking (can be uses as access point and/or station, host a webserver),
connect to internet to fetch or upload data.
Recently, there has been interest in programming ESP8266 systems using Arduino IDE.
Programming, of ESP8266 using Arduino IDE is not very straight forward, until it is
properly configured. Especially because, the Input and output pins have different
mapping on NodeMCU than those on actual ESP8266 chip.
* The ESP8266 chip requires 3.3V power supply voltage. It should not be powered with 5
volts like other arduino boards.
* The I/O pins of ESP8266 communicate or input/output max 3.3V only. i.e. the pins
are NOT 5V tolerant inputs.
The pin mapping of NodeMCU dev board are different from those of ESP8266 GPIOs.
20
Step 1: NodeMCU ESP-12E Pin Mapping
Blynk Server - responsible for all the communications between the smartphone and
hardware. You can use our Blynk Cloud or run your private Blynk server locally. It‟s
open-source, could easily handle thousands of devices and can even be launched on a
Raspberry Pi.
Blynk Libraries - for all the popular hardware platforms - enable communication with
the server and process all the incoming and outcoming commands.
4. Breadboard
22
Step 4: Setting Up Blynk With Arduino IDE
2. Once the Zip file is downloaded ,extract it and individually copy all the folder to your
libraries folder of your arduino.
23
Fig 3.4. Selection of NodeMCU module in Aurdino IDE
3. Once done just open Arduino IDE and go to Sketch-> Include libraries and blynk in
the menu is observed.
For example go to Tools->Board Menu list of boards is found. All this boards
listed have different configuration settings. Therefore NodeMCU's board configurations
should also be included which typically contain the board architecture , clock speed, baud
rate etc.
Now Copy the below link and paste it in the Additional Boards Manager Url text box
http://arduino.esp8266.com/stable/package_esp8266c...
24
Now after restarting the Arduino IDE , go to Tools->Boards and select Node MCU board
, mine was version 0.9
3. Then go to File->Eamples->Blynk-Boards_Wifi->Esp8266Standalone
4. Select the correct board (NodeMCU 1.0) and the com port from the Tools Menu
Blynk.begin(auth, "ssid", "pass"); // Enter Wifi SSID and password, both inside the
double quotation
25
4. Then you would see your dashboard with a button
5. Press Play button on the top most right corner of the app
6. Press the Button and you would see the LED Turn ON!!
Conclusion
26
CHAPTER 4
Project Description
4.1. Introduction
The load can be controlled and monitored using a mobile application with user
configurable front end. The user can send commands through the allotted IP and these
27
commands are fed to Wi-Fi module. The Wi-Fi module is configured to access internet
using any nearby wireless modem. The commands received by a Wi-Fi module are
executed by a program within a Wi-Fi module. The Wi-Fi module is interfaced to voltage
relays through the loads are turned ON & OFF based on commands. The load status (ON
or OFF) will be displayed in the dashboard of app. The platform which is used for
programming the NodeMCU board is Arduino IDE software. NodeMCU board has to be
installed in boards manager in arduino app.
4.3 Conclusion
This project helps in controlling the electronic appliances through internet using
NodeMCU board with an android app. This results in efficient usage of devices.
28
CHAPTER 5
5.1. Advantages
Contributes to Economy.
Programming is simpler.
DISADVANTAGES
5.2. APPLICATIONS
5.3. Conclusion
Thus home automation helps to keep the appliances safe, as well as helps to know
what they are up to each day, which can be quite helpful for a busy parent. In sum,
investing in a home automation system will benefit in several ways. It is cost effective. It
will save time and energy. And perhaps the most important it will keep the home secure.
30
CHAPTER 6
Results
Description
Conclusion
Hence the home automation using IoT is achieved with the help of mobile application and
Node MCU board. In this way wireless communication is also achieved.
31
Future Scope
In future, apart from controlling the electronic appliances from distant places
secured environment can also be acheived .For long range wireless communication WIFI-
module can be used.
32
References
[1] Andrea Zanella, Nicola Bui, Angelo Castellani, Lorenzo Vangelista, Michele Zorzi,
“Internet of Things for Smart Cities,” in IEEE Internet Of Things Journal, February,2014.
[2] 9Sean Dieter, Tebje Kelly, Nagender Kumar Suryadevara, and Subhas Chandra
Mukhopadhyay, “Towards the Implementation of IoT for Environmental Condition
Monitoring in Home” in IEEE Sensors Journal, 2013.
[3] Nikhil Singh, Shambhu Shankar Bharti, Rupal Singh, Dushyant Kumar Singh,
"Remotely controlled home automation system", Advances in Engineering and
Technology Research (ICAETR), International Conference on. IEEE, 2014
33
Appendix
Software Description
The Arduino project provides the Arduino integrated development environment (IDE),
which is a cross-platform application written in the programming language Java. It
originated from the IDE for the languages Processing and Wiring. It includes a code
editor with features such as text cutting and pasting, searching and replacing text,
automatic indenting, brace matching, and syntax highlighting, and provides simple one-
click mechanisms to compile and upload programs to an NodeMCU board. It also
contains a message area, a text console, a toolbar with buttons for common functions and
a hierarchy of operation menus.
A program written with the IDE for NodeMCU is called a sketch. Sketches are saved on
the development computer as text files with the file extension. Arduino Software (IDE)
pre-1.0 saved sketches with the extension.
The Arduino IDE supports the languages C and C++ using special rules of code
structuring. The Arduino IDE supplies a software library from the Wiring project, which
provides many common input and output procedures. User-written code only requires two
basic functions, for starting the sketch and the main program loop, that are compiled and
linked with a program stub main() into an executable cyclic executive program with
the GNU toolchain, also included with the IDE distribution. The Arduino IDE employs
the program avrdude to convert the executable code into a text file in hexadecimal
encoding that is loaded into the Arduino board by a loader program in the board's
firmware.
Due to the company's open source nature, there exist many free public libraries for
developers to use to augment their projects.
34
Code used to control the bulb
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
void setup()
Serial.begin(9600);
void loop()
Blynk.run();
Conclusion
Hence by using this application and code it has been possible to control the
electronic appliances.
35