You are on page 1of 80

A

PROJECT REPORT
ON

IOT BASED HOME AUTOMATION


By

MOHD SHADAB
(Roll no 1601720010)
MOHIT
(Roll no 1601720011)
PRATIBHA RANI
(Roll no 1501720018)
Submitted to the Department of Electrical Engineering

In Partial Fulfillment of the Requirements


For the Degree of

BACHELOR OF TECHNOLOGY
In
Electrical Engineering

K.S.VIRA COLLEGE OF ENGG. & MANAGEMENT,


BIJNOR

DR. A P J ABDUL KALAM TECHNICAL UNIVERSITY


LUCKNOW

August, 2020

Project Guide Head of Department

Mr. Lokesh Kumar Agrawal Mr. Manoj Kumar Kushwaha


CERTIFICATE

This is to certify that Project Report entitled “ IOT BASED HOME AUTOMATION ”
which is submitted by Mohd Shadab, Mohit ,Pratibha rani in partial fulfillment of the
requirement for the award of degree B. Tech. in Department of Electrical Engineering
of Dr. A P J Abdul Kalam Technical University, Lucknow is a record of the candidate’s
own work carried out by her under my supervision. The matter embodied in this thesis is
original and has not been submitted for the award of any other degree.

Date: supervisor

i
DECLARATION

We hereby declare that this submission is my own work and that, to the best of my
knowledge and belief, it contains no material previously published or written by another
person nor material which to a substantial extent has been accepted for the award of any
other degree or diploma of the university or other institute of higher learning, except
where due acknowledgment has been made in the text.

Signature :

MOHD SHADAB
Roll No (1601720010).

Date :

Signature :

MOHIT
Roll No (1601720011)

Date :

Signature :

PRATIBHA RANI
Roll No (1501720018)

Date :

ii
ABSTRACT

This project presents a design and prototype implementation of new home automation
system that uses Wi-Fi technology as a network infrastructure connecting its parts.

The proposed system consists of two main components; the first part is the server (web
server) which presents system core that manages, controls, and monitors users’ home.

Users and system administrator can locally (LAN) or remotely (internet) manages and
control system code. Second part is hardware interface module, which provides
appropriate interface to sensors and actuator of home automation system.

Unlike most of available home automation system in the market the proposed system is
scalable that one server can manage many hardware interface modules as long as it exists
on Wi-Fi network coverage. System supports a wide range of home automation devices
like power management components, and security components. The proposed system is
better from the scalability and flexibility point of view than the commercially available
home automation systems.

iii
ACKNOWLEDGEMENT

Although this project prominently bears my name, it really is the result of the
collaborative efforts of a number of people who have discussed, encouraged, cajoled and
otherwise supported me, through successes and failures to its ultimate publication. At
first, I would like to thank my parents and God for their blessings.

I express my heart-felt gratitude to my Head of Department of electrical engineering


Mr. Manoj Kumar kushwaha , Kunwar Satya Vera college of engineering and
management Bijnor , for his invaluable guidance, and support throughout this project
work. His encouragement and constructive comments were very helpful for me to go
ahead in this project.

I sincerely extend my thanks to my guide Mr. Lokesh Kumar agrawal , project


coordinator ,Kunwar Satya Vera college of engineering and management Bijnor for
his guidance and co-operation. Also , I owe a debt of gratitude to all my friends who
directly or indirectly supported me throughout my work.

Signature:
Name : MOHD SHADAB
Roll No.: 1601720010
Date :

Signature :
Name : MOHIT
Roll No : 1601720011
Date :

Signature:
Name : PRATIBHA RANI
Roll No : 1501720018
Date

iv
LIST OF TABLES

Table No. Title Page No.

Table 1.1 Comparison of different communication module 3

Table 2.1 Digital input output pin 12

Table 3.1 Relay pin and pin name 16

Table 3.2. Relay pin description 17

Table 10.1 IP address and their respective priority 52

Table 10.2 Range of IP address 52

Table 10.3 Number of network 53

v
LIST OF FIGURES

Fig. No. Title Page No. Page No.

Fig. 2.1 ESP 8266 Node MCU WI-FI 7

Fig. 2.2 Node MCU description 8

Fig. 2.3 Pin output configuration 9

Fig. 2.4 Node MCU devkit - 19

Fig 2.5 ESP 12-E 10

Fig 2.6 ESP8266 EX 11

Fig. 2.7 ESP-12E Pin out 11

Fig. 2.8 Boot 12

Fig. 3.1 Relay board 14

Fig.3.2 Relay 16

Fig. 3.3 Relay internal structure 17

Fig. 3.4 Relay pin out 18

Fig. 3.5 (a) Relay is initial condition ; (b) Relay is energized 19

Fig. 4.1 Transformer 21

Fig. 4.2 Equivalent circuit 23

Fig. 5.1 Characteristic of a P-N junction diode (not to scale) 24

Fig. 5.2 Single phase full wave converter 29

Fig. 5.3 Voltage & current single phase full wave rectifier 30

Fig. 6.1 Transistor 31

vi
Fig. 6.2 Bipolar transistor 32

Fig. 6.3 NPN transistor configuration 32

Fig. 6.4 Switching saturation 33

Fig. 7.1 Carbone resistance with the some physical size indicating power 37
rating of 1/2 w.

Fig. 7.2 Resistance color code 39

Fig. 9.1 Alt text 46

Fig. 9.2 Alt text 47

Fig. 9.3 Alt text 48

Fig. 9.4 Alt text 48

Fig. 9.5 Alt text 49

Fig. 9.6 Alt text 50

Fig. 11.1 Application of blynk 56

Fig. 11.2 Create new project 56

Fig. 11.3 Blynk logging 57

Fig. 11.4 Serial port connected 58

Fig. 11.5 Program coding upload 59

vii
TABLE OF CONTENTS PAGE NO.

CERTIFICATE i
DECLARATION ii
ABSTRACT iii
ACKNOWLEDGEMENT iv
LIST OF TABLES v
LIST OF FIGURES vi

CHAPTER 1: INTRODUCTION 1-6

1.1 INTRODUCTION 1
1.2 OBJECT OF PROJECT 2
1.3 SCOPE OF PROJECT 2
1.4 DIFFERENCE COMMUNICATION MODULE 2
1.5 OVERVIEW 3
1.6 SYSTEM DESIGN 4
1.7 OUTLINE OF THESIS 4

CHAPTER 2: WI-FI MODULE 7-13

2.1 INTRODUCTION 7
2.2 NODE MCU 8
2.3 PIN DEFINATION 9
2.4 NODE MCU DEVKIT-1 9
2.5 ESP -12E 10
2.6 ESP 8266 EX 10
2.7 NODE MCU 1.0 ESP-12 PIN OUT 11
2.7.1 ESP-12E PINOUT 11
2.7.2 BOOT 12
2.8 INPUT OUT 12
2.9 POWER NODE 13
2.10 SPECIFICATION 13

CHAPTER 3: RELAY BOARD 14-20

viii
3.1 INTRODUCTION 14
3.2 MAIN VOLTAGE CONNECTION 15
3.2.1 COMMON PIN 15
3.2.2 PIN WIRING 15
3.3 RELAY 15
3.4 RELAY PIN 16
3.5 RELAY PIN DISCRIMINATION 16
3.6 RELAY INTERNAL STRUCTURE 17
3.7 RELAY PIN OUT 17
3.8 RELAY WORKING PRINCIPLE 18
3.9 RELAY MODULE WITH ESP 8266 WIFI MODULE 20

CHATER 4: TRANSFORMER 21-24

4.1 INTRODUCTION 21
4.2 WORKING PRINCILPE OF TRANSFORMER 22
4.3 INDUCTION LOW 22
4.4 IDEAL POWER EQUATION 23
4.5 GENRAL DISCRIPTION 23
4.6 PRODUCT DISCRIPTION 24
4.7 FEATURE 24

CHAPTER 5: DIODE 25-30

5.1 INTRODUCTION 25
5.2 SEMICODUCTOR DIODE 25
5.3 CURRENT VOLTAGE 26
5.4 RECTIFIRE 28
5.5 FULL WAVE RECTIFIRE 28

CHAPTER 6: TRANSISTER 31-34

6.1 INTRODUCTION 31
6.2 BIPOLER TRANSISTER CONSTRUCTION 31
6.3 NPN TRANSISTER 32
6.4 TRANSISTER CONFIGURATIO 32
6.5 TRANSISTER AS A SWITCH 33

CHAPTER 7: RESISTENCE 36-39


ix
7.1 INTRODUCTON 36
7.2 LOADING EFFECT 37
7.3 CARBON COMPOSITION 37
7.4 1KΩ(1/2W) COLOR CODING RESISTANCE 38
7.5 100Ω(1/2) COLOR CODING RESISTANCE 38
7.6 ZERO OHM RESISTANCE 38
7.7 POWER RATTING OF RESISTANCE 38
7.8 POWER DISSIPIATION 38
7.9 RESISTANCE COLOR CODE CHART 39

CHAPTER 8: SOWFTWERE 40-44

8.1 PROGRAM 40

CHAPTER 9: WI-FI INTERNET CONNECTION 45-50

9.1 INTRODUCTION 45
9.2 WIFI LIBRARY 45
9.3 QUICK SHORT 46
9.4 WHO IS WHO 47
9.5 CLASS DISCRIPTION 48
9.5.1 STATION 48
9.5.2 SOFT ACESS POINT 49
9.5.3 SEVER 50

CHAPTER 10: IP ADRESSS 51-54

10.1 INTRODUCTION 51
10.2 ASSINING IP ADRESS 51
10.3 IP ADRESS CLASIFICATIO 51
10.4 FIND THE RANGE OF CLASS 52
10.5 SUBNET MASK 52
10.6 TYPE OF IP ADRESS 53
10.6.1 PUBLIC IP ADRESS 53
10.6.2 PRIVET IP ADRESS 54
10.7 HTTP SERVER 54
10.8 REQUIRMENT 54
10.8.1 ARDUINO 54
10.8.2 ADVANCE UPDATE 54
x
CHAPTER 11: BLYNK APP 55-59

11.1 INTRODUCTION 55
11.2 CONTROLLING WIFI WITH SMART PHONE 55
11.3 DOWNLOAD BLYNK & INSTALLED 56
11.4 CODING THE ESP 8266 MLDULE 57

BUDGET 60-61
ADVANTAGES 62
CONCLUSION 63
REFRENCE 64-65

xi
CHAPTER 01

INTRODUCTION

1.1 INTRODUCTION

