Professional Documents
Culture Documents
Introduction:
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) 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. Range of Wi-Fi technology is 40-300
feet.
1
2. Project Overview
It is also cheap and be used for making cool projects connected to the Internet .Learn how to
make a simple IOT Project with it .The ESP8266 WiFi Module is a self contained SOC with
integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi
network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi
networking functions from another application processor. Each ESP8266 module comes pre-
programmed with an AT command set firmware, meaning, you can simply hook this up to
your Arduino device and get about as much WiFi-ability as a WiFi Shield offers (and thats
just out of the box)! The ESP8266 module is an extremely cost effective board with a huge,
and ever growing, community.
The following picture gives an overview of how this system is going to work.
2
3. System description
For controlling, a number of electrical equipment using a PC from a centralized location
involved development of hardware and software for controlling it. The block diagram of PC
controlled home appliances system as shown in fig.3.1.
Relay Bulb
Esp ckt
PC/LAPTO 8266
Relay Motor
P/phone wifi
ckt
module
Relay Socket
ckt
Power
supply
3.1Power Supply:-
There are many types of power supply. Most are designed to convert high voltage AC mains
electricity to a suitable DC voltage supply for electronic circuits and other devices. 5 Volt DC power
supply require for operation of microcontroller.
3
Diode
Voltage Regulator 7805 IC
Capacitor
3.1.1 Transformer:-
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.
A varying current in the transformer's primary winding creates a varying magnetic flux in the
transformer core and a varying field impinging on the transformer's secondary winding. This
varying magnetic field at the secondary winding induces a varying electromotive force
(EMF) or voltage in the secondary winding due to electromagnetic induction.
4
Fig.3.3:- Transformer
3.1.2 Diode:-
In electronics, a diode is a two terminal electronic component that conducts primarily in one
direction (asymmetric conductance) it has low (ideally zero) resistance to the flow of current
in one direction, and high (ideally infinite) resistance in the other.
A semiconductor diode, the most common type today, is a crystalline piece of semiconductor
material with a pn junction connected to two electrical terminals. A vacuum tube diode has
two electrodes, a plate(anode) and a heated cathode. Semiconductor 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, developed around 1906,
were made of mineral crystals such as galena. Today, most diodes are made of silicon, but
other semiconductors such as selenium or germanium are sometimes used.
Fig.3.4:-Diode
5
Fig.3.5:-Voltage regulator ICs
The 78xx line are positive voltage regulators: they produce a voltage that is positive relative
to a common ground. There is a related line of79xx devices which are complementary
negative voltage regulators. 78xx and 79xx ICs can be used in combination to provide
positive and negative supply voltages in the same circuit. 78xx ICs have three terminals and
are commonly found in the TO220 form factor, although they are available in
surfacemount,TO92, and TO3 packages.
These devices support an input voltage anywhere from around 2.5 volts over the intended
output voltage up to a maximum of 35 to 40 volts depending on the model, and typically
provide 1 or 1.5amperes of current (though smaller or larger packages may have a lower or
higher current rating).
6
3.1.4 Capacitor:-
The conductors can be thin films, foils or sintered beads of metal or conductive electrolyte,
etc. The non conducting dielectric acts to increase the capacitor's charge capacity. Materials
commonly used as dielectrics include glass, ceramic, plastic film, paper, mica, and oxide
layers. Capacitors are widely used as parts of electrical circuits in many common electrical
devices.
Fig.3.6:- Capacitor
Unlike a resistor, an ideal capacitor does not dissipate energy. Instead, a capacitor stores
energy in the form of an electrostatic field between its plates. When there is a potential
difference across the conductors (e.g., when a capacitor is attached across a battery), an
electric field develops across the dielectric, causing positive charge +Q to collect on one plate
and negative charge Q to collect on the other plate.
If a battery has been attached to a capacitor for a sufficient amount of time, no current can
flow through the capacitor. However, if a time varying voltage is applied across the leads of
the capacitor, a displacement current can flow.
The SI unit of capacitance is the farad (F), which is equal to one coulomb per volt (1 C/V).
Typical capacitance values range from about 1 pF (1012 F) to about 1 mF (103 F). The
larger the surface area of the "plates" (conductors) and the narrower the gap between them,
the greater the capacitance is. In practice, the dielectric between the plates passes a small
amount of leakage current and also has an electric field strength limit, known as the
breakdown voltage.
The conductors and leads introduce an undesired inductance and resistance. Capacitors are
widely used in electronic circuits for blocking direct current while allowing alternating
current to pass. In analog filter networks, they smooth the output of power supplies. In
7
resonant circuits they tune radios to particular frequencies. In electric power transmission
systems, they stabilize voltage and power flow.
8
Fig.3.8:- Relay circuit pcb layout
"Uno" means one in Italian and was chosen to mark the release of Arduino Software (IDE)
1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference versions of
Arduino, now evolved to newer releases.
Fig.4.1:-Arduino
9
Fig.4.2:-Ardunio back
10
4.1 Pins Description
Input and Output
Each of the 14 digital pins on the Arduino Uno can be used as an input or output, using pinMode(),
digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a
maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms.
In addition, some pins have specialized functions:
Serial: pins 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins
are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.
External Interrupts: pins 2 and 3. These pins can be configured to trigger an interrupt on a low
value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the
SPI library.
LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED
is on, when the pin is LOW, its off.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e.
1024 different values). By default they measure from ground to 5 volts, though is it possible to change
the upper end of their range using the AREF pin and the analogReference() function. Additionally,
some pins have specialized functionality:
TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library.There
are a couple of other pins on the board:
11
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields
which block the one on the board.
The Atmega328 is one of the microcontroller chips that are used with the popular Arduino
Duemilanove boards. The Arduino Duemilanove board comes with either 1 of 2 microcontroller
chips, the Atmega168 or the Atmega328. Of these 2, the Atmega328 is the upgraded, more advanced
chip. Unlike the Atmega168 which has 16K of flash program memory and 512 bytes of internal
SRAM, the Atmega328 has 32K of flash program memory and 2K of Internal SRAM.The Atmega328
has 28 pins.
It has 14 digital I/O pins, of which 6 can be used as PWM outputs and 6 analog input pins. These I/O
pins account for 20 of the pins.
12
1 PC6 Reset
8 GND Ground
22 GND Ground
13
24 PC1 Analog Input
The Atmega328 chip has an analog-to-digital converter (ADC) inside of it. This must be or else the
Atmega328 wouldn't be capable of interpreting analog signals. Because there is an ADC, the chip can
interpret analog input, which is why the chip has 6 pins for analog input .
The ADC has 3 pins set aside for it to function- AVCC, AREF, and GND. AVCC is the power supply,
positive voltage, that for the ADC. The ADC needs its own power supply in order to work. GND is
the power supply ground. AREF is the reference voltage that the ADC uses to convert an analog
signal to its corresponding digital value.
Analog voltages higher than the reference voltage will be assigned to a digital value of 1, while
analog voltages below the reference voltage will be assigned the digital value of 0.
14
5. Esp 8266 wifi module:
Fig
.5.1 wifi module esp 8266
15
5.1 Description:
The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol stack
that can give any microcontroller access to your WiFi network. The ESP8266 is capable of
either hosting an application or offloading all Wi-Fi networking functions from another
application processor. Each ESP8266 module comes pre-programmed with an AT command
set firmware, meaning, you can simply hook this up to your Arduino device and get about as
much WiFi-ability as a WiFi Shield offers (and thats just out of the box)! The ESP8266
module is an extremely cost effective board with a huge, and ever growing, community.
This module has a powerful enough on-board processing and storage capability that allows it
to be integrated with the sensors and other application specific devices through its GPIOs
with minimal development up-front and minimal loading during runtime. Its high degree of
on-chip integration allows for minimal external circuitry, including the front-end module, is
designed to occupy minimal PCB area. The ESP8266 supports APSD for VoIP applications
and Bluetooth co-existance interfaces, it contains a self-calibrated RF allowing it to work
under all operating conditions, and requires no external RF parts. There is an almost limitless
fountain of information available for the ESP8266, all of which has been provided by
amazing community support. In the Documents section below you will find many resources
to aid you in using the ESP8266, even instructions on how to transforming this module into
an IoT (Internet of Things) solution!
5.2 Features:
802.11 b/g/n
Wi-Fi Direct (P2P), soft-AP
Integrated TCP/IP protocol stack
Integrated TR switch, balun, LNA, power amplifier and matching network
Integrated PLLs, regulators, DCXO and power management units
+19.5dBm output power in 802.11b mode
Power down leakage current of <10uA
1MB Flash Memory
Integrated low power 32-bit CPU could be used as application processor
SDIO 1.1 / 2.0, SPI, UART
STBC, 11 MIMO, 21 MIMO
A-MPDU & A-MSDU aggregation & 0.4ms guard interval
Wake up and transmit packets in < 2ms
Standby power consumption of < 1.0mW (DTIM3)
16
5.3 Specification of ESP 8266:
Wi-Fi Direct (P2P), soft-AP
Integrated TCP/IP protocol stack
Integrated TR switch, balun, LNA, power amplifier and matching network
Integrated PLLs, regulators, DCXO and power management units
19.5dBm output power in 802.11b mode
Power down leakage current of <10uA
1MB Flash Memory
Integrated low power 32-bit CPU could be used as application.
17
5.4 Pin diagram of esp 8266 :
18
Fig. 5.2 pin diagram of esp 8266 wifi module
Firstly, you connect NodeMCU board to PC via microUSB cable. After connected, you may
get lighting on blue LED.
If you are working on Windows platform, open Device Manager, you should see NodeMCU
board detected on Ports (COM & LPT).
19
UART, we can attach a terminal emulator to send keystrokes and have data received from the
ESP8266 displayed as characters on the screen. This is used extensively when working with
the AT commands. A second purpose of the UART is to receive binary data used to "flash" the
flash memory of the device to record new applications for execution. There are a variety of
technical tools at our disposal to achieve that task.
When we use a UART, we need to consider the concept of a baud rate. This is the speed of
communication of data between the ESP8266 and its partner. During boot, the ESP8266
attempts to automatically determine the baud rate of the partner and match it. It assumes a
default of 74880 and if you have a serial terminal attached, you will see a message.
6. WiFi Theory :
When working with a WiFi oriented device, it is important that we have at least some
understanding of the concepts related to WiFi. At a high level, WiFi is the ability to
participate in TCP/IP connections over a wireless communication link. WiFi is specifically
the set of protocols described in the IEEE 802.11 Wireless LAN architecture.Within this
story, a device called a Wireless Access Point (access point or AP) acts as the hub of all
communications. Typically it is connected to (or acts as) as TCP/IP router to the rest of the
20
TCP/IP network. For example, in your home, you are likely to have a WiFi access point
connected to your modem (cable or DSL). WiFi connections are then formed to the access
point (through devices called stations) and TCP/IP traffic flows through the access point to
the Internet.
An ESP8266 device can play the role of an Access Point, a Station or both at the same
time.Very commonly, the access point also has a network connection to the Internet and acts
as a bridge between the wireless network and the broader TCP/IP network that is the
Internet.A collection of stations that wish to communicate with each other is termed a Basic
Service Set (BSS). The common configuration is what is known as an Infrastructure BSS. In
this mode, all communications inbound and outbound from an individual station are routed
through the access point.A station must associate itself with an access point in order to
participate in the story. A station may only be associated with a single access point at any one
time.Each participant in the network has a unique identifier called the MAC address. This is a
48bit value.
When we have multiple access points within wireless range, the station needs to know with
which one to connect. Each access point has a network identifier called the BSSID (or more
21
commonly just SSID). SSID is service set id entifier. It is a 32 character value that represents
the target of packets of information sent over the network.
22
Fig.6.2 AT Command Programming
If we think of an application wishing to use the services of the ESP8266 as a client and the
ESP8266 as a server capable of servicing those commands as a server, then the client
sends strings of characters through the UART connection to the server and server responds
with the outcome.
23