Home automation refers to handling and controlling home appliances by using micro-
controller or computer technology. Automation is popular now days because it provides
ease, security and efficiency.
This IOT smart home automation systems are trying to achieve comfort combined with
simplicity. Wireless Home security and Home automation are the dual aspects of this
project. One of the main advantage of this IOT is even though Wi-Fi is not available we
can go through 3G or 4G services. In other existing methods it is not possible so, by
overcoming all the drawbacks we have implemented a project IOT based Smart security
and Smart Home Automation. This project provides more comfort combined with
simplicity. The project aims at designing an advanced home automation system using
normal web server and Wi-Fi technology. The devices can be switched ON/OFF and
sensors can be read using a Personal Computer (PC) and mobile phone through Wi-Fi.
Automation is the most frequently spelled term in the field of electronics. The hunger for
automation brought many revolutions in the existing technologies. These had greater
importance than any other technologies due to its user-friendly nature. These can be used
as a replacement of the existing switches in home which produces sparks and also results
in fire accidents in few situations. Considering the advantages of Wi-Fi an advanced
automation system was developed to control the appliances in the house. Wi-Fi (Short
for Wireless Fidelity) is a wireless technology that uses radio frequency to transmit data
through the air. Wi-Fi has initial speeds of 1mbps to 2mbps. Wi-Fi transmits data in the
frequency band of 2.4 GHz. It implements the concept of frequency division
multiplexing technology. The controlling device for the automation in the project is a
ESP 8266. The data sent from PC and mobile over Wi-Fi will be received by Wi-Fi
module connected to relay board. relay take the signal and decides the switching action
of electrical devices. The goal of this project is to develop a home automation system
that gives the user complete control over all remotely controllable aspects of his or her
home. One of the main advantage of this IOT is even though Wi-Fi is not available we
can go through 3G or 4G services. In other existing methods it is not possible so, by
overcoming all the drawbacks we have implemented a project IOT based Smart security
and Smart Home Automation. This project provides more comfort combined with
simplicity.

1
1.2 OBJECTIVE OF PROJECT

The automation system will have the ability to be controlled from a central host PC, the
Internet, and also remotely accessed via a Pocket PC with a Windows Mobile based
application.

1.3 SCOPE OF PROJECT

Day by day, the field of automation is blooming and these systems are having great
impact on human beings. The project which is to be implemented is a home automation
using Easy IOT Web server and WIFI and has very good future development. In the
current system web server is installed on a windows PC so the home appliances can be
controlled using only by using the device on which web server is installed.

This can be further developed installing web server on cloud .Advantage of installing
web server on the cloud is that home can be controlled by using any device which has
WIFI 802.1 and a web browser. By visiting the IP address of the cloud the control
actions can be taken.

1.4 DIFRENT COMMUNICATION MODULE

Home automation is a challenging one not only to the developer but also to the
consumer. Developer has to choose the component as per the customer requirement. Due
to all the customer demands are not equal hence they have to compromise with the
existing products.

Through detailed study of “Home Automation Using Internet of Thing it is found that
they have used Raspberry pi module to connect ESP8266-01 module to the internet.
Through this module they are controlling various devices through web page and also
through android application. K. Venkatesan in their paper have implemented Zigbee
module in Arduino mega through which they are controlling devices. They have used
various sensors for various purpose. Also they have provided real time notification,
feedback on web-server in which customers can see what is happening in their home [1].
With the help of logic gates, a Raspberry pi, 555 timer and flip-flop also the devices are
controlled from web app. report proposed by Shashank Shiva Kumar Jha, Vishwateja
Mudiam Reddy, Tapan Pokharna, Naresh Vinay shows how this is operated and
controlled Programmable Infrared Accessory Light Switch” by Warsuzarina Mat Jubadi
and Normaziah Zulkifli shows how TV remote is used to control room light and other
appliances. Here IR remote and one IR receiver is used and programmed in such a way
that it stores the frequency of the existing remote and use them directly to control
appliances . So, here we introduce Arduino Uno with ESP8266-01 module. This is not
only cost-effective but also prove to be the easiest one when it comes in term of
programming and also implementation

2
Available IEEE Network Maximum Data Rate Maximum Cost
technology Standard Topology Power Range
Consumption (in meter)
(in mW)
Bluetooth 802.15.1 One to 100 1 to 3 10 Medium
Many Mbps
Zigbee 802.14.5 Star, 3 20 to 100 High
cluster, 250kbps
mesh
Esp8266- 802.11 Star, mesh 100 1 to 150 Low
01 11Mbps

Table-1.1 Comparison of Different communication module

From table 1, it is observed that Esp8266-01 works on 802.11 b/g/n protocol whereas
Zigbee uses 802.14.5 protocol. Zigbee consumes least power as 3mW whereas Wi-Fi and
Bluetooth consumes nearly 100mW. But if we compare speed of Esp8266 has maximum
speed up to 11mbps but Zigbee has only 250kbps. Clearly esp8266 defeat Zigbee and
Bluetooth not only in cost but also in speed is giving a brief idea about the
interconnection of microcontroller , peripheral devices as well as sensors and what is the
architecture behind it.

1.5 OVERVIEW

home and building automation systems are used more and more. On the one hand, they
provide increased comfort especially when employed in a private home. On the other
hand, automation systems installed in commercial buildings do not only increase
comfort, but also allow centralized control of heating, ventilation, air condition and
lighting. Hence, they contribute to an overall cost reduction and also to energy saving
which is certainly a main issue today. Existing, well-established systems are based on
wired communication. Examples include BACnet, LonWorks and KNX . Employing a
traditional wired automation system does not pose a problem as long as the system is
planned before and installed during the physical construction of the building. If,
however, already existing buildings should be augmented with automation systems, this
requires much effort and mush cost since cabling is necessary. Obviously, wireless
systems can come to help here. In the past few years, wireless technologies reached their
breakthrough. Wireless based systems, used every day and everywhere, range from
wireless home networks and mobile phones to garage door openers. As of today, little
comparative research of wireless automation standards has been done, although such
knowledge would provide valuable information to everyone looking for the most suitable
system for given requirements. In recent years, wireless systems like WLAN have
become more and more common in home networking. Also in home and building
automation systems, the use of wireless technologies gives several advantages that could
not be achieved using a wired network only.

1)Reduced installation costs: First and foremost, installation costs are significantly
reduced since no cabling is necessary. Wired solutions require cabling, where
material as well as the professional laying of cables (e.g. into walls) is expensive.
3
2) Easy deployment, installation, and coverage: Wireless nodes can be mounted almost
anywhere. In adjacent or remote places, where cabling may not be feasible at all, e.g., a
garden house or the patio, connection to the home network is accomplished instantly by
simply mounting nodes in the area. Hence, wireless technology also helps to enlarge the
covered area.

3) System scalability and easy extension: Deploying a wireless network is especially


advantageous when, due to new or changed requirements, extension of the network is
necessary. In contrast to wired installations, additional nodes do not require additional
cabling which makes extension rather trivial. This makes wireless installations
a seminal investment.

4) Aesthetical benefits: As mentioned before, placement of wireless nodes is easy. Apart


from covering a larger area, this attribute helps to full aesthetical requirements as well.
Examples include representative buildings with all-glass architecture and historical
buildings where design or conservatory reasons do not allow laying of cables.

5) Integration of mobile devices: With wireless networks, associating mobile devices


such as PDAs and Smartphones with the automation system becomes possible
everywhere and at any time, as a device's exact physical location is no longer crucial for
a connection (as long as the device is in reach of the network). Typical examples include
an engineer who connects to the network, performs a particular management task, and
disconnects after having finished the task; or control of blinds using a remote control.
For all these reasons, wireless technology is not only an attractive choice in renovation
and refurbishment, but also for new installations.

1.6 SYSTEM DESIGN

Gives an idea about the operation of home automation system. The four different
appliances such as fan, light, Bulb and LED are operated remotely using Wi-Fi and
through an application installed on android or iPhone. These appliances are connected
through ESP 8266 wi fi module its digital input/output pins. These devices are connected
with local Wi-Fi using a communicating module called esp8266-01.

1.7 OUTLINE OF THESIS

This report consists of eight chapters including this chapter. The scope of each chapter is
explained as stated below:

Chapter 1
This chapter gives the introduction to the work undertaken, objectives,
scopes of works and methodology taken.

Chapter 2
In this chapter ESP8266 Wifi module is discussed. It gives the information
input output pin and data specification.

4
Chapter 3
In this chapter relay board is discussed. How to connect the relay board with
node MCU and also discussed internal external structure and working principle.

Chapter 4
In this chapter transformer introduction and his detail specification that why I
use the transformer in the project so in the chapter 4 general description and
discrimination of the transformer are discussed.

Chapter 5
In this chapter the diode is discussed the diode is use in this project to
converted alternating current in to direct current so there the full wave rectifier are
discussed and how to converted ac in to dc and also discussed the performance and
characteristics.

Chapter 6
In this chapter general description Transistors are three terminal active
devices made from different semiconductor materials that can act as either an insulator or
a conductor by the application of a small signal voltage. The transistor's ability to change
between these two states enables it to have two basic functions: "switching" (digital
electronics) or "amplification" (analogue electronics). Then bipolar transistors have the
ability to operate within three different regions.

Chapter 7
In this chapter explanation of resistance in the field of project there is color
coding resistance are use to reduce the quantity of current and also discussed the
property and power consumption ratings.

Chapter 8
In this chapter what type of coding are use and program of the project

Chapter 9
In this chapter discussed of WIFI setup and The WiFi standards define a fixed
channel bandwidth and frequency .

Chapter 10
In this chapter assigning IP address discussed. An IP address is considered
private if the IP number fallswithin one of the IP address ranges reserved for private
networks such as a Local Area Network (LAN). The Internet Assigned Numbers
Authority (IANA) hasreserved the following three blocks of the IP address space for
private networks. Classification of their class
5
Chapter 11
In this chapter how to use blynk app and download how to create account at
blynk app .

Chapter 12
In this chapter total workout of project and total cost of project.

Chapter 13
In this chapter merits of project.

Chapter 14
This last chapter presents the overall discussion and conclusion of this
thesis. A few recommendations and suggestions also have been included for the future
work.

6
CHAPTER 02

WIFI MODULE

2.1 INTRODUCTION

The ESP8266 is the name of a micro controller designed by Espressif Systems. The
ESP8266 itself is a self-contained WiFi networking solution offering as a bridge from
existing micro controller to WiFi and is also capable of running self-contained
applications. This module comes with a built in USB connector and a rich assortment of
pin-outs. With a micro USB cable, you can connect NodeMCU devkit to your laptop and
flash it without any trouble, just like Arduino. It is also immediately breadboard friendly.

FIGURE : 2.1 ESP8266 NODE MCU Wi-Fi

7
2.2 NODE MCU

Node MCU V3 is an open-source firmware and development kit that plays a vital role in
designing an IoT product using a few script lines. Multiple GPIO pins on the board allow
us to connect the board with other peripherals and are capable of generating PWM, I2C,
SPI, and UART serial communications. The interface of the module is mainly divided
into two parts including both Firmware and Hardware where former runs on the
ESP8266 Wi-Fi SoC and later is based on the ESP-12 module. The firmware is based on
Lua – A scripting language that is easy to learn, giving a simple programming
environment layered with a fast scripting language that connects you with a well-known
developer community.

FIGURE NO 2.2 NODE MCU DESCRIPTION

And open source firmware gives you the flexibility to edit, modify and rebuiltthe
existing module and keep changing the entire interface until you succeed in optimizing
the module as per your requirements.
USB to UART converter is added on the module that helps in converting USB data to
UART data which mainly understands the language of serial communication. Instead of
the regular USB port, MicroUSB port is included in the module that connects it with the
computer for dual purposes: programming and powering up the board. The board
incorporates status LED that blinks and turns off immediately, giving you the current
status of the module if it is running properly when connected with the computer.
The ability of module to establish a flawless WiFi connection between two channels
makes it an ideal choice for incorporating it with other embedded devices like Raspberry
Pi.
8
2.3 PIN DEFINATION

FIGURE NO 2.3 : INPUT OUTPU PIN CONFIGURATION

2.4 NODE MCU DEVKIT 1.

The term NodeMCU usually refers to the firmware, while the board is called Devkit. NodeMCU
Devkit 1.0 consists of an ESP-12E on a board, which facilitates its use. It also has a voltage
regulator, a USB interface.

FIGURE NO 2.4 : NODE MCU Devkit 1

9
The module is mainly based on ESP8266 that is a low-cost Wi-Fi microchip
incorporating both a full TCP/IP stack and microcontroller capability. It is introduced by
manufacturer Espressif Systems. The ESP8266 NodeMcu is a complex device, which
combines some features of the ordinary Arduino board with the possibility of connecting
to the internet.
Arduino Modules and Microcontrollers have always been a great choice to incorporate
automation into the relevant project. But these modules come with a little drawback as
they don’t feature a built-in WiFi capability, subsequently, we need to add external WiFi
protocol into these devices to make them compatible with the internet channel. The best
way to develop quickly an IoT application with less Integrated circuits to add is to
choose this circuit “NodeMCU”. Today,we will give a detailed Introduction on
NodeMCU V3. It is an open-source firmware and development kit that plays a vital role
in designing a proper IoT product using a few script lines. This is the famous NodeMCU
which is based on ESP8266 Wi Fi SoC. This is version 3 and it is based on ESP-12E (An
ESP8266 based Wifi module). Node MCU is also an open-source firmware and
development kit that helps you to prototype your IOT product within a few LUA script
lines, and of course you can always program it with Arduino IDE.
In this article, We will try present useful details related to this WiFi Development Kit, its
main features, pin out and everything we need to know about this module and the
application domain.

2.5 ESP-12E

The ESP-12E is a board created by AI-THINKER, which consists of an ESP8266EX


inside the metal cover.

FIGURE NO 2.5 : ESP-12E


2.6 ESP8266EX

Made by Espressif, this microchip has integrated WiFi and low-power consumption.
Processor RISC Tensilica L 106 32bit with a maximum clock of 160 MH

10
FIGURE NO 2.6 : ESP8266 EX

2.7 Node MCU 1.0 ESP-12E PINOUT

2.7.1 ESP-12E PINOUT

I want to emphasize that NodeMCU and ESP-12E are not the same things. In the case of
the ESP-12E, the recording uses the serial, the UART. In NodeMCU, this is performed
by the USB.

FIGURE NO 2.7 : ESP-12E PIN OUT

After All This, What's the Number to Put When Programming


11
Use the number that is in front of the GPIO or the constants A0, D0, D1, D2, D3, D4,
D5, D6, D7, and D8.

2.7.2 Boot

We put the oscilloscope at the tip of each pin. This allows us to find, for example, that
when we turn on the
NodeMCU, its pins are not all the same. Some are up and others down, by default. See
the comments on the behavior of each post after the boot in the image below

FIGURE NO 2.8 : Boot

2.8 INPUT / OUTPUT

Constants That Are Already Predefined.When performing INPUT and OUTPUT tests on the
pins, we obtained the following results:

CONSTENT VALOR
D0 16
D1 5
D2 4
D3 0
D4 2
D5 14
D6 12
D7 13
D8 15
A0 17

TABLE NO 2.1 DIGITAL INPUT OUT PIN


12
digital Write did NOT work with GPIOs 6, 7, 8, 11, and ADC (A0)
digital Read did NOT work with GPIOs 1, 3, 6, 7, 8, 11, and the ADC (A0)
analog Write did NOT work with GPIOs 6, 7, 8, 11, and ADC (A0) (GPIOs 4, 12, 14,
15 have hardware PWM, and the others are by software)
analog Read worked only with the ADC (A0)
6, 7, 8, 11 do NOT work for the above four commands

2.9 POWER NODE MCU

We can see from the pinout image above, there are five ground pins and three 3V3 pins
on the board. The board can be powered up using the following three ways.

USB Power. It proves to an ideal choice for loading programs unless the project you aim
to design requires separate interface i.e. disconnected from the computer.

Provide 3.3V. This is another great option to power up the module. If you have your
own off-board regulator, you can generate an instant power source for your development
kit.

Power Vin. This is a voltage regulator that comes with the ability to support up to 800
mA. It can handle somewhere between 7 to 12 V. You cannot power the devices
operating at 3.3 V, as this regulator unable to generate as low as 3.3V.

2.10 SPECIFICATION
1. Voltage:3.3V.
2. Wi-Fi Direct (P2P), soft-AP.
3. current consumption: 10uA~170mA.
4. Flash memory attachable: 16MB max (512K normal).
5. Integrated TCP/IP protocol stack.
6. Processor: Tensilica L106 32-bit.
7. Processor speed: 80~160MHz.
8. RAM: 32K + 80K.
9. GPIOs: 17 (multiplexed with other functions).
10. Analog to Digital: 1 input with 1024 step resolution.
11. +19.5dBm output power in 802.11b mode
12. 802.11 support: b/g/n.
13. Maximum concurrent TCP connections

13
CHAPTER 3

RELAY BOARD

3.1 INTRODUCTION

Relay board is maintaining to the all incoming and outgoing input output of the whole
project. This article show how to control main voltage with the using of WI-FI module.
A relay is an electrically oprated switch that can be turned on or off letting the current go
through or not and can be controlled with low voltage ,like 5v provide by the wifi
module pin.

FIGURE NO 3.1 RELAY BOARD

Controlling a relay module with the Arduino is as simple as controlling any other output
as we’ll see later on. There are other relay modules that are powered using 3.3V, which
is ideal for ESP8266.

14
3.2 MAIN VOLTAGE CONNECTION

The high-voltage side has two connectors, each with three sockets: common (COM),
normally closed (NC), and normally open (NO).

3.2.1 COM: COMMON PIN

NC (Normally Closed): the normally closed configuration is used when you want the
relay to be closed by default, meaning the current is flowing unless you send a signal
from the Arduino to the relay module to open the circuit and stop the current.

NO (Normally Open): the normally open configuration works the other way around: the
relay is always open, so the circuit is broken unless you send a signal from the Arduino
to close the circuit.

3.2.2 PIN WIRING

The low-voltage side has a set of four pins and a set of three pins. The set at the
right consists of VCC and GND to power up the module, and input 1 (IN1) and input 2
(IN2) to control the bottom and top relays, respectively.
The second set of pins consists of GND, VCC, and JD-VCC pins. The JD-VCC pin
powers the electromagnet of the relay.
The connections between the relay module and the Arduino are really simple:GND: goes
to ground IN1: controls the first relay (it will be connected to an Arduino digital
pin)IN2: controls the second relay (it should be connected to an Arduino digital pin if
you are using this second relay. Otherwise, you don’t need to connect it) VCC: goes to
5V

3.3 RELAY

Relay is basically a switch which opens and closes the circuit either electronically or
mechanically. In other words we can say that a relay is an electromechanical switch
which uses electromagnetism from small current or voltage to switch higher current or
voltage for different appliances. When a relay is in Normally Open (NO) contact, there is
actually an open circuit until the relay is energized.
If a relay is in Normally Close (NC) contact, there is a closed circuit until a relay is
energized. If we apply current to the relay contact in any of the above cases (NO, NC),
they will change their states i.e. NC will become NO and vice versa. Relay is used for
switching smaller currents in an electronic circuit. It can not be used for in power
consuming devices. Relay also shows its amplification effect. When a small voltage is
applied to the coil inside relay, it produces higher voltage due to contact switching.
There are several advantages

15
FIGURE NO 3.2 RELAY

e.g. overloads, reverse, under current, over current etc. A relay has three main controls.
These controls are Logic operation, on off control, Limit control. Relay works on a very
basic principle, when power is supplied to coil it either opens or closes the circuit.

3.4 Relay PIN


1. Relay has total five (5) pins with different individual functions.
2. Three pins are at one side of the structure.
3. The other two pins are on the opposite side of the structure.
4. All of these pins are provided in the table given in the figure shown below.

Relay pins

Pin. No Pin Name

1 COIL

2 COM

3 COIL

4 NO

5 NC

TABLE NO 3.1 RELAY PIN AND PIN NAME

3.5 RELAY PIN DISCRIPTION

Each pin has different functions to perform. So, we must know about each of the
function before using it, for the better use of it. All these pin descriptions are listed in the
table shown in the figure below.
16
RELAY PIN DISCRIPTION

Pin name Pin name


Coil Coil terminal
Com Common /movable contact
Coil Coil terminal
No Normally open
NC Normally close

TABLE NO 3.2 RELAY PIN DISCRIPTION

3.6 RELAY INTERNAL STRUCTURE


Internal structure of any electronic device leads to the better understanding about its
working principle. I have made a completely labeled internal structure of relay along
with its pin configurations. Relay internal structure is shown in the figure given below.

FIGURE NO 3.3 : RELAY INTERNAL STRUCTURE

3.7 RELAY PINOUT

If you want to know about the pin configuration of any electronic device you must have
a look at its pinout diagram.Pinout diagram helps us to understand the pin configurations
in a better way.I have made a pinout diagram which contains relay animation, internal
structure and the real image.Relay pinout diagram is given in the figure shown below.

17
FIGURE NO 3.4 RELAY PINOUT

3.8 RELAY WORKING PRINCIPLE


Relays consist of three pins normaly open pin , normaly closed pin, common pin and
coil. When coil powerd on magntic field is generated the contacts connected to each
other. Relay works on a pretty simple principle.Initially when the power is not supplied
and relay is in normally open condition, its contact will be opened.When relay is in
normally closed condition, its contact will be closed. When power is supplied to its coil,
it gets energized and its normally open condition is changed to normally closed and
normally closed condition is changed to normally open.If we want to control the device
via relay through a software then we have to attach this device to its normally open
terminal.When the relay gets energized, that device will be turned on for the appropriate
operation. Working principle of array can be understand from the visuals given in the
figure shown below. Initially, when the power is not supplied and you can see the relay
has normally closed contact as shown in the figure give below.

18
FIGURE NO 3.5 : (a) RELAY INITIAL CONDITION

As I have told earlier, when we supply power the normally closed contact will changed
its state to normally open contact and vice versa.
The explanation of the above step is given in the figure shown below.

19
FIGURE 3.5 : (b) RELAY IS ENERGIZED

From the above figure, you can see contact has been changed to normally open
contact.
3.9 RELAY MODULE 1-CHANNEL FEATURE
1. Contact current 10A and 250V AC or 30V DC.
2. Each channel has indication LED.
3. Coil voltage 12V per channel.
4. Kit operating voltage 5-12 V
5. Input signal 3-5 V for each channel.
6. Three pins for normally open and closed for each channel
7.
3.10 RELAY MODULE WITH ESP 8266 WIFI MODULE

As shown in relay working idea it depends on magnetic field generated from the coil so
there is power isolation between the coil and the switching pins so coils can be easily
powered from ESP8266 WIFI module by connecting VCC and GND bins from Arduino
kit to the relay module kit after that we choose Arduino output pins depending on the
number of relays needed in project designed and set these pins to output and make it out
high (5 V) to control the coil that allow controlling of switching process.

20
CHAPTER 4

TRANSFORMER

4.1 INTRODUCTION

Transformer is an electrical device which can be use to transfer the electrical energy one
electrical circuit to anther electrical circuit without change in frequency and power with
the help of mutual induction. Here I m using step down transformer 220v to 12v 50hz 1
A.

FIGURE NO 4.1 TRANSFOMER

4.2 WORKING PRINCILE OF TRANSFOMER

A Transformer is a static electrical device that transfers electrical energy between two or
more circuits through electromagnetic induction. A varying current in one coil of the
21
transformer produces a varying magnetic field, which in turn induces a varying
electromotive force (e.m.f) or “voltage” in a second coil. Power can be transferred
between the two coils through the magnetic field, without a metallic connection between
the two circuits. Faraday’s law of induction discovered in 1831 described this effect.
Transformers are used to increase or decrease the alternating voltages in electric power
applications.
Since the invention of the first constant-potential transformer in 1885, transformers have
become essential for the transmission, distribution, and utilization of alternating current
electrical energy. A wide range of transformer design is encountered in electronic and
electric power applications.

4.3 INDUCTION LOW

The voltage induced across the secondary coil may be calculated from faraday's law of
induction, which states that:

4.1

Where vs is the instantaneous voltage, ns is the number of turns in the secondary coil and
φ equals the magnetic flux through one turn of the coil. If the turns of the coil are
oriented perpendicular to the magnetic field lines, the flux is the product of the magnetic
flux density b and the area a through which it cuts. The area is constant, being equal to
the cross-sectional area of the transformer core, whereas the magnetic field varies with
time according to the excitation of the primary. Since the same magnetic flux passes
through both the primary and secondary coils in an ideal transformer, the instantaneous
voltage across the primary winding equals

4.2

Taking the ratio of the two equations for vs and vp gives the basic equation for stepping
up or stepping down the voltage

4.3

The ideal transformer as a circuit element

If the secondary coil is attached to a load that allows current to flow, electrical power is
transmitted from the primary circuit to the secondary circuit. Ideally, the transformer is
perfectly efficient; all the incoming energy is transformed from the primary circuit to the
magnetic field and into the secondary circuit. If this condition is met, the incoming
electric power must equal the outgoing power.
22
4.4 IDEAL POWER EQUATION

FIGURE 4.2 : EQUAVELENT CIRCUIT

Giving the ideal transformer equation

4.4

Transformers normally have high efficiency, so this formula is a reasonable


approximation.

If the voltage is increased, then the current is decreased by the same factor. The
impedance in one circuit is transformed by the square of the turns ratio. For example, if
an impedance zs is attached across the terminals of the secondary coil, it appears to the
primary circuit to have an impedance of

. 4.5

This relationship is reciprocal, so that the impedance zp of the primary circuit appears to
the secondary to be

. 4.6

4.5 GENERAL DESCRIPTION

It is a general purpose chassis mounting mains transformer. Transformer has 240V


primary windings and centre tapped secondary winding. The transformer has flying
colored insulated connecting leads (Approx 100 mm long). The Transformer act as step

23
down transformer reducing AC - 240V to AC - 12V. Power supplies for project & circuit
boards. Step down 230 V AC to 12V with a maximum of 1Amp current. In AC circuits,
AC voltage, current and waveform can be transformed with the help of Transformers.
Transformer plays an important role in electronic equipment. AC and DC voltage in
Power supply equipment are almost achieved by transformer’s transformation and
commutation

4.6 PRODUCT DESCRIPTION

A transformer is an electrical device that transfers electrical energy between two or more
circuits through electromagnetic induction. Electromagnetic induction produces an
electromotive force within a conductor which is exposed to time varying magnetic fields.
Transformers are used to increase or decrease the alternating voltages in electric power
applications.
It is a step down transformer in which the secondary winding is more than primary
winding. Due to this windings it can able to step down the voltage. A Transformer
changes electricity from high to low voltage or low to high voltage using two properties
of electricity.

4.7 FEATURES

1. Output current:1A

2. Supply voltage: 220-230VAC

3. Output voltage: 12VAC

4. Soft Iron Core

5. 1Amp Current Drain

24
CHAPTER 5

DIODE

5.1 INTRODUCTION

In electronics, a diode is a two-terminal electronic component that conducts electric


current in only one direction. The term usually refers to a semiconductor diode, the most
common type today, which is a crystal of semiconductor connected to two electrical
terminals, a p-n junction. A vacuum tube diode, now little used, is a vacuum tube with
two electrodes; a plate and a cathode.

The most common function of a diode is to allow an electric current in one direction
(called the diode's forward direction) while blocking current in the opposite direction
(the reverse direction). Thus, the diode can be thought of as an electronic version of a
check valve. This unidirectional behavior is called rectification, and is used to convert
alternating current to direct current, and extract modulation from radio signals in radio
receivers.

However, diodes can have more complicated behavior than this simple on-off action, due
to their complex non-linear electrical characteristics, which can be tailored by varying
the construction of their p-n junction. These are exploited in special purpose diodes that
perform many different functions. Diodes are used to regulate voltage (zener diodes),
electronically tune radio and T.V. receivers (varactor diodes), generate radio frequency
oscillations (tunnel diodes), and produce light (light emitting diodes).

Diodes were the first semiconductor electronic devices. The discovery of crystals'
rectifying abilities was made by German physicist Ferdinand Braun in 1874. The first
semiconductor diodes, called cat's whisker diodes were made of crystals of minerals such
as galena. Today most diodes are made of silicon, but other semiconductors such as
germanium are sometimes used.

5.2 SEMICONDUTER DIODE

A modern semiconductor diode is made of a crystal of semiconductor like silicon that


has impurities added to it to create a region on one side that contains negative charge
carriers (electrons), called n-type semiconductor, and a region on the other side that
contains positive charge carriers (holes), called p-type semiconductor.

The diode's terminals are attached to each of these regions. The boundary within the
crystal between these two regions, called a pn junction, is where the action of the diode
takes place. The crystal conducts conventional current in a direction from the p-type side
(called the anode) to the n-type side (called the cathode), but not in the opposite
direction.Another type of semiconductor diode, the Schottky diode, is formed from the
contact between a metal and a semiconductor rather than by a p-n junction.
25
5.3 CURRENT VOLTAGE CHARECTERSTIC

A semiconductor diode’s behavior in a circuit is given by its current–voltage


characteristic, or i–v graph (see graph at right). The shape of the curve is determined by
the transport of charge carriers through the so-called depletion layer or depletion region
that exists at the p-n junction between differing semiconductors. When a p-n junction is
first created, conduction band (mobile) electrons from the n-doped region diffuse into the
p-doped region where there is a large population of holes (vacant places for electrons)
with which the electrons “recombine”. When a mobile electron recombines with a hole,
both hole and electron vanish, leaving behind an immobile positively charged donor
(dopant) on the n-side and negatively charged acceptor (dopant) on the p-side. The
region around the p-n junction becomes depleted of charge carriers and thus behaves as
an insulator.

However, the width of the depletion region (called the depletion width) cannot grow
without limit. For each electron-hole pair that recombines, a positively-charged dopant
ion is left behind in the n-doped region, and a negatively charged dopant ion is left
behind in the p-doped region. As recombination proceeds more ions are created, an
increasing electric field develops through the depletion zone which acts to slow and then
finally stop recombination. At this point, there is a “built-in” potential across the
depletion zone.

If an external voltage is placed across the diode with the same polarity as the built-in
potential, the depletion zone continues to act as an insulator, preventing any significant
electric current flow (unless electron/hole pairs are actively being created in the junction
by, for instance, light. See photodiode). This is the reverse bias phenomenon. However,
if the polarity of the external voltage opposes the built-in potential, recombination can
once again proceed, resulting in substantial electric current through the p-n junction (i.e.
Substantial numbers of electrons and holes recombine at the junction).. For silicon
diodes, the built-in potential is approximately 0.6 v. Thus, if an external current is passed
through the diode, about 0.6 v will be developed across the diode such that the p-doped
region is positive with respect to the n-doped region and the diode is said to be “turned
on” as it has a forward bias.

FIGURE NO 5.1 : CHARECTERSTICS OF A p-n JUNCTION DIODE (NOT TO SCALE).

A diode’s I–V characteristic' can be approximated by four regions of operation (see the
figure at right).

26
At very large reverse bias, beyond the peak inverse voltage or piv, a process called
reverse breakdown occurs which causes a large increase in current (i.e. a large number of
electrons and holes are created at, and move away from the pn junction) that usually
damages the device permanently. The avalanche diode is deliberately designed for use in
the avalanche region. In the zener diode, the concept of piv is not applicable. A zener
diode contains a heavily doped p-n junction allowing electrons to tunnel from the
valence band of the p-type material to the conduction band of the n-type material, such
that the reverse voltage is “clamped” to a known value (called the zener voltage), and
avalanche does not occur. Both devices, however, do have a limit to the maximum
current and power in the clamped reverse voltage region. Also, following the end of
forward conduction in any diode, there is reverse current for a short time. The device
does not attain its full blocking capability until the reverse current ceases.

The second region, at reverse biases more positive than the piv, has only a very small
reverse saturation current. In the reverse bias region for a normal p-n rectifier diode, the
current through the device is very low (in the µa range). However, this is temperature
dependent, and at sufficiently high temperatures, a substantial amount of reverse current
can be observed (ma or more).

The third region is forward but small bias, where only a small forward current is
conducted.

As the potential difference is increased above an arbitrarily defined “cut-in voltage” or


“on-voltage” or “diode forward voltage drop (vd)”, the diode current becomes
appreciable (the level of current considered “appreciable” and the value of cut-in voltage
depends on the application), and the diode presents a very low resistance.

The current–voltage curve is exponential. In a normal silicon diode at rated currents, the
arbitrary “cut-in” voltage is defined as 0.6 to 0.7 volts. The value is different for other
diode types — schottky diodes can be rated as low as 0.2 v and red or blue light-emitting
diodes (LEDs) can have values of 1.4 v and 4.0 v respectively.

At higher currents the forward voltage drop of the diode increases. A drop of 1 v to 1.5 v
is typical at full rated current for power diodes.

The thermal voltage vt is approximately 25.85 mv at 300 k, a temperature close to “room


temperature” commonly used in device simulation software. At any temperature it is a
known constant defined by:

5.1

Where k is the Boltzmann constant, t is the absolute temperature of the p-n junction, and
q is the magnitude of charge on an electron (the elementary charge).

The Shockley ideal diode equation or the diode law is derived with the assumption that
the only processes giving rise to the current in the diode are drift (due to electrical field),
diffusion, and thermal recombination-generation. It also assumes that the recombination-
generation (r-g) current in the depletion region is insignificant. This means that the

27
Shockley equation doesn’t account for the processes involved in reverse breakdown and
photon-assisted r-g. Additionally, it doesn’t describe the “leveling off” of the i–v curve at
high forward bias due to internal resistance.

Under reverse bias voltages the exponential in the diode equation is negligible, and the
current is a constant (negative) reverse current value of −is. The reverse breakdown
region is not modeled by the Shockley diode equation.

For even rather small forward bias voltages (see figure 5) the exponential is very large
because the thermal voltage is very small, so the subtracted ‘1’ in the diode equation is
negligible and the forward diode current is often approximated as

5.2

5.4 RECTIFIRE

Rectifier is a device that converted electrical ac power in to electrical dc power with


change in frequency .AC power is available at low cost. DC power is more expensive to
produce; therefore a method of changing ac to dc is needed as an inexpensive dc source.
AC power can be converted to DC power using rectifiers When ac power is converted to
dc power using rectifiers, dc output contains un wanted alternating current components
known as ripple. Many rectifier applications need that the ripple do not exceed a
specified value. If the ripple exceeds the specified value, different unwanted effects
appear in the system. Some of the unwanted effects are stray heating and audible noise.

5.5 Full-WAVE RECTIFIRE

The rectification takes place by the conduction of couples of diodes. Diodes D1 and D4
are
conducting during the positive half-wave of the voltage. Diode D2 and D3 are
conducting during the negative half. This is a double-way topology. In each half-cycle
the current flows in both directions in the secondary winding but always in the same
direction in the load. There is no DC component in the winding and the core can be
smaller than that for a centre-tapped rectifier with the same DC power rating.

28
FIGURE NO 5.2 : THE SINGLE PHASE FULL WAVE CONVERTER

The rectification takes place by the conduction of couples of diodes. Diodes D1 and D4
are conducting during the positive half-wave of the voltage. Diode D2 and D3 are
conducting during the negative half. This is a double-way topology. In each half-cycle
the current flows in both directions in the secondary winding but always in the same
direction in the load. There is no DC component in the winding and the core can be
smaller than that for a centre-tapped rectifier with the same DC power rating.

5.3

5.4

And similar we can write calculation the other parameter

] 5.5

5.6

5.7

The current in the secondary of the transformer can flow only when the diode conducts and
therefore it is equal to the current in the load:

5.8

5.9

29
The poor performance of this rectifier is also confirmed by the utilization of the transformer. The
average value of the load voltage VL is Vdc and it is defined as

FIG 5.3 : VOLTAGE AND CURRENT OF SINGLE PHASE BRIDGE FULL WAVE RECTIFIR

30
CHAPTER 06

TRANSISTER

6.1 INTRODUCTION

Transistors are three terminal active devices made from different semiconductor
materials that can act as either an insulator or a conductor by the application of a small
signal voltage. The transistor's ability to change between these two states enables it to
have two basic functions: "switching" (digital electronics) or "amplification" (analogue
electronics). Then bipolar transistors have the ability to operate within three different
regions:

1. Active Region - the transistor operates as an amplifier and Ic = β.Ib

2. Saturation - the transistor is "fully-ON" operating as a switch and Ic = I(saturation)

3. Cut-off - the transistor is "fully-OFF" operating as a switch and Ic = 0

FIGURE NO 6.1 TRANSISTER

They are two types of transistor (NPN) and (PNP) but in this project NPN transistor is
used. which basically describes the physical arrangement of the P-type and N-type
semiconductor materials from which they are made.

6.2 BIPOLER TRANSISTER CONSTRUCTION

The construction and circuit symbols for the NPN bipolar transistor is given above with
the arrow in the circuit symbol always showing the direction of "conventional current
flow" between the base terminal and its emitter terminal. The direction of the arrow
31
always points from positive P-type region to the negative N-type region for this types of
transistor, exactly the same as for the standard diode symbol.

FIGURE NO 6.2 BIPOLER TRANSISTER 6.2

6.3 NPN TRANSISTER

In the previous tutorial we saw that the standard Bipolar Transistor or BJT, comes in two
basic forms. An NPN (Negative-Positive-Negative) type and a PNP (Positive-Negative-
Positive) type, with the most commonly used transistor type being the NPN Transistor.
We also learnt that the transistor junctions can be biased in one of three different ways -
Common Base, Common Emitter and Common Collector. In this tutorial we will look
more closely at the "Common Emitter" configuration using NPN Transistors with an
example of the construction of a NPN transistor along with the transistors current flow
characteristics is given below.

6.4 NPN TRANSISTER CONFIGURATION

FIGURE NO : 6.3 NPN TRANSITER CONFIGURATION

32
We know that the transistor is a "current" operated device (Beta model) and that a large
current ( Ic ) flows freely through the device between the collector and the emitter
terminals when the transistor is switched "fully-ON". However, this only happens when a
small biasing current ( Ib ) is flowing into the base terminal of the transistor at the same
time thus allowing the Base to act as a sort of current control input. The transistor current
in an NPN transistor is the ratio of these two currents ( Ic/Ib ), called the DC Current
Gain of the device and is given the symbol of hfe or nowadays Beta, ( β ). The value of β
can be large up to 200 for standard transistors, and it is this large ratio between Ic and Ib
that makes the NPN transistor a useful amplifying device when used in its active region
as Ib provides the input and Ic provides the output. Note that Beta has no units as it is a
ratio.
Also, the current gain of the transistor from the Collector terminal to the Emitter
terminal, Ic/Ie, is called Alpha, ( α ), and is a function of the transistor itself (electrons
diffusing across the junction). As the emitter current Ie is the product of a very small
base current plus a very large collector current, the value of alpha α, is very close to
unity, and for a typical low-power signal transistor this value ranges from about 0.950 to
0.999

6.5 TRANSITER AS A SWITCH

The transistors Base biasing voltage is applied so that it operates within its "Active"
region and the linear part of the output characteristics curves are used. However, the
NPN type bipolar transistors can be made to operate as an "ON/OFF" type solid state
switch for controlling high power devices such as motors, solenoids or lamps. If the
circuit uses the Transistor as a Switch, then the biasing is arranged to operate in the
output characteristics curves seen previously in the areas known as the "Saturation" and
"Cut-off" regions as shown below.

FIGURE NO 6.4 SWITCING SETURATION


33
The pink shaded area at the bottom represents the "Cut-off" region. Here the operating
conditions of the transistor are zero input base current (Ib), zero output collector current
(Ic) and maximum collector voltage (Vce) which results in a large depletion layer and no
current flows through the device. The transistor is switched "Fully-OFF". The lighter
blue area to the left represents the "Saturation" region. Here the transistor will be biased
so that the maximum amount of base current is applied, resulting in maximum collector
current flow and minimum collector emitter voltage which results in the depletion layer
being as small as possible and maximum current flows through the device. The transistor
is switched "Fully-ON". Then we can summarize this as:

Cut-off Region - Both junctions are Reverse-biased, Base current is zero or very small
resulting in zero Collector current flowing, the device is switched fully "OFF".

Saturation Region - Both junctions are Forward-biased, Base current is high enough to
give a Collector-Emitter voltage of 0v resulting in maximum Collector current flowing,
the device is switched fully "ON"
.
An example of an NPN Transistor as a switch being used to operate a relay is given
below. With inductive loads such as relays or solenoids a flywheel diode is placed across
the load to dissipate the back EMF generated by the inductive load when the transistor
switches "OFF" and so protect the transistor from damage. If the load is of a very high
current or voltage nature, such as motors, heaters etc, then the load current can be
controlled via a suitable relay as shown.

We can also determine the degree of crystallinity, crystallinity index (Ic) using the
empirical method

6.1

6.2

The common base circuit is generally only used in single stage amplifier circuits such as
microphone pre-amplifier or radio frequency (Rf) amplifiers due to its very good high
frequency response.

6.3

6.4
34
6.5

6.6

Where: "Ic" is the current flowing into the collector terminal, "Ib" is the current flowing
into the base terminal and "Ie" is the current flowing out of the emitter terminal.
Then to summarise, this type of bipolar transistor configuration has a greater input
impedance, current and power gain than that of the common base configuration but its
voltage gain is much lower. The common emitter configuration is an inverting amplifier
circuit resulting in the output signal being 180o out-of-phase with the input voltage
signal.

35
CHAPTER 7

RESISTENCE
7.1 INTRODUCTION

Resistance is related to current, voltage, and physical properties of materials. Current can
flow in any medium in which there are conduction charges free to move. The conduction
charges may be electrons, positively charged ‘holes’, or positive or negative ions,
depending on the material. During current flow, the charges exhibit continuous random
motion, colliding with each other as well as with atomic structure of the material.When a
conducting material is placed in an electric field, the conducting charges are accelerated
in the direction of the field. The field adds a small average drift velocity to the random
velocity. The magnitude of the drift velocity, vd, is related to the strength of the field E
by

Vd = μE 7.1

where μ is known as the mobility of the charge carriers. The rate of flow of electric
charge across a unit area of a plane normal to the direction of vd is the current density, J,
is given by

J = nqvd 7.2

where n is the density of charge carriers and q is the charge of each particle. For
electronic conductors, the electron charge, e = q = 1.6 × 10−19 C. Combining (1) and (2)
gives
J = nqμE = σE 7.3

where σ is the conductivity of the material, in Siemens per meter and J is the current
density in coulombs per square meter per second. The inverse of conductivity is called
the resistivity (ρ), which is measured in VmA−1 or _m. While the range of conductivity
is somewhat arbitrary, it is very low in insulators, σ < 10−15 S cm−1, intermediate in
semiconductors, σ = 10−5 to 103 S cm−1, very high in conductors, σ = 104 to 106 S
cm−1, and infinite in superconductors. The mobility, μ, usually decreases with increasing
temperature due to collisions between the moving electrons, that is, lattice vibrations.
The number of charge carriers, n, remains constant for metallic conductors with
increasing temperature, but increases exponentially for semiconductors and insulators.
Thus, at very high temperatures some insulators become semiconducting, while at low
temperatures some semiconductors become insulators. Equations (1), (2), and (3) may be
linked to basic electrical
circuit theory by considering the flow of electric current in a section of a wire having a
cross-sectional area of A and length l.

36
Assuming a current I is uniformly distributed across the cross-section, the current density
can be expressed as
7.4

Expressing the relationship between the electric field in the wire and the potential
difference between its ends gives

7.5

Thus, from (3), (4), and (5), the relation between voltage and current becomes

7.6

Therefore, the resistance R of a material can be expressed


as

7.7

7.2 LODING EFFECT

If the resistance of the measuring device shown in Figure 5 is comparable in size with
the unknown resistance under investigation, the current drawn by the meter can distort
the readings. One of the solutions to this problem is to select a high input–impedance
meter that is at least 50 to 100 times higher than the impedance of the load. If loading
effect is unavoidable, mathematical techniques can be used to make corrections.

7.3 CARBON COMPOSITION RESISTER

Made of carbon or graphite mixed with a powdered insulating material. Metal caps with
tinned copper wire (called axial leads) are joined to the ends of the carbon resistance
element. They are used for soldering the connections into a circuit. Becoming obsolete
because of the development of carbon film resistors.

FIGURE NO. 7.1: CARBON RESISTER WITH THE SAME PHYSICAL SIZE INDICATE A POWER
RATING OF ½ W.
37
Here in this project two resistance are used 1000 Ω and 100 Ω in ½ watt.
Carbon resistors are small, so their R value in ohms is marked using a color-coding
system. Colors represent numerical values. Coding is standardized by the Electronic
Industries Alliance (EIA).

7.4 1kΩ (1/2 W) COLOR CODING RESITANCE

The 1000Ω resistor drop the current between the wifi module and transistor wifi module
give the 3.3v 0.5 A current this current is to high for the operate of transistor. It high
current can damage the transistor and due the circuit may be fail so the current will
maintained 1kΩ ½ watt of resistance.

7.5 100Ω (1/2) COLOR CODING RESISTENCE

The 100 Ω resistance drop the current between indication led and operating current in the
relay board .the relay operated minimum 12v 1A and this current can damage the
indication led (light emitting diode ) so this to reduce this high current color coding
resistance .

7.6 ZERO-Ohm RESISTER

Has zero ohms of resistance.Used for connecting two points on a printed-circuit board .
7.7 POWER RATING OF RESISTORS

The power absorbed (in the form of heat) by a resistor is a product of resistance and
square of the current through it (i.e. P = I 2R). Therefore, the size, surface area, thermal
properties, and composition of resistance are important for it to be able to dissipate the
generated heat without changing its electrical properties, especially in the long term.
Resistors, therefore, are manufactured for specific applications. The selection of an
appropriate resistor for an application must meet the requirements of the circuit. In
electronic applications, resistors can be viewed under six different groups, these are:
carbon-composition, carbonfilm, thin-film, metal-film, wire-wound, and foil resistors

7.8 POWER DISSIPIATION

The power dissipated by a resistor (or the equivalent resistance of a resistor network) is
calculated using the following:

7.8

All three equations are equivalent. The first is derived from joule's first law. Ohm’s law
derives the other two from that.The total amount of heat energy released is the integral of
the power over time:
38
7.9

If the average power dissipated is more than the resistor can safely dissipate, the resistor
may depart from its nominal resistance and may become damaged by overheating.
Excessive power dissipation may raise the temperature of the resistor to a point where it
burns out, which could cause a fire in adjacent components and materials. There are
flameproof resistors that fail (open circuit) before they overheat dangerously.

Note that the nominal power rating of a resistor is not the same as the power that it can
safely dissipate in practical use. Air circulation and proximity to a circuit board, ambient
temperature, and other factors can reduce acceptable dissipation significantly. Rated
power dissipation may be given for an ambient temperature of 25 °c in free air. Inside an
equipment case at 60 °c, rated dissipation will be significantly less; if we are dissipating
a bit less than the maximum figure given by the manufacturer we may still be outside the
safe operating area, and courting premature failure.

7.9 RESISTOR COLOR CODE CHART

FIGURE NO 7.2 RESISTER COLOR CODE SYSTEM

39
CHAPTER 08

SOFTWERE

8.1 PROGRAM

#include <ESP8266WiFi.h>

const char* ssid = "Tarang"; // SSID i.e. Service Set Identifier is the name of your WIFI
const char* password = "123456789"; // Your Wifi password, in case you have open
network comment the whole statement.

int R1=D1; // GPIO13 or for NodeMCU you can directly write D7


int R2=D2;
int R3=D3;
int R4=D4;
WiFiServer server(80); // Creates a server that listens for incoming connections on the
specified port, here in this case port is 80.

void setup() {
Serial.begin(115200);
delay(10);

pinMode(R1, OUTPUT);
pinMode(R2, OUTPUT);
pinMode(R3, OUTPUT);
pinMode(R4, OUTPUT);

digitalWrite(R1,LOW);
digitalWrite(R2,LOW);
digitalWrite(R3,LOW);
digitalWrite(R4,LOW);

// Connect to WiFi network


Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);

WiFi.begin(ssid, password);

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

40
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");

// Start the server


server.begin();
Serial.println("Server started");

// Print the IP address


Serial.print("Use this URL to connect: ");
Serial.print("http://");
Serial.print(WiFi.localIP()); //Gets the WiFi shield's IP address and Print the IP address
of serial monitor
Serial.println("/");

void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}

// Wait until the client sends some data


Serial.println("new client");
while(!client.available()){
delay(1);
}

// Read the first line of the request


String request = client.readStringUntil('\r');
Serial.println(request);
client.flush();

// Match the request

if (request.indexOf("/Relay1On") != -1) {
digitalWrite(R1,HIGH);

client.println("HTTP/1.1 200 OK");


client.println("Content-Type: text/html");
client.println("");
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("Relay 1 is ON");
41
client.println("</html>");
client.stop();
delay(1);
}
if (request.indexOf("/Relay1Off") != -1) {
digitalWrite(R1, LOW);

client.println("HTTP/1.1 200 OK");


client.println("Content-Type: text/html");
client.println("");
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("Relay 1 is OFF");
client.println("</html>");
client.stop();
delay(1);
}

if (request.indexOf("/Relay2On") != -1) {
digitalWrite(R2,HIGH);

client.println("HTTP/1.1 200 OK");


client.println("Content-Type: text/html");
client.println("");
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("Relay 2 is ON");
client.println("</html>");
client.stop();
delay(1);

}
if (request.indexOf("/Relay2Off") != -1) {
digitalWrite(R2, LOW);

client.println("HTTP/1.1 200 OK");


client.println("Content-Type: text/html");
client.println("");
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("Relay 2 is OFF");
client.println("</html>");
client.stop();
delay(1);
}

if (request.indexOf("/Relay3On") != -1) {
42
digitalWrite(R3,HIGH);

client.println("HTTP/1.1 200 OK");


client.println("Content-Type: text/html");
client.println("");
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("Relay 3 is ON");
client.println("</html>");
client.stop();
delay(1);
}
if (request.indexOf("/Relay3Off") != -1) {
digitalWrite(R3, LOW);

client.println("HTTP/1.1 200 OK");


client.println("Content-Type: text/html");
client.println("");
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("Relay 3 is OFF");
client.println("</html>");
client.stop();
delay(1);
}

if (request.indexOf("/Relay4On") != -1) {
digitalWrite(R4,HIGH);

client.println("HTTP/1.1 200 OK");


client.println("Content-Type: text/html");
client.println("");
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("Relay 4 is ON");
client.println("</html>");
client.stop();
delay(1);
}
if (request.indexOf("/Relay4Off") != -1) {
digitalWrite(R4, LOW);

client.println("HTTP/1.1 200 OK");


client.println("Content-Type: text/html");
client.println("");
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("Relay 4 is OFF");
client.println("</html>");
43
client.stop();
delay(1);
}

}
void setup() {
// put your setup code here, to run once:

void loop() {
// put your main code here, to run repeatedly:

44
CHAPTER 09

Wi-Fi (INTERNET CONNECTION)


9.1 INTRODUCTION

Wi-Fi is the Name of a wireless networking technology that uses radio wawe to provide
wireless high- speed internet and network connection. A common misconception is that
the term Wi-Fi is short for “wireless fidelity ,” Users of wireless local area network
(WLAN) devices have flexibility to move their laptop computers from one place to
another within their offices while maintaining connectivity with the network. Wireless
personal networks allow users to share data and applications with network systems and
other users with compatible devices, without being tied to printer cables and other
peripheral device connections. Users of handheld devices such as personal digital
assistants (PDAs) and cell phones can synchronize data between PDAs and personal
computers and can use network services such as wireless email, web browsing and
Internet access. Further, wireless communications can help organizations cut their wiring
costs. WiFi stands for Wireless Fidelity. WiFiIt is based on the IEEE 802.11 family of
standards and is primarily a local area networking (LAN) technology designed to provide
in-building broadband coverage. Current WiFi systems support a peak physical-layer
data rate of 54 Mbps and typically provide indoor coverage over a distance of 100 feet.
WiFi has become the de facto standard for last mile broadband connectivity in homes,
offices, and public hotspot locations. Systems can typically provide a coverage range of
only about 1,000 feet from the access point. WiFi offers remarkably higher peak data
rates than do 3G systems, primarily since it operates over a larger 20 MHz bandwidth,
but WiFiWiFi systems are not designed to support high-speed mobility. One significant
advantage of WiFi over WiMAX and 3G is its wide availability of terminal devices. A
vast majority of laptops shipped today have a built-in WiFi interface. WiFi interfaces are
now also being built into a variety of devices, including personal data assistants (PDAs),
cordless phones, cellular phones, cameras, and media players.

9.2 WIFI LIBRARY

The Wi-Fi library for ESP8266 has been developed basing on ESP8266 SDK, using
naming convention and overallfunctionality philosophy of Arduino WiFi library. Over
time the wealth Wi-Fi features ported from ESP9266 SDK to esp8266 / Adruino outgrow
Arduino WiFi library and it became apparent that we need to provide separate
documentation on what is new and extra. This documentation will walk you through
several classes, methods and properties of ESP8266WiFi library. If you are new to C++
and Arduino, don’t worry. We will start from general concepts and then move to detailed
description of members of each particular class including usage examples. The scope of
functionality offered by ESP8266WiFi library is quite extensive and therefore this
description has been broken up into separate documents marked with arrow right.

45
9.3 QUICK START

Hopefully you are already familiar how to load Blink.ino sketch to ESP8266 module and
get the LED blinking. If not, please check this tutorial by Adafruit or another great
tutorial developed by Sparkfun. To hook up ESP module toWi-Fi (like hooking up a
mobile phone to a hot spot), you need just couple of lines of code:

#include <ESP8266WiFi.h>
void setup()
{
Serial.begin(115200);
Serial.println();
WiFi.begin("network-name", "pass-to-network");
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Connected, IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {}

In the line WiFi.begin("network-name", "pass-to-network") replace network-name and


pass-to-network with name and password to the Wi-Fi network you like to connect. Then
upload this sketch to
ESP module and open serial monitor. You should see something like:

FIGURE 9.1 ALT TEXT

46
How does it work? In the first line of sketch #include <ESP8266WiFi.h> we are
including ESP8266WiFi library. This library provides ESP8266 specific Wi-Fi routines
we are calling to connect to network If you don’t see the last line but just more and more
dots ........., then likely name or password to the Wi-Fi network in sketch is entered
incorrectly. Verify name and password by connecting from scratch to this Wi-Fi a PC or
a mobile phone. Note: if connection is established, and then lost for some reason, ESP
will automatically reconnect to last used access point once it is again back on-line. This
will be done automatically by Wi-Fi library, without any user intervention.

9.4 WHO IS WHO

Devices that connect to Wi-Fi network are called stations (STA). Connection to Wi-Fi is
provided by an access point(AP), that acts as a hub for one or more stations. The access
point on the other end is connected to a wired network. Anaccess point is usually
integrated with a router to provide access fromWi-Fi network to the internet. Each access
point is recognized by a SSID (Service Set IDentifier), that essentially is the name of
network you select when connecting a device (station) to the Wi-Fi. ESP8266 module
can operate as a station, so we can connect it to the Wi-Fi network. It can also operate as
a soft access point (soft-AP), to establish its own Wi-Fi network. Therefore we can
connect other stations to such ESP module. ESP8266 is also able to operate both in
station and soft access point mode. This provides possibility of building e.g. mesh
networks.

FIGURE 9.2 ALT TEXT

The ESP8266WiFi library provides wide collection of C++ methods (functions) and
properties to configure and operate an ESP8266 module in station and / or soft access
point mode.

47
9.5 CLASS DESCRIPTION

The ESP8266WiFi library is broken up into several classes. In most of cases, when
writing the code, user is not concerned with this classification. We are using it to break
up description of this library into more manageable pieces.

FIGURE 9.3: ALT TEXT

Chapters below describe all function calls (methods and properties in C++ terms) listed
in particular classes of ESP8266WiFi. Description is illustrated with application
examples and code snippets to show how to use functions in practice. Most of this
information is broken up into separate documents. Please follow to access them.

9.5.1 STATION

Station (STA) mode is used to get ESP module connected to a Wi-Fi network established
by an access point.

FIGURE 9.4: ALT TEXT

48
Station class has several features to facilitate management ofWi-Fi connection. In case
the connection is lost, ESP8266 will automatically reconnect to the last used access
point, once it is again available. The same happens on module reboot. This is possible
since ESP is saving credentials to last used access point in flash (non-volatile) memory.
Using the saved data ESP will also reconnect if sketch has been changed but code does
not alter the Wi-Fi mode or credentials. Station Class documentation

9.5.2 SOFT ACESS POINT

An access point (AP) is a device that provides access to Wi-Fi network to other devices
(stations) and connects them further to a wired network. ESP8266 can provide similar
functionality except it does not have interface to a wired network. Such mode of
operation is called soft access point (soft-AP). The maximum number of stations
connected to

FIGURE 9.5 ALT TEXT

The soft-AP mode is often used and an intermediate step before connecting ESP to a Wi-
Fi in a station mode. This is when SSID and password to such network is not known
upfront. ESP first boots in soft-AP mode, so we can connect to it using a laptop or a
mobile phone. Then we are able to provide credentials to the target network. Once done
ESP is switched to the station mode and can connect to the target Wi-Fi. Another handy
application of soft-AP mode is to set up mesh networks. ESP can operate in both soft-AP
and Station mode so it can act as a node of a mesh network.
Soft Access Point Class documentation

49
9.5.3 SERVER

The Server Class creates servers that provide functionality to other programs or devices,
called clients. Clients connect to sever to send and receive data and access provided
functionality

FIGURE 9.6 : ALT TEXT

50
CHAPTER 10

IP ADRESS

10.1 INTRODUCTION

The original Internet Protocol, IPv4, was developed in the early 1980s and served the
global Internet community for more than three decades. IPv4 had a capacity of just over
four billion IP addresses, which was enough for the experiment that the Internet started
as in the 1980s. But IPv4 is a finite space, and after years of rapid Internet expansion, the
pool of available unallocated addresses for IPv4 has been fully allocated to Internet
services providers (ISPs) and users. Only 3.7 billion IPv4 addresses are usable by
ordinary Internet access devices. The others are used for special protocols, like IP
Multicasting. Today, none of those 3.7 billion IPv4 addresses remain unallocated. [2]
Every machine on a network has a unique identifier. Just as you would address a letter to
send in the mail, computers use the unique identifier to send data to specific computers
on a network. Most networks today, including all computers on the Internet, use the
TCP/IP protocol as the standard for how to communicate on the network. In the TCP/IP
protocol, the unique identifier for a computer is called its IP address. IPv4 uses 32 binary
bits to create a single unique address on the network. An IPv4 address is expressed by
four numbers separated by dots. Each number is the decimal (base-10). For example:
192.168.1.100. It is actually 32- bit binary (base-2) numbers. Binary representation of
192.168.1.100= 11000000.10101000.00000001.01100100The binary number is
important because that will determine which class of network the IP address belongs to.
The Class of the address determines which part belongs to the network address and
which part belongs to the node.

10.2 ASSIGNING IP ADDRESS

We can assign the IP address to computer with the help of


two methods
1. Static IP (Manually)
2. Dynamic IP (Automatically with the help of DHCP
Server)

10.3 IP ADDRESS CLASSIFICATION

IP addresses are divided into 5 classes


Class A
Class B These Classes are used in LAN & WAN
Class C
Class D Reserved for Multicasting
Class E Reserved for Research & Development

51
10.4 FIND THE RANGE OF CLASS

To find the range of each Class a bit called priority bit is


used. Priority bit is the left most bit of the first octet.

Table- 10.1: IP Class and their respective Priority bit

CLASS PRIORITY BIT


A 0
B 10
C 110
D 1110
E 11110

TABLE NO 10.1 : IP CLASS AND THEIR RESPECTIVE PRIORITY

Table-10.2 Range of IP address

CLASS BINARY NUMBER RANGE OF IP ADRESS


STARTIN G ENDING VALUE
VALUE

A 00000000 0 126
B 10000000 128 191
C 11000000 192 223
D 11100000 224 239
E 11110000 240 255

TABLE NO 10.2 : IP ADRESS

10.5 SUBNET MASK

Class A - 255.0.0.0
NNNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH
11111111.00000000.00000000.00000000

Class B - 255.255.0.0
NNNNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH
11111111.11111111.00000000.00000000

Class C - 255.255.255.0
NNNNNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH
11111111.11111111.11111111.00000000

Here ‘N’ represents the Network bit and ‘H’ represents the Host bit

52
Table 10.3 Shows number of Network and Host bits of Class

CLASS NO.OF NETWROK BIT NO OF HOST BIT


A 8 24
B 16 16
C 24 8

TABLE NO 10.3 : SHOW NUMBER OF NETWORK

There is a set pattern of static leading bits for each class


Class A leading bits=0
Class B leading Bits=10
Class C leading bits=110
By static, we mean that the bits cannot vary - and as a
result they cannot add any address combinations, and
must be subtracted to find the true value for n. The
following table shows the number of leading bits, and we
call that number, m. You must also subtract off the two
special cases of all 1'(11111111) and all 0's
(00000000).[4]
Maximum No. of possible networks = 2 n - m - 2
Where n = No. of Network bits
m = No. of Static Leading bits
Maximum number of possible hosts = 2 n – 2

10.6 TYPES OF IP ADDRESS

Internet Protocol (IP) addresses is usually of twotypes: Public and Private.

10.6.1 PUBLIC IP ADDRESSES

A computer on the Internet is identified by its IP address.In order to avoid address


conflicts, IP addresses arepublicly registered with the Network Information
Centre(NIC).A public IP address is assigned to every computer that connects to the
Internet where each IP is unique. In this case, there cannot exist two computers with
the same public IP address all over the Internet. This addressing scheme makes it
possible for the computers to “find each other” online and exchange information. User
has no control over the public IP address that is assigned to the computer. The public IP
address is assigned to the computer by the Internet Service Provider as soon as the
computer is connected to the Internet gateway. A public IP address can be either static or
dynamic. A static public IP address does not change and is used primarily for hosting
web pages or services on the Internet. On the other hand, a dynamic public IP address is
chosen from a pool of available addresses and changes each time one connects to the
Internet. Most Internet users will only have a dynamic IP assigned to their computer
which goes off when the computer isdisconnected from the Internet. Thus when it is
reconnected .it gets a new IP

53
10.6.2 PRIVATE IP ADDRESSES

An IP address is considered private if the IP number fallswithin one of the IP address


ranges reserved for private networks such as a Local Area Network (LAN). The Internet
Assigned Numbers Authority (IANA) hasreserved the following three blocks of the IP
address space for private networks (local networks):10.0.0.0 – 10.255.255.255 (Total
Addresses: 16,777,216) 172.16.0.0 – 172.31.255.255 (Total Addresses: 1,048,576)
192.168.0.0 – 192.168.255.255 (Total Addresses: 65,536) Private IP addresses are used
for numbering the computers in a private network including home, school and business
LANs in airports and hotels which makes it possible for the computers in the network to
communicate with each other. Say for example, if a network X consists of 10
computers, each of them can be given an IP starting from 192.168.1.1 to 192.168.1.10.
Unlike the public IP, the administrator of the private network isfree to assign an IP
address of his own choice.

10.7 HTTP SERVER

ESP http Update class can check for updates and download a binary file from HTTP web
server. It is possible to download updates from every IP or domain address on the
network or Internet

10.8 REQUIRMENT

10.8.1ARDUINO CODE

Simple updater downloads the file every time the function is called.
ESPhttpUpdate.update("192.168.0.2", 80, "/arduino.bin");

10.8.2 ADVANCED UPDATE

Its possible to point update function to a script at the server. If version string argument is
given, it will be sent to the server. Server side script can use this to check if update
should be performed.
Server side script can respond as follows: - response code 200, and send the firmware
image, - or response code 304 to notify ESP that no update is required.

httpUpdate_return ret = ESPhttpUpdate.update("192.168.0.2", 80, "/esp/update/


˓→arduino.php", "optional current version string here");
switch(ret) {
case HTTP_UPDATE_FAILED:
Serial.println("[update] Update failed.");
break;
case HTTP_UPDATE_NO_UPDATES:
Serial.println("[update] Update no Update.");
break;
case HTTP_UPDATE_OK:
Serial.println("[update] Update ok."); // may not called we reboot the ESP
break;
}
54
CHAPTER 11

BLYNK APP

11.1 INTRODUCTION

Blynk application is the application which is one of the most interesting actions! The
connection can also be established by internet between smartphone and wifi module , but
this will be not presented in this work.

11.1 CONTROLLING WIFI MODULE WITH SMARTPHONE/LAPTOP

This is my first work concerning the use of Blynk application to control the wifi module.
Blynk allow us to create applications and then use it to control wifi module connected to
a PC with internet access, from any where in the world, (for instance, control led, servos,
receive data, etc), with a smartphone. It is one of the most interesting actions! The
connection can also be established by internet between smartphone and wifi module , but
this will be not presented in this work. Blynk can be download from Google play store
(for Android).& app store (for apple), providing us the dashboard as well as the
connectivity to ESP 8266 Wifi module, (it is a virtual connectivity). Programming Blynk
is very simple, push and drag widgets form the tools bar and allocating them pins on
Arduino board. For such project can be used an ordinary Wifi module , without internet
shield, connected to a PC with internet access and a smartphone. The role of PC is to
ensure the connectivity of the wifi moduleto theinternet and to upload the Arduino code.
For this purpose it is necessarily to install Blynk library on the PC and made some
settings. The Arduino codes used for Blynk have the same structure as ordinary codes,
but contain specific parts to communicate with Android devices. I will present a simples
example, taken from internet, and partially modified by me. You can see that creating
new codes is almost similar with the coding of the ordinary ESP8266 wifi module.

To create our first project we need to follows many steps.


1. Install Blynk app on your smartphone and create your simplest application, for
instance control one led.
2. Download blynk v0.3.1 library and install on your PC. Set the right port of the
PC to communicate with the Arduino board, (very important), from the script of
the Blynk library.
3. Upload the Arduino code, (from the examples presented in this work, or
other).Run the Blynk on the smartphone.
4.
Create an account with your email and password. This e-mail will be used b y Blynk

55
server to send your "YourAuthToken", which allows only you to command the ESP
8266.

FIGURE NO 11.1: APPLICTION OF BLYNK

11.3 DOWNLOAD BlYNK & INSTALL ON THE SMARTPHONE

Server to send your "YourAuthToken", which allows only you to command the Arduino
board. Show in figure .
Email the "YourAuthToken", (push the E-mail button), and then create. The
"YourAuthToken" is a series of letters and numbers appearing above the E-mail
button.This "YourAuthToken" must be introduced into your Arduino code, (see next
steps).

FIGURE NO 11.2 : CREATE NEW PROJECT


56
Open a new project, give it a name, select your board, (for instance Arduino Uno), and
Email the "YourAuthToken", (push the E-mail button), and then create. The
"YourAuthToken" is a series of letters and numbers appearing above the E-mail button.
This "YourAuthToken" must be introduced into your Arduino code

FIGURE NO 11.3 : BLYINK LOGING

Go to the Widget Box and select the desired widget, in our case Button. Drag it into the
dashboard, give it a name, (button led), and select the ESP 8266 wifi module pin to
which will be connected, in our case D1,D2,D3.D4. Select the color, (optional), and the
mode of activation, switches for our project. After uploading the WIFI module code on
the board and after setting the right ports of the computer, play the application on your
smartphone. Of course, the computer and the smartphone must be connected to the
internet. That's all.

11.4 CODING ESP 8266 MODULE

The crucial point of this project is represented by the correct installation of the Blynk
library on the computer.To perform this action, but I added some personal modifications.
We must follow the next steps:

Connect the Arduino board to the computer, open the Arduino ide, open Tools, select the
right Board, (Arduino UNO in my case), open the Serial Port and select the port to
which the board is connected, (COM 3 in my case). Mind this port. Keep open the
ESP 8266 module .

57
FIGURE NO 11.4 : SERIAL PORT CONNECTED

Download the Blynk library, Blynk_v0.3.1, using the link provided by Saurabh
Gangamwar, ( Blynk library.), and save the zip file in your Arduino work folder.
Unzip the file; you will find the following folders, If the library is correct installed you
must obtain this screen
If all is correct you will find this message
Connecting device at COM3 to blynk-cloud.com:8442...
OpenC0C("\\.\COM3", ) - OK
Connect("blynk-cloud.com", "8442") - OK
InOut() START
DSR is OFF
Now the 8266 board is connected to the internet and it is ready to receive commands
from the smartphone
Now the 8266board is ready to receive commands from the smartphone. Open the Blynk
project on your Smartphone, run the application, switch the button led icon, and the led
on the ESP8266ard will shine.

58
FIGURE NO 11.5 : PROGRAM (CODDING) UPLOADING

In the Blynk application keep the button-led and add a slider. Give name LOAD 1,
LOAD 2,LOAD 3, LOAD 4 .
attach to the LOAD D1 D2 D3 D4 these slider and set the load connected to the esp 8266
It`s all.
On the ESP 8266 attach led between D1 to D3 and GND, to GND, +5V and D4 (the Fan
connected ). Upload the code, then run blynk, open the Blynk app on the Smartphone,
slide the slider. The display shows the four button load 1 load2 load 3 and load . Switch
the button-led on and off. On the ESP 8266 module the led will shine or will be off.

59
CHAPTER 12

BUDGET

As we have indicated in our earlier report we have exceeded the alotted Rs 3000 for
our project. We were fortunate enough to have additional funding from the IOT based
home automation Project. We have been able to obtain some parts from online
parches from other sources. Last year project uses the Arduino board with wifi
module but in this project only ESP8266 module use This has greatly reduced our
cost. Below you will find a list of the main parts for our project with a price next to
them. This will give a basic idea of what the total cost of our project will be.
Bulb 10 rupess ea. (x3)
Realy 20 rupees ea. (x4)
Transistor 6 rupees ea. (x4)
Resistance 1 rupees ea. (x8)
LED 1 rupees ea. (x5)
Pcb board 30 rupees (x2)

Diode 1 rupees (x4)

Dc fan 25 rupees
ESP 8266 Wi-Fi module 555 rupees
Transformer 65 rupees
Conductors 100 rupees
Wifi 1500 rupees
switch 10 rupess
IP address Donated

TOTAL : 2366 R

TOTAL : 5366 R (With donated items)

Those items in italics are donated items therefore they will only be used in figuring out
the total cost of making our Iot. It does sound like it would cost a lot of money to make
one of these IOT base home automation but the main cost of our IOT base home
automation was the IP Address. With some different IP Address the cost could be
60
significantly reduced. It is also possible that it may actually cost less money to make one
of these IOT based home automation in an assembly line type of arrangement. We feel
that the 5366 R that it takes to make one of these IOT base home automation will be
worth the lives that it may save in removing a electricity bill.

61
CHAPTER 13

ADVANTAGES
ADVANTAGES

1. Savings the energy from light bulbs cutting utility coast over time. Some home
automation helping to prevent exorbitant water bills.
2. Managing all of your home device from one place .The convenience factor here
is enormous.
3. Flexibility for new devices and appliances.
4. Remote control.
5. Increase energy
6. efficiency.
7. Control the device to better control function with the home. Connected device
can also help create a comfortable.
8. Improved appliance functionality.
9. Home management insights.

62
CHAPTER 14

CONCLUSION

COCLUSION

Home Automation is undeniably a resource which can make a home environment


automated. People can control their electrical devices via these Home Automation
devices and set up the controlling actions in the computer. We think this product have
high potential for marketing in the future. At the moment the components are a bit to
high to be able to produce these devices for a interesting price.

The system as the name indicates, ‘Home automation’ makes the system more flexible
and provides attractive user interface compared to other home automation systems. In
this system we integrate mobile devices into home automation systems. A novel
architecture for a home automation system is proposed using the relatively new
communication technologies. The system consists of components is a ESP8266 module,
and relay circuits. WIFI is used as the communication channel between android phone
and the ESP 8266. We hide the complexity of the notions involved in the home
automation system by including them into a simple, but comprehensive set of related
concepts. This simplification is needed to fit as much of the functionality on the limited
space offered by a mobile device’s display. This project proposes a low cost, secure,
ubiquitously accessible, auto-configurable, remotely controlled solution. The approach
discussed in the project is novel and has achieved the target to control home appliances
remotely using the WiFi technology to connects system parts, satisfying user needs and
requirements. WiFi technology capable solution has proved to be controlled remotely,
provide home security and is cost-effective as compared to the previously existing
systems. Hence we can conclude that the required goals and objectives of home
automation system have been achieved. The system design and architecture were
discussed, and prototype presents the basic level of home appliance control and remote
monitoring has been implemented. Finally, the proposed system is better from the
scalability and flexibility point of view than the commercially available home automation
systems.

63
CHAPTER 15

REFRENCE
1. https://www.c-sharpcorner.com/article/blinking-led-by-esp-12e-nodemcu-v3-
module-using-arduinoide/
2. https://www.researchgate.net/publication/319253026_Counter_with_ESP8266_N
odeMcu_and_Blynk
3. Sheet:https://www.icann.org/en/system/files/files/factsheetipv6-03feb11-en.pdf
4. Tech-Faq 127.0.0.1 – What Are its Uses and Why isit Important?
5. http://www.tech-faq.com/127-0-0-1.html
6. http://www.iot-playground.com
7. http://www.instructables.com
8. http://en.wikipedia.org
9. http://www.journals.elsevier.com/easyiot
10. Wireless Sensor Networks: Concepts, Applications, Experimentation and
Analysis. 2016. p. 108. ISBN 9811004129. The use of standardized, with open
standards over proprietary protocols provides the industry with the freedom to
choose between suppliers with guaranteed interoperability. Standardized
solutions usually have a much longer lifespan than proprietary solutions.
11. Jump up^ "Research and Markets: Global Home Automation and Control Market
2014-2020 - Lighting Control, Security & Access Control, HVAC Control
Analysis of the $5.77 Billion Industry". Reuters. 2015-01-19. Archived from the
original on 2016-05-05.
12. Home Automation & Wiring (1 ed.). New York: McGraw-Hill/TAB Electronics.
1999-03-31. ISBN 9780070246744
13. https://www.instructables.com/id/Getting-Started-With-ESP8266LiLon-
NodeMCU-V3Flashi/
14. https://www.c-sharpcorner.com/article/blinking-led-by-esp-12e-nodemcu-v3-
module-using-arduinoide/
15. https://www.cytron.io/p-nodemcu-v3

64
16. http://henrysbench.capnfatz.com/henrys-bench/arduino-projects-tips-and-
more/arduino-esp8266-lolin-nodemcu-getting-started/
17. http://henrysbench.capnfatz.com/henrys-bench/arduino-projects-tips-and-
more/nodemcu-esp-12e-use-cloudmtt-to-display-on-a-gauge-on-blogger/
18. http://henrysbench.capnfatz.com/henrys-bench/arduino-projects-tips-and-
more/arduino-ide-nodemcu-esp-12e-digital-input-basics/
19. http://henrysbench.capnfatz.com/henrys-bench/arduino-projects-tips-and-
more/nodemcu-io-basics-pwm/
20. www.handsontec.com/pdf_learn/esp8266-V10.pdf
21. https://einstronic.com/wp-content/uploads/2017/06/NodeMCU-ESP8266-ESP-
12E-Catalogue.pdf
22. Fraser, C., & Milne, J. (1994). Electromechanical Engineering: An Introduction:
Chicago: IEEE Press.
23. Hart, D. W. (2011). Power Electronics: New Delhi: Tata McGraw-Hill.
24. Pyakuryal, S., & Matin, M. (2013a). Filter Design for AC to DC Converter.
International Refereed Journal of Engineering and Science, 2(6), 42-49.
25. Pyakuryal, S., & Matin, M. (2013b). Ripple Control in AC to DC Converter.
IOSR Journal of Engineering, 3(1), 26-30
26. https://airccj.org/CSCP/vol7/csit77405.pdf
27. R.Aravindhan, M.Ramanathan, D.SanjaiKumar, R.Kishore, “HOME
AUTOMATION USING Wi-Fi INTERCONNECTION”,Department of
Mechatronics engineering, Chennai Institute of Technology, Anna University
Chennai, Tamil Nadu, India- 600069, (IRJET) e-ISSN: 2395 -0056 Volume: 04
Issue: 03 | Mar -2017 ,www.irjet.net.2542-2544pp.
28. https://www.researchgate.net/publication/319253026_Counter_with_ESP8266_N
odeMcu_and_Blynk
29. https://www.elecrow.com/download/ESP8266%20NodeMCU%20kit.pdf
30. View publication

65
# 1, 2, 3 WEEK

66
# 4, 5, 6 WEEK

67
#7, 8,9 WEEK

68

You might also like