Final Project
Final Project
Final Project
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
Submitted by
CERTIFICATE
2
Dept.of.ECE
PROJECT COMPLETION CERTIFICATE
The training was conducted on Internet of things (IoT) Technology for the
Completion of the project titled INTELLIGENT VOICE ACTIVATED HOME
AUTOMATION in 2023 - 2024. The project has been completed in all aspects.
We are thankful to our beloved mentors, Mr. K. Krishna Kumar, Assistant Professor
& Mr. O. Ravinder, Assistant Professor, ECE, GNITC, Hyderabad.
We are very much grateful to our Project Coordinators, Mr. K.Krishna Kumar,
Assistant Professor & Mr. O.Ravinder, Associate Professor of ECE, GNITC,
Hyderabad, who are not only shown utmost patience but were fertile in suggestions,
vigilant in directions of error, and have been infinitely helpful.
We are also thankful to our Academic Coordinator, IV Year, Mr. D. Surendra Rao,
Associate Professor of ECE, GNITC, Hyderabad, for his support.
We were also thankful to Dr. Maheswara Reddy Sura, Professor & HOD of ECE &
Academic Coordinator, GNITC, Hyderabad, for being so helpful with valuable insights
and guidance during our project.
We are thankful to Dr. P. Parthasaradhy, Joint Director,GNITC for his good support
and given valuable inputs in our project work.
We express our deepest gratitude to Dr. Koduganti Venkata Rao, Director, GNITC,
for his constant support and encouragement and for providing us with all the facilities
in the college during our project work.
Our sincere thanks to all our faculties, administrative staff, and management of GNITC
without whose support, our work would always remain incomplete.
On a more personal note, we thank our beloved parents and friends for their moral
support during our project.
iii
TABLE OF CONTENTS
CHAPTER-1 INTRODUCTION
1.1 General...................................................................................1
1.2 Proposed system....................................................................2
5
Dept.of.ECE
3.3 Consumer and enterprise IOT applications ......................................... 48
3.4 IOT security and privacy issues ............................................................ 49
CHAPTER-5 IMPLEMENTATION
CONCLUSION .......................................................................................................63
REFERENCES ........................................................................................................64
6
Dept.of.ECE
LIST OF FIGURES
Figure number Name of the figure Page no
Fig-2.1 Layered architecture of an Embedded system
Fig-2.2 Block diagram of the hardware Embedded system
Fig-2.3 Block diagram of the intelligent voice Home automation
system
Fig-2.4 Block diagram of power supply
Fig-2.5 Bridge rectifier
Fig-2.6 Output waveform of DC
Fig-2.7 Regulator
Fig-2.8 Circuit diagram of power supply
Fig-2.9 ESP8266 NODEMCU
Fig-2.10 NODEMCU ESP8266 pin out
Fig-2.11.a References
Fig-2.11.b Board manager
Fig-2.11.c Drop down menu
Fig-2.11.d Updating CPU frequency(80MHz)
Fig-2.11.e Updating upload speed (115200)
Fig-2.12 OLED
Fig-2.13 Adding ZIP library
Fig-2.14 ET-BASE AVR Easy 328
Fig-2.15 Bluetooth package structure
Fig-2.16 Discovering a Bluetooth device
Fig-2.17 Positioning of audio in the Bluetooth stack
Fig-2.18 Stages in setting up an SDP Session
Fig-2.19 Bluetooth profiles
Fig-2.20 Qo’s messaging
Fig-2.21 ULN 2003
Fig-2.22 Logic Diagram of ULN 2003
Fig-2.23 Relay
Fig-2.24 Representation of Relay
Fig-2.25 Buzzer
Fig-2.26 Example of IOT
Fig-2.27 Schematic Diagram
7
Dept.of.ECE
LIST OF TABLES
Table-2.8 IR remote-controlInterface 19
vi
8
Dept.of.ECE
List of abbreviations
1. IOT: Internet of Things
2. LED:Light Emitting Diode
3. LDR:Light Dependent Resistor
4. IR: Infrared
5. SVL: Sodium Vapour Lamp
6. Wi-Fi: Wireless Fidelity
7. CPU: Central Processing Unit
8. RAM: Random Access Memory
9. ROM: Read-Only Memory
10. DSP:Digital Signal Processor
11. USB: Universal Serial Bus
12. IC: Integrated Circuit
13. AC: Alternating Current
14. DC: Direct Current
15. Vi: Input Voltage
16. Vo: Output Voltage
17. EEPROM: Electrically Erasable Programmable Read-Only Memory
18. DSP: Digital Signal Processor
19. GPIO: General Purpose Input-Output
20. SPI: Serial Peripheral Interface
21. UART: Universal Asynchronous Receiver-Transmitter
22. I2C: Inter-Integrated Circuit
23. IR Sensor: Infrared Sensor
24. CFL:Compact Fluorescent Lamp
25. IEEE: Institute of Electrical and Electronics Engineers
26. WSN: Wireless Sensor Network
27. IDE: Integrated Development Environment
28. CPU: Central
Processing Unit
9
Dept.of.ECE
ABSTRACT
In order to acquire this knowledge, I had to use a reverse engineering approach. The
reason for using this methodology arises from the fact that all the products considered
in this study are commercially protected as industrial secrets. Consequently, it is not
possible to obtain detailed descriptions of their ‘real’ architectures and internal
operations. The second part of this thesis presents my personal contribution in the form
of a prototype for a Smart – Home Architecture.
My design, called IVA (short for Intelligent Voice Activated) home automation, is
primarily driven by the processing of natural language voice commands. I argue that
this approach should be attractive to seniors, and people with limited range of mobility.
In addition, the hardware needed to implement the system is commonly available and
inexpensive. The most sophisticated device in my model is a smart phone, which in most
cases, is already own by the prospective user.
viii
10
Dept.of.ECE
INTELLIGENT VOICE-ACTIVATED HOME
AUTOMATION
11
Dept.of.ECE
CHAPTER 1
INTRODUCTION
1.1 GENERAL
Home, it is where individual wants to be following a long tiring day. Individuals go to
their homes subsequent to having an exceptionally long and upsetting working day.
Some of them are exhausted to the point that they find actually difficult to make
development from their agreeable, couches and beds. (It is called as lethargy however
our venture searches for their solace). There are such a significant number of
advancements/gadgets accessible that would assist them with switching their home
apparatuses on and off, anybody can play their most loved music and so forth on a
solitary direction from their own voice from the keen spots would make them easy. It
would be so better for them in the event that they could warm the bathwater and change
in room temperature just before they achieve home by giving a voice order. So when
they achieve home they can discover the room temperature and the shower water is
comfortable to them. Servants are a decent alternative for moguls to keep their homes
early days. There are extremely less individuals in the general public who can manage
the cost of such new keen innovation. As the expense is excessively high, anyway not
every person can manage the cost of Google colleague or savvy home framework.
Subsequently we have to structure a framework which can be reasonable. This task
proposes such economical framework. Voice is utilized to offer directions to Google
right hand. All parts are associated over the web utilizing Wi-Fi which puts the
framework under Iot
12
Dept.of.ECE
PROPOSED SYSTEM
We will be building an IVA based Home Automation system. IVA stands for Intelligent
Voice Activation. Current Home Automation systems are based on some low end
technologies. We will be innovating the new automation methodology using Voice
activation methods. Voice activation will be done using Artificial Intelligence with
Google Assistant. Google assistant is AI which gives response voices generated by user
as shown in block diagram above. Commands to operate devices will be given through
the Google Assistant i.e. Turn on light. We need to control operation of the devices and
a cloud channel for establishing communication with Android phone’s Google Assistant
and controller. So here we will be using Adafruit cloud communicate with Node MCU
by Publishing and subscribing the data. Afterwards data feed is forwarded to Node MCU
using MQTT protocol.
13
Dept.of.ECE
CHAPTER 2
PROJECT DESCRIPTION
Application Areas
Nearly 99 per cent of the processors manufactured end up in embedded systems. The
embedded system market is one of the highest growth areas as these systems are used
in very market segment- consumer electronics, office automation, industrial automation,
biomedical engineering, wireless communication, data communication,
telecommunications, transportation, military and so on.
14
Dept.of.ECE
Consumer appliances:
At home we use a number of embedded systems which include digital camera, digital
diary, DVD player, electronic toys, microwave oven, remote controls for TV and air-
conditioner, VCO player, video game consoles, video recorders etc. Today’s high-tech
car has about 20 embedded systems for transmission control, engine spark control, air-
conditioning, navigation etc. Even wristwatches are now becoming embedded systems.
The palmtops are powerful embedded systems using which we can carry out many
general-purpose tasks such as playing games and word processing.
Office Automation:
The office automation products using embedded systems are copying machine, fax
machine, key telephone, modem, printer, scanner etc.
Industrial Automation:
Today a lot of industries use embedded systems for process control. These include
pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation
and transmission. The embedded systems for industrial use are designed to carry out
specific tasks such as monitoring the temperature, pressure, humidity, voltage, current
etc., and then take appropriate action based on the monitored levels to control other
devices or to send information to a centralized monitoring station. In hazardous
industrial environment, where human presence has to be avoided, robots are used, which
are programmed to do specific jobs. The robots are now becoming very powerful and
carry out many interesting and complicated tasks such as hardware assembly.
Medical Electronics:
Almost every medical equipment in the hospital is an embedded system. These
equipments include diagnostic aids such as ECG, EEG, blood pressure measuring
devices, X-ray scanners; equipment used in blood analysis, radiation, colonoscopy,
endoscopy etc. Developments in medical electronics have paved way for more accurate
diagnosis of diseases.
Computer Networking:
Computer networking products such as bridges, routers, Integrated Services Digital
Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay switches
are embedded systems which implement the necessary data communication protocols.
For example, a router interconnects two networks. The two networks may be running
different protocol stacks. The router’s function is to obtain the data packets from
incoming pores, analyze the packets and send them towards the destination after doing
15
Dept.of.ECE
necessary protocol conversion. Most networking equipments, other than the end systems
(desktop computers) we use to access the networks, are embedded systems.
Telecommunications:
In the field of telecommunications, the embedded systems can be categorized as
subscriber terminals and network equipment. The subscriber terminals such as key
telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The
network equipment includes multiplexers, multiple access systems, Packet Assemblers
Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc.
are the latest embedded systems that provide very low-cost voice communication over
the Internet.
Wireless Technologies:
Advances in mobile communications are paving way for many interesting applications
using embedded systems. The mobile phone is one of the marvels of the last decade of
the 20’h century. It is a very powerful embedded system that provides voice
communication while we are on the move. The Personal Digital Assistants and the
palmtops can now be used to access multimedia service over the Internet. Mobile
communication infrastructure such as base station controllers, mobile switching centers
are also powerful embedded systems.
Insemination:
Testing and measurement are the fundamental requirements in all scientific and
engineering activities. The measuring equipment we use in laboratories to measure
parameters such as weight, temperature, pressure, humidity, voltage, current etc. are all
embedded systems. Test equipment such as oscilloscope, spectrum analyzer, logic
analyzer, protocol analyzer, radio communication test set etc. are embedded systems
built around powerful processors. Thank to miniaturization, the test and measuring
equipment are now becoming portable facilitating easy testing and measurement in the
field by field-personnel.
Security:
Security of persons and information has always been a major issue. We need to protect
our homes and offices; and also the information we transmit and store. Developing
embedded systems for security applications is one of the most lucrative businesses
nowadays. Security devices at homes, offices, airports etc. for authentication and
16
Dept.of.ECE
verification are embedded systems. Encryption devices are nearly 99 per cent of the
processors that are manufactured end up in~ embedded systems. Embedded systems
find applications in every industrial segment- consumer electronics, transportation,
avionics, biomedical engineering, manufacturing, process control and industrial
automation, data communication, telecommunication, defense, security etc. Used to
encrypt the data/voice being transmitted on communication links such as telephone
lines. Biometric systems using fingerprint and face recognition are now being
extensively used for user authentication in banking applications as well as for access
control in high security buildings.
Finance:
Financial dealing through cash and cheques are now slowly paving way for transactions
using smart cards and ATM (Automatic Teller Machine, also expanded as Any Time
Money) machines. Smart card, of the size of a credit card, has a small micro-controller
and memory; and it interacts with the smart card reader! ATM machine and acts as an
electronic wallet. Smart card technology has the capability of ushering in a cashless
society. Well, the list goes on. It is no exaggeration to say that eyes wherever you go,
you can see, or at least feel, the work of an embedded system.
17
Dept.of.ECE
2.2Overview of Embedded System Architecture
Every embedded system consists of custom-built hardware built around a Central
Processing Unit (CPU). This hardware also contains memory chips onto which the
software is loaded. The software residing on the memory chip is also called the
‘firmware’. The embedded system architecture can be represented as a layered
architecture as shown in Fig. The operating system runs above the hardware, and the
application software runs above the operating system. The same architecture is
applicable to any computer including a desktop computer. However, there are
significant differences. It is not compulsory to have an operating system in every
embedded system. For small appliances such as remote control units, air conditioners,
toys etc., there is no need for an operating system and you can write only the software
specific to that application. For applications involving complex processing, it is
advisable to have an operating system. In such a case, you need to integrate the
application software with the operating system and then transfer the entire software on
to the memory chip. Once the software is transferred to the memory chip, the software
will continue to run for a long time you don’t need to reload new software.
18
Dept.of.ECE
· Application-specific circuit.
19
Dept.of.ECE
for user interaction; they take inputs from sensors or transducers 1’fnd produce electrical
signals that are in turn fed to other systems.
Output Devices:
The output devices of the embedded systems also have very limited capability. Some
embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health
status of the system modules, or for visual indication of alarms. A small Liquid Crystal
Display (LCD) may also be used to display some important parameters.
Communication Interfaces:
The embedded systems may need to, interact with other embedded systems at they may
have to transmit data to a desktop. To facilitate this, the embedded systems are provided
with one or a few communication interfaces such as RS232, RS422, RS485, Universal
Serial Bus (USB), IEEE 1394, Ethernet etc.
Application-Specific Circuitry:
Sensors, transducers, special processing and control circuitry may be required fat an
embedded system, depending on its application. This circuitry interacts with the
processor to carry out the necessary work. The entire hardware has to be given power
supply either through the 230 volts main supply or through a battery. The hardware has
to design in such a way that the power consumption is minimized.
20
Dept.of.ECE
2.3 BLOCK DIAGRAM
Power IOT
Supply
Bluetooth OLED
Module
NODEMCU
Driver Motor
Circuit
Driver Appliance
Circuit
Alarm
21
Dept.of.ECE
2.4 MODULES
2.4.1. POWER SUPPLY
The power supply section is the section which provide +5V for the components
to work. IC LM7805 is used for providing a constant power of +5V.
The ac voltage, typically 220V, is connected to a transformer, which steps down that ac
voltage down to the level of the desired dc output. A diode rectifier then provides a full-
wave rectified voltage that is initially filtered by a simple capacitor filter to produce a
dc voltage. This resulting dc voltage usually has some ripple or ac voltage variation.
A regulator circuit removes the ripples and also retains the same dc value even if the
input dc voltage varies, or the load connected to the output dc voltage changes. This
voltage regulation is usually obtained using one of the popular voltage regulator IC
units.
Transformer
Transformers convert AC electricity from one voltage to another with little loss
of power. Transformers work only with AC and this is one of the reasons why mains
electricity is AC.
The input coil is called the primary and the output coil is called the secondary. There is
no electrical connection between the two coils; instead they are linked by an alternating
magnetic field created in the soft-iron core of the transformer. Transformers waste very
little power so the power out is (almost) equal to the power in. Note that as voltage is
stepped down current is stepped up.
22
Dept.of.ECE
The transformer will step down the power supply voltage (0-230V) to (0- 6V) level.
Then the secondary of the potential transformer will be connected to the bridge rectifier,
which is constructed with the help of PN junction diodes. The advantages of using
bridge rectifier are it will give peak voltage output as DC.
Rectifier
There are several ways of connecting diodes to make a rectifier to convert AC
to DC. The bridge rectifier is the most important and it produces full-wave varying DC.
A full-wave rectifier can also be made from just two diodes if a centre-tap transformer
is used, but this method is rarely used now that diodes are cheaper. A single diode can
be used as a rectifier but it only uses the positive (+) parts of the AC wave to produce
half-wave varying DC
Bridge Rectifier
When four diodes are connected as shown in figure, the circuit is called as bridge
rectifier. The input to the circuit is applied to the diagonally opposite corners of the
network, and the output is taken from the remaining two corners. Let us assume that the
transformer is working properly and there is a positive potential, at point A and a
negative potential at point B. the positive potential at point A will forward bias D3 and
reverse bias D4.
23
Dept.of.ECE
One advantage of a bridge rectifier over a conventional full-wave rectifier is that with a
given transformer the bridge rectifier produces a voltage output that is nearly twice that
of the conventional full-wave circuit.
i. The main advantage of this bridge circuit is that it does not require a special centre
tapped transformer, thereby reducing its size and cost.
ii. The single secondary winding is connected to one side of the diode bridge network
and the load to the other side as shown below.
iii. The result is still a pulsating direct current but with double the frequency.
Smoothing
Smoothing is performed by a large value electrolytic capacitor connected across
the DC supply to act as a reservoir, supplying current to the output when the varying
DC voltage from the rectifier is falling. The capacitor charges quickly near the peak of
the varying DC, and then discharges as it supplies current to the output.
Voltage Regulators
Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the
circuitry for reference source, comparator amplifier, control device, and overload
protection all in a single IC. IC units provide regulation of either a fixed positive voltage,
a fixed negative voltage, or an adjustably set voltage. The regulators can be selected for
operation with load currents from hundreds of milli amperes to tens of amperes,
corresponding to power ratings from milli watts to
tens of watts.
A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi, applied
to one input terminal, a regulated dc output voltage, Vo, from a second terminal, with
the third terminal connected to ground.
24
Dept.of.ECE
The series 78 regulators provide fixed positive regulated voltages from 5 to 24 volts.
Similarly, the series 79 regulators provide fixed negative regulated voltages from 5 to
24 volts. Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or
variable output voltages. They are also rated by the maximum current they can pass.
Negative voltage regulators are available, mainly for use in dual supplies. Most
regulators include some automatic protection from excessive current ('overload
protection') and overheating ('thermal protection').
Many of the fixed voltage regulator ICs has 3 leads and look like power transistors, such
as the 7805 +5V 1Amp regulator. They include a hole for attaching a heat sink if
necessary.
Fig.2.7 Regulator
25
Dept.of.ECE
2.4.2 MICROCONTROLLER
A Microcontroller (or MCU) is a computer-on-a-chip used to control electronic
devices. It is a type of microprocessor emphasizing self-sufficiency and cost-
effectiveness, in contrast to a general-purpose microprocessor (the kind used in a PC).
A typical microcontroller contains all the memory and interfaces needed for a simple
application, whereas a general-purpose microprocessor requires additional chips to
provide these functions.
26
Dept.of.ECE
CRITERIA FOR SELECTION OF A MICROCONTROLLER IN EMBEDDED
SYSTEM
Criteria for selection of microcontroller in any embedded system is as following:
(a) Meeting the computing needs of task at hand efficiently and cost effectively
• Speed of operation
• Packing
• Power consumption
• Amount of RAM and ROM on chip
• No. of I/O pins and timers on chip
• Cost
(b) Availability of software development tools such as compiler, assembler
and debugger
27
Dept.of.ECE
2.5 NodeMCU ESP8266
NodeMCU is an open-source Lua based firmware and development board specially
targeted for IoT based Applications. It includes firmware that runs on the ESP8266 Wi-
Fi SoC from Espressif Systems, and hardware which is based on the ESP-12 module.
Pin
Name Description
Category
Control
EN, RST The pin and the button resets the microcontroller
Pins
GPIO1 to
GPIO Pins NodeMCU has 16 general purpose input-output pins on its board
GPIO16
28
Dept.of.ECE
• Input Voltage: 7-12V
• Digital I/O Pins (DIO): 16
• Analog Input Pins (ADC): 1
• UARTs: 1
• SPIs: 1
• I2Cs: 1
• Flash Memory: 4 MB
• SRAM: 64 KB
• Clock Speed: 80 MHz
• USB-TTL based on CP2102 is included onboard, Enabling Plug n Play
• PCB Antenna
• Small Sized module to fit smartly inside your IoT projects
29
Dept.of.ECE
General Purpose Input/Output Interface (GPIO)
30
Dept.of.ECE
Table 2.3 General SPI (Master/Slave)
Pin Name Pin Num IO Function Name
SDIO_CLK 21 IO6 SPICLK
SDIO_DATA0 22 IO7 SPIQ/MISO
SDIO_DATA1 23 IO8 SPID/MOSI
SDIO_DATA_2 18 IO9 SPIHD
SDIO_DATA_3 19 IO10 SPIWP
U0TXD 26 IO1 SPICS1
GPIO0 15 IO0 SPICS2
I2C Interface
ESP8266EX has one I2C used to connect with micro-controller and other peripheral
equipments such as sensors. The pin definition of I2C is as below.
Pin Name Pin Num IO Function Name
MTMS 9 IO14 I2C_SCL
GPIO2 14 IO2 I2C_SCA
Both I2C Master and I2C Slave are supported. I2C interface functionality can be realized
via software programming, the clock frequency reaches 100 kHz at a maximum. It
should be noted that I2C clock frequency should be higher than the slowest clock
frequency of the slave device.
I2S Interface
ESP8266EX has one I2S data input interface and one I2S data output interface. I2S
interfaces are mainly used in applications such as data collection, processing, and
transmission of audio data, as well as the input and output of serial data. For example,
LED lights (WS2812 series) are supported. The pin definition of I2S is as below. I2S
31
Dept.of.ECE
functionality can be enabled via software programming by using multiplexed GPIOs,
and linked list DMA is supported.
32
Dept.of.ECE
Table 2.7.The pin definition of PWM interfaces
The functionality of PWM interfaces can be implemented via software programming.
For example, in the LED smart light demo, the function of PWM is realized by
interruption of the timer, the minimum resolution reaches as much as 44 ns. PWM
frequency range is adjustable from 1000 μs to 10000 μs, i.e., between 100Hz and 1 kHz.
When the PWM frequency is 1 kHz, the duty ratio will be 1/22727, and over 14-bit
resolution will be achieved at 1 kHz refresh rate.
IR Remote Control
One Infrared remote-control interface is defined as below.
33
Dept.of.ECE
2.6.Instruction on GPIO Registers
GPIO Function Selection Register
The ESP8266 MTDI is used to demonstrate the GPIO function selection.
Function selection register PERIPHS_IO_MUX_MTDI_U (this register differs for
different GPIOs)
PIN_FUNC_SELECT (PERIPHS_IO_MUX_MTDI_U, FUNC_GPIO12);
FUNC_GPIO12=3.
Configurations differ for different pins.
34
Dept.of.ECE
• Output high level register GPIO_OUT_W1TS
bit [15:0] output high level bit (write only register):
If the related bit is set to be 1, it means the IO output is high level (at the same time,
users should enable the output). Bit [15:0] contains 16 GPIO output statuses.
35
Dept.of.ECE
Different from other IO interfaces, GPIO16(XPD_DCDC) belongs to the RTC module
instead of the general GPIO module. It can be used to wake up the chip during deep-
sleep; it can be configured to input or output mode; but it cannot trigger the IO interrupt.
the APIs are shown below.
• gpio16_output_conf(void)
Set the GPIO16 to the output mode.
• gpio16_output_set (uint8 value)
Output high/low level from GPIO16. Configure GPIO16 to the output mode first.
• gpio16_input_conf(void)
Set the GPIO16 to the input mode.
• gpio16_input_get(void)
Read the GPIO16 input level status. Configure GPIO16 to the input mode first.
36
Dept.of.ECE
2.7.Install the ESP8266 Board Package
Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into
Additional Board Manager URLsfield in the Arduino v1.6.4+ preferences.
Fig.2.11. a. References
Click ‘File’ -> ‘Preferences’ to access this panel.
Next, use the Board manager to install the ESP8266 package.
37
Dept.of.ECE
Click ‘Tools’ -> ‘Board:’ -> ‘Board Manager…’ to access this panel.
Scroll down to ‘esp8266 by ESP8266 Community’ and click “Install” button to install
the ESP8266 library package.
Once installation completed, close and re-open Arduino IDE for ESP8266 library to take
effect.
Fig.2.11.c.Dropdown Menu
80 MHz as the CPU frequency (you can try 160 MHz overclock later)
38
Dept.of.ECE
Select ‘115200’ baud upload speed is a good place to start - later on you can try higher
speeds but 115200 is a good safe place to start.
39
Dept.of.ECE
3. OLED (Organic Light Emitting Diodes)
OLED (Organic Light Emitting Diodes) is a flat light emitting technology, made by
placing a series of organic thin films between two conductors. When electrical current
is applied, a bright light is emitted. OLEDs are emissive displays that do not require a
backlight and so are thinner and more efficient than LCD displays (which do require a
white backlight).
OLED displays are not just thin and efficient - they provide the best image quality ever
and they can also be made transparent, flexible, foldable and even rollable and
stretchable in the future. OLEDs represent the future of display technology!
OLED vs LCD
An OLED display have the following advantages over an LCD display:
• Improved image quality - better contrast, higher brightness, fuller viewing angle, a
wider color range and much faster refresh rates.
• Lower power consumption.
• Simpler design that enables ultra-thin, flexible, foldable and transparent displays
• Better durability - OLEDs are very durable and can operate in a broader
temperature range
Fig.2.12 OLED
40
Dept.of.ECE
• Wearable OLEDs
• Foldable OLEDs and rollable OLEDs which can be used to create new mobile
devices
• Transparent OLEDs embedded in windows or car windshdields
• And many more we cannot even imagine today...
Flexible OLEDs are already on the market for many years (in smartphones, wearables
and other devices) and since 2019, with the introduction of the Samsung Galaxy Fold,
foldable devices are increasing in popularity. In 2019 LG also announced the world's
first rollable OLED - its 65" OLED R TV that can roll into its base!
An OLED is made by placing a series of organic thin films between two conductors.
When electrical current is applied, a bright light is emitted. Click here for a more
detailed view of the OLED technology.
OLEDs are organic because they are made from carbon and hydrogen. There's no
connection to organic food or farming - although OLEDs are very efficient and do not
contain any bad metals - so it's a real green technology.
OLED is the best display technology - and indeed OLED panels are used today to create
the most stunning TVs ever - with the best image quality combined with the thinnest
sets ever. And this is only the beginning, as in the future OLED will enable
large rollable and transparent TVs!
Currently the only company that produces OLED TV panels is LG Display. The Korean
display maker is producing a wide range of OLED TV panels, offering these to LG
Electronics, Panasonic, Sony, Philips and others.
OLED white lighting
OLEDs can be used to create excellent light source. OLEDs offer diffuse area lighting
and can be flexible, efficient, light, thin, transparent, color-tunable and more. OLEDs
enable new designs and these devices emit healthier light compared to CFLs and LED
lighting devices.
Specifications
• Use CHIP No.SH1106
• Use 3.3V-5V POWER SUPPLY
• Graphic LCD 1.3” in width with 128x64 Dot Resolution
41
Dept.of.ECE
• White Display is used for the model OLED 1.3 I2C WHITE and blue Display is
used for the model OLED 1.3 I2C BLUE
• Use I2C Interface
• Directly connect signal to Microcontroller 3.3V and 5V without connecting
through Voltage Regulator Circuit
• Total Current when running together is 8 mA - PCB Size: 33.7 mm x 35.5 mm
Example of connecting with Board Arduino This example illustrates how to connect
together with Board Arduino, in this case, it is Board ET-BASE AVR EASY328. It is
used together with Program Arduino and Library to connect and communicate to
Module OLED. - Firstly, install Library“u8glib”; go to Menu Sketch > Include Library
> Add.ZIP Library...
42
Dept.of.ECE
43
Dept.of.ECE
2.9. BLUETOOTH
Bluetooth is a wireless technology standard for exchanging data over short
distances (using short-wavelength UHF radio waves in the ISM band from 2.4 to 2.485
GHz) from fixed and mobile devices and building personal area networks (PANs). In
1994 a group of engineers at Ericsson, a Swedish company, invented a wireless
communication technology, later called Bluetooth. In 1998, the original group of
Promoter companies—Ericsson, Intel, Nokia, Toshiba and IBM—came together to form
the Bluetooth Special Interest Group (SIG).
Bluetooth networking transmits data via low-power radio waves. It
communicates on a frequency of 2.45 gigahertz (actually between 2.402 GHz and 2.480
GHz, to be exact). This frequency band has been set aside by international agreement
for the use of industrial, scientific and medical devices (ISM). By comparison, the most
powerful cell phones can transmit a signal of 3 watts. The low power limits the range of
a Bluetooth device to about 10 meters (32 feet), cutting the chances of interference
between your computer system and your portable telephone or television.
DIFFERENCE
There are many other wireless communication techniques are available in the market
like IEEE 802.11 (Wi-Fi), IrDA, GSM, GPRS etc. But still Bluetooth is very popular
among them. There are many reasons like some techniques required huge infrastructure
like GSM, GPRS etc. and also, they are not suitable for Adhoc networks like Bluetooth.
44
Dept.of.ECE
But some wireless communications techniques are there that are the competitors of
Bluetooth. Some main competitors are IEEE 802.11 and IrDA (Infrared Data
Association). In this section we will discuss the differences b/w these and Bluetooth.
• IEEE 802.11
It is a family of IEEE standards for wireless LANs that were designed to extend 802.3
(wired Ethernet) into the wireless domain. The 802.11 standard is more widely known
as "Wi-Fi". Based on the Bluetooth Specification, is now an IEEE standard under the
denomination of 802.15 WPANs
The first 802.11 specifications were introduced in 1997 and included two spread
spectrum methods for transmission in the unlicensed 2.4GHz band: 1 Mbps frequency
hopping (FHSS) and 1 and 2 Mbps direct sequence (DSSS).
11b
In 1999, 802.11b boosted speed to 11 Mbps using DSSS. The 1 and 2 Mbps DSSS
modes are still valid, and devices can throttle down to the lower speeds to maintain a
connection when signals are weak.
An 802.11 system works in two modes. In "infrastructure" mode, wireless devices
communicate to a wired LAN via base stations known as "access points." Each access
point and its wireless devices are known as a Basic Service Set (BSS). An Extended
Service Set (ESS) is two or more BSSs in the same subnet.
In "ad hoc" mode, also known as "peer-to-peer" mode, wireless devices communicate
with each other directly without an access point. This is an Independent BSS (IBSS).
Data
Peak Data Relative Voice network
Range network
Rate Cost support
support
IEEE
2 Mbps 50m Medium Via IP TCP / IP
802.11
IrDA 16 Mbps < 2m Low Via IP Via PPP
Bluetooth 1 Mbps < 10m Medium Via IP and cellular Via PPP
HomeRF 1.6 Mbps 50m Medium Via IP and PSTN TCP / IP
COMMUNICATION
A Bluetooth transceiver is a frequency hopping spread-spectrum (FHSS) device
that uses the unlicensed (worldwide) 2.4 GHz ISM (Industrial, Scientific, Medical)
45
Dept.of.ECE
frequency band. In most countries, there are 79 channels available. The nominal
bandwidth for each channel is 1MHz. When connected to other Bluetooth devices, a
Bluetooth device hops (changes frequencies) at the rate of 1600 times per second for
typical use, with a residence time of 625 µsec.
When in inquiry or page mode, it hops at 3200 hops per second with a residence
time of 312.5 µsec. A Bluetooth transceiver uses all 79 channels, and hops pseudo-
randomly across all channels at a rate of 1600 hops per second for standard
transmissions. It has a range of approximately10 meters, although ranges up to 100
meters can be achieved with amplifiers. Because the transceiver has an extremely small
footprint, it is easily embedded into physical devices, making it a truly ubiquitous radio
link. The Bluetooth specification uses time division duplexing (TDD) and time division
multiple access (TDMA) for device communication.
A single time slot is 625 µ sec in length, representing the length of a single-slot
packet. At the Baseband layer, a packet consists of an access code, a header, and the
payload, as shown in Fig. 3. The access code contains the piconet address (to filter out
messages from other piconets) and is usually 72 bits in length. The header contains link
control data, encoded with a forward error-correcting code (FEC) with a 1/3 rate for
high reliability. Such code is a repetition code and thus every bit in the header is
transmitted three times. The header is usually 18 bits in length, and includes the active
member address for a currently active slave.
The payload can contain from 0 to 2745 bits of data, and may be protected by a
1/3 rate FEC (simple bit repetition, for SCO packets only), a 2/3 rate FEC (which is a
(15,10) shortened Hamming code capable of correcting all one-bit errors and detecting
all two-bit errors), or a 3/3/ rate (no FEC). For SCO connections, packets must be exactly
one time-slot in length. For ACL links, packets may be 1, 3, or 5 time slots in length.
Bluetooth uses polling-based packet transmission. All communication between devices
takes place between a master and a slave, using time-division duplex (TDD), with no
direct slave-to slave communication.
The master will poll each active slave to determine if it has data to transmit. The
slave may only transmit data when it has been polled. Also, it must send its data in the
time slot immediately following the one in which it was polled. The master transmits
only in even numbered time slots, while the slaves transmit only in odd-numbered time
slots. In each time slot, a different frequency channel f is used (a hop in the hopping
sequence).
46
Dept.of.ECE
47
Dept.of.ECE
BLUETOOTH MODULE
Baseband - There are two basic types of physical links that can be established between
a master and a slave:
• Synchronous Connection Oriented (SCO)
• Asynchronous Connection-Less (ACL)
An SCO link provides a symmetric link between the master and the slave, with
regular periodic exchange of data in the form of reserved slots. Thus, the SCO link
provides a circuit-switched connection where data are regularly exchanged, and as such
it is intended for use with time-bounded information as audio. A master can support up
to three SCO links to the same or to different slaves. A slave can support up to three
SCO links from the same master.
An ACI link is a point-to-multipoint link between the master and all the slaves on
the piconet. It can use all of the remaining slots on the channel not used for SCO links.
The ACL link provides a packet-switched connection where data are exchanged
sporadically, as they become available from higher layers of the stack. The traffic over
the ACL link is completely scheduled by the master.
Each Bluetooth device has a 48 bit IEEE MAC address that is used for the
derivation of the access code. The access code has pseudo-random properties and
includes the identity of the piconet master. All the packets exchanged on the channel are
identified by this master identity. That prevents packets sent in one piconet to be falsely
accepted by devices in another piconet that happens to use the same hopping frequency
in the certain time slot. . All packets have the same format, starting with an access code,
followed by a packet header and ending with the user payload.
48
Dept.of.ECE
The Link Controller - The link control layer is responsible for managing device
discoverability, establishing connections and maintaining them. In Bluetooth, three
elements have been defined to support connection establishment: scan, page and inquiry.
Inquiry is a process in which a device attempts to discover all the Bluetooth
enabled devices in its local area. A unit that wants to make a connection broadcasts an
inquiry message that induces the recipients to return their addresses. Units that receive
the inquiry message return an FHS (FH-synchronization) packet which includes, among
other things, their identity and clock information. The identity of the recipient is required
to determine the page message and wake-up sequence. For the return of FHS packets, a
random back off mechanism is used to prevent collisions.
Inquiry
o
o
o
Laptop Mobile
Computer Inquiry Phone
FHS
A unit in idle mode wants to sleep most of the time to save power, but, from time
to time, it also has to listen whether other units want to connect (page scan). In truly ad
hoc system, there is no common control channel a unit can lock to in order to listen for
page messages. So, every time the unit wakes up, it scans at a different hop carrier for
an extended time. A trade-off has to be made between idle mode power consumption
and response time: increasing the sleep time reduces power consumption but prolongs
the time before an access can be made. The unit that wants to connect has to solve the
frequency-time uncertainty: it doesn't know when the idle unit will wake up and on
which frequency. For that reason, the paging unit transmits the access code repeatedly
at different frequencies: every 1.25ms the paging unit transmits two access codes and
listens twice for a response. In 10ms period, 16 different hop carriers are visited. If the
idle unit wakes up in any of these 16 frequencies, it will receive the access code and
start with a connection setup procedure. First, it will notify the paging unit by returning
a message, and then it will transmit a FHS packet which contains all of the pager's
information. This information is then used by both units to establish the piconet. Once
49
Dept.of.ECE
a baseband link is established, the master and slave can exchange roles if they wish, so
that slave becomes master and master becomes slave.
It should be noted that the control of links rests completely with the local device.
If it doesn't make itself discoverable by page scanning it cannot be found, if it does not
make itself connectable by page scanning it cannot be linked with, and once in a
connection it is free to disconnect without warning at any time.
Audio - Audio data is carried via SCO (Synchronous Connection Oriented) channels.
These SCO channels use pre-reserved slots to maintain temporal consistency of the
audio carried on them. This allows us to build devices such as wireless headsets,
microphones and headphones using Bluetooth for many consumer products such as
cellular phones, call centre switchboards, or even personal musical playback.
There are two routes for audio to pass through a Bluetooth system: through the
HCI as data in HCI packets, and via direct PCM connection to the baseband CODECs.
Data
Control
Audio L2CAP
The Link Manager - The host drives a Bluetooth device through Host Controller
Interface (HCI) commands, but it is the link manager that translates those commands
into operations at the baseband level. Its main functions are to control piconet
50
Dept.of.ECE
management (establishing and destruction of the links and role change), link
configuration, and security and QoS functions.
Link manager communicates with its peers on other devices using the Link
Management Protocol (LMP). Every LMP message begins with a flag bit which is 0 if
a master initiated the transaction and 1 if the slave initiated the transaction. That bit is
followed by a 7-bit Operation Code, and by the message's parameters.
When a link is first set up, it uses single-slot packets by default. Multi-slot
packets make more efficient use of the band, but there are some occasions when they
can't be used, for example on noisy links or if SCO links don't leave sufficient space
between their slots for multi-slot packets.
BLUETOOTH HOST
Logical Link Control and Adaptation Protocol (L2CAP) - Logical Link Control and
Adaptation Protocol takes data from higher layers of the Bluetooth stack and from
applications and sends them over the lower layers of the stack. It passes packets either
to the HCI, or in a host-less system directly to the Link Manager. The major functions
of the L2CAP are:
• Multiplexing between different higher layer protocols to allow several higher
layer links to share a single ACL connection. L2CAP uses channel numbers to
label packets so that, when they are received, they can be routed to the correct
place.
• Segmentation and reassembly to allow transfer of larger packets than lower layers
support.
• Quality of service management for higher layer protocols.
51
Dept.of.ECE
All applications must use L2CAP to send data. It is also used by Bluetooth's
higher layers such as RFCOMM and SDP, so L2CAP is a compulsory part of every
Bluetooth system.
RFCOMM - RFCOMM is a simple, reliable transport protocol that provides emulation
of the serial cable line settings and status of an RS-232 serial port. It provides
connections to multiple devices by relying on L2CAP to handle multiplexing over single
connection. RFCOMM supports two types of devices:
• Type 1 - Internal emulated serial port. These devices usually are the end of a
communication path, for example a PC or printer.
• Type 2 - Intermediate device with physical serial port. These are devices that sit
in the middle of a communication path, for example a modem.
Up to 30 data channels can be set up, so RFCOMM can theoretically support 30
different services at once. RFCOMM is based on GSM TS 07.10 standard, which is an
asymmetric protocol used by GSM cellular phones to multiplex several streams of data
onto one physical serial cable.
The Service Discovery Protocol - One of the most important members of the Bluetooth
protocol stack is Service Discovery Protocol (SDP). It provides a means for an SDP
client to access information about services offered by SDP servers. An SDP server is
any Bluetooth device which offers services to other Bluetooth devices. Information
about services is maintained in SDP databases. There is no centralized database, so each
SDP server maintains its own database. The SDP database is simply a set of records
describing all the services which a Bluetooth device can offer to another Bluetooth
device, and service discovery protocol provides a means for another device to look at
these records. To make it easier to find the service you want, services are arranged in a
hierarchy structure as a tree which can be browsed. Clients begin by examining the root
of the tree, then follow the hierarchy out to the leaf nodes where individual services are
described.
To browse service classes, or get information about a specific service, SDP
clients and servers exchange messages which are carried in SDP Protocol Data Units
(PDUs). The first byte of PDU is an ID, identifying the message in the PDU. Services
have Universally Unique Identifiers (UUIDs) that describe them. The services defined
by the Bluetooth profiles have UUIDs assigned by the standard, but service providers
can define their own services and assign their own UUIDs to those services.
52
Dept.of.ECE
SDP relies on L2CAP links being established between SDP client and server,
before retrieving SDP information. Stages in setting up an SDP connection are shown
Inquiry
Link Controller Paging
Connection Setup
LMP_host connection_req
LMP_accepted
LMP_name_req
LMP_name_res
Link Manager
Remote Device
Local Device
(SDP Server)
(SDP Client)
Connection Setup
Authentication
LMP_Setup_complete
LMP_Setup_complete
L2CAP_connection_req
L2CAP
Connection Setup L2CAP_connection_res
SDP_inquires
SDP Session SDP_responses
on a figure.
The Wireless Access Protocol (WAP) - WAP provides a protocol stack similar to the
IP stack, but it is tailored for the needs of mobile devices. It supports the limited display
size and resolution typically found on mobile devices by providing special formats for
Web pages which suit their capabilities. It also provides for the low bandwidth of mobile
53
Dept.of.ECE
devices by defining a method for WAP content to be compressed before it is transmitted
across a wireless link. WAP can use Bluetooth as a bearer layer in the same way as it
can use GSM, CDMA and other wireless services. The WAP stack is joined to the
Bluetooth stack using User Datagram Protocol (UDP), Internet Protocol (IP) and Point
to Point Protocol (PPP).
The Bluetooth profiles are organized into groups, with each profile building
upon the one beneath and inheriting features from below. For developers, this means
54
Dept.of.ECE
that key features of one Bluetooth solution can be reused in other solutions, bringing
down development costs and speeding up the development cycle.
55
Dept.of.ECE
SECURITY
Basic security elements need to be considered to prevent unauthorized usage and
eavesdropping in Bluetooth system though it is mainly intended for short-range
connectivity between personal devices. Security features are included at the link level
and are based on a secret link key that is shared by a pair of devices. To generate this
key a pairing procedure is used when the two devices communication for the first time.
At connection establishment, an authentication process is carried out to verify
the identities of the units involved. The authentication process uses a conventional
challenge-response routine. The verifier compares signed response (SRES) produced by
the claimant with its own SRES and decides if the challenger may continue with
connection establishment. To prevent eavesdropping on the link, which is a danger
inherent to radio communications, the payload of each packet is encrypted. Encryption
is based on stream ciphering; the payload bits are modulo-2 added to a binary key
stream.
The central element in the security process is the 128-bit link key. This link key
is a secret key residing in the Bluetooth hardware and is not accessible by the user. The
link key is generated during an initialization phase. Once the initialization has been
carried out, the 128-bit link keys reside in the devices and can from then on be used for
automatic authentication without user interaction. In addition, methods are available to
use the same encryption keys for all slaves in a single piconet.
Bluetooth provides limited number of security elements at the lowest level. More
advanced security procedures can be implemented at higher layers.
Park mode provides the greatest opportunities for power saving. The device only
wakes up in periodic beacon slots when it listens for unpark transmission from the
56
Dept.of.ECE
Master. If it is not unparked, it goes back to sleep, switching off its receiver. Devices
that are parked give up their active member addresses, so one Master can have more
devices in Park mode at once. In Sniff mode, the slave does not scan at every master-to-
slave slot, but has a larger interval between scans. Devices in Sniff mode keep their
active member address. Typically, sniffing devices will be active more often than
parked devices. Both Park and Sniff modes involve putting devices into a state where
they wake up periodically while Hold mode just puts a connection in a low-power state
for a single period. So a Master needs to perform an inquiry to be able to service the
connections again.
In the connection state, current consumption is minimized and wasteful
interference prevented by only transmitting when data is available. In longer periods of
silence, the master needs to send a packet on the channel once in a while such that all
slaves can resynchronize their clocks and compensate for drift. During continuous
TX/RX operations, a unit starts to scan for the access code at the beginning of the RX
slot. If the access code is not found, or even if it is found but the slave address does not
match the recipient, the unit goes to sleep until the next slot. The header indicates what
type of packet it is and how long the packet will last; therefore, the non-addressed
recipients can determine how long they can sleep.
The nominal transmit power used by most Bluetooth applications for short-range
connectivity is 0 dBm. This restricts current consumption and keeps interference to other
systems to a minimum. However, the Bluetooth radio specifications allow TX power up
to 20 dBm. Above 0 dBm, closed-loop received signal strength indication power control
is mandatory. This power control can compensate for propagation losses and slow
fading.
In low-power modes many layers of the Bluetooth protocol stack are involved:
as after periods of inactivity, the device may lose synchronization and need to listen for
transmissions over a wider window than usual, the baseband layer alters correlator
properties. The link manager provides a variety of messages to configure and negotiate
the low-power modes between ends of a connection. HCI provides a set of commands
that may be used by a host to configure and control the power-saving capabilities of a
module. L2CAP must be aware of low-power modes for its quality of service
commitments.
Different Bluetooth devices may have different requirements for data rate, delay
variance, and reliability. The specification provides Quality Of Service (QOS)
57
Dept.of.ECE
configuration for the properties of links according to the requirements of higher layer
applications or protocols. These properties include the type of QOS, token rate, token
rate bucket size, peak bandwidth, latency and delay variation.
QOS
Violatio
Violatio
Config.
Config.
QOS
QOS
QOS
QOS
L2CAP QOS
Logical Link Control and Adaptation Logical Link Control and Adaptation
Violatio
Violatio
QOS
QOS
QOS
QOS
Host Controller Interface Host Controller Interface
Violatio
Violatio
QOS
QOS
QOS
QOS
LMP QOS
Link Manager Link Manager
Informat
Informat
Link
Link
Link
Link
Link Manager Link Manager
58
Dept.of.ECE
rather than run it at an inappropriate quality, or shut down other links to improve this
link. In such case, lower layers send QOS violation events to tell the higher layers and
let them decide what to do about it.
59
Dept.of.ECE
clocks in a house following the power outage. Or, to have a Bluetooth link between the
roller blades and a speedometer in a digital watch. But all these applications will have
to wait for some more time before they hit the market, since there is still a lot of work
to be done, mostly regarding interoperability issues and final test procedures for
Bluetooth products.
2.11 ULN2003:-
The ULN2003 is a monolithic IC consists of seven NPN darlington transistor pairs with
high voltage and current capability. It is commonly used for applications such as relay
drivers, motor, display drivers, led lamp drivers, logic buffers, line drivers, hammer
drivers and other high voltage current applications. It consists of common cathode clamp
diodes for each NPN darlington pair which makes this driver IC useful for switching
inductive loads.
The output of the driver is open collector and the collector current rating of each
darlington pair is 500mA. Darlington pairs may be paralleled if higher current is
required. The driver IC also consists of a 2.7KΩ base resistor for each darlington pair.
Thus each darlington pair can be operated directly with TTL or 5V CMOS devices. This
driver IC can be used for high voltage applications up to 50V.
60
Dept.of.ECE
Fig 2.11.1 Logic Diagram of ULN2003
Note that the driver provides open collector output, so it can only sink current, cannot
source. Thus when a 5V is given to 1B terminal, 1C terminal will be connected to ground
via darlington pair and the maximum current that it can handle is 500A. From the above
logic diagram we can see that cathode of protection diodes are shorted to 9th pin called
COM. So for driving inductive loads, it must connect to the supply voltage.
ULN2003 is widely used in relay driving and stepper motor driving applications.
FEATURES
* 500mA rated collector current (Single output)
* High-voltage outputs: 50V
* Inputs compatible with various types of logic.
* Relay driver application
61
Dept.of.ECE
2.12 RELAY
INTRODUCTION
A relay is an electromechanical switch, which perform ON and OFF operations
without any human interaction. General representation of double contact relay is
shown in fig. Relays are used where it is necessary to control a circuit by a low-power
signal (with complete electrical isolation between control and controlled circuits), or
where several circuits must be controlled by one signal.
Fig2.12. Relay
History
The first relay was invented by Joseph Henry in 1835. The name relay derives
from the French noun relays’ that indicates the horse exchange place of the postman.
Generally a relay is an electrical hardware device having an input and output gate. The
output gate consists in one or more electrical contacts that switch when the input gate is
electrically excited. It can implement a decoupled, a router or breaker for the electrical
power, a negation, and, on the base of the wiring, complicated logical functions
containing and, or, and flip-flop. In the past relays had a wide use, for instance the
telephone switching or the railway routing and crossing systems. In spite of electronic
progresses (as programmable devices), relays are still used in applications where
ruggedness, simplicity, long life and high reliability are important factors (for instance
in safety applications)
Working
Generally, the relay consists a inductor coil, a spring (not shown in the figure),
Swing terminal, and two high power contacts named as normally closed (NC) and
normally opened (NO). Relay uses an Electromagnet to move swing terminal between
62
Dept.of.ECE
two contacts (NO and NC). When there is no power applied to the inductor coil (Relay
is OFF), the spring holds the swing terminal is attached to NC contact.
Whenever required power is applied to the inductor coil, the current flowing
through the coil generates a magnetic field which is helpful to move the swing terminal
and attached it to the normally open (NO) contact. Again when power is OFF, the spring
restores the swing terminal position to NC.
Advantage of relay:
A relay takes small power to turn ON, but it can control high power devices to
switch ON and OFF. Consider an example; a relay is used to control the ceiling FAN at
our home. The ceiling FAN may runs at 230V AC and draws a current maximum of 4A.
Therefore the power required is 4X230 = 920 watts. Off course we can control AC,
lights, etc., depend up on the relay ratings. Relays can be used to control DC motors in
ROBOTICs.
63
Dept.of.ECE
2.13 DC MOTOR
A DC motor in simple words is a device that converts direct current(electrical
energy) into mechanical energy. It’s of vital importance for the industry today.
A DC motor is designed to run on DC electric power. Two examples of pure DC
designs are Michael Faraday's homo-polar motor (which is uncommon), and the ball
bearing motor, which is (so far) a novelty.
By far the most common DC motor types are the brushed and brushless types,
which use internal and external commutation respectively to create an oscillating AC
current from the DC source—so they are not purely DC machines in a strict sense.
We in our project are using brushed DC Motor, which will operate in the ratings
of 12v DC 0.6A.
The speed of a DC motor can be controlled by changing the voltage applied to
the armature or by changing the field current. The introduction of variable resistance in
the armature circuit or field circuit allowed speed control. Modern DC motors are often
controlled by power electronics systems called DC drives.
Fig.2.13 Motor
Usage
The DC motor or Direct Current Motor to give it its full title, is the most commonly
used actuator for producing continuous movement and whose speed of rotation can
easily be controlled, making them ideal for use in applications were speed control, servo
type control, and/or positioning is required. A DC motor consists of two parts, a "Stator"
which is the stationary part and a "Rotor" which is the rotating part. The result is that
there are basically three types of DC Motor available.
64
Dept.of.ECE
2.14 BUZZER
A buzzer or beeper is a signaling device, usually electronic, typically used in
automobiles, house hold appliances such as a microwave oven, or game shows.
It most commonly consists of a number of switches or sensors connected to a control
unit that determines if and which button was pushed or a preset time has lapsed, and
usually illuminates a light on the appropriate button or control panel, and sounds a
warning in the form of a continuous or intermittent buzzing or beeping sound. Initially
this device was based on an electromechanical system which was identical to an electric
bell without the metal gong (which makes the ringing noise). Often these units were
anchored to a wall or ceiling and used the ceiling or wall as a sounding board. Another
implementation with some AC-connected devices was to implement a circuit to make
the AC current into a noise loud enough to drive a loudspeaker and hook this circuit up
to a cheap 8-ohm speaker. Nowadays, it is more popular to use a ceramic-based
piezoelectric sounder like a Sonalert which makes a high-pitched tone. Usually these
were hooked up to “driver” circuits which varied the pitch of the sound or pulsed the
sound on and off.
In game shows it is also known as a “lockout system,” because when one person signals
(“buzzes in”), all others are locked out from signalling. Several game shows have large
buzzer buttons which are identified as “plungers”.
65
Dept.of.ECE
CHAPTER 3
In 1995, “thing to thing” was coined by BILL GATES. In 1999, IoT (Internet of
Things) was come up by EPC global. IOT interconnects human to thing, thing to thing
and human to human. The goal of IoT is bring out a huge network by combining
different types connected devices. IoT targets three aspects Communication,
automation, cost saving in a system. IOT empowers people to carry out routine activities
using internet and thus saves time and cost making them more productive. IOT enables
the objects to be sensed and/or controlled remotely across existing network model. IOT
in environmental monitoring helps to know about the air and water quality, temperature
and conditions of the soil, and also monitor the intrusion of animals in to the field. IOT
can also play a significant role in precision farming to enhance the productivity of the
farm.
Recent advancements, such as the vision of the Internet of Things (IoT), the
cloud computing model, and cyber-physical systems, provide support for the
transmission and management of huge amounts of data regarding the trends observed in
environmental parameters. In this context, the current work presents three different IoT-
based wireless sensors
for environmental and ambient monitoring: one employing User Datagram Protocol
(UDP)-based Wi-Fi communication, one communicating through Wi-Fi and Hypertext
Transfer Protocol (HTTP), and a third one using Bluetooth Smart. All of the presented
systems provide the possibility of recording data at remote locations and of visualizing
them from every device with an Internet connection, enabling the monitoring of
geographically large areas. The development details of these systems are described,
along with the major differences and similarities between them. The feasibility of the
three developed systems for implementing monitoring applications, taking into account
66
Dept.of.ECE
their energy autonomy, ease of use, solution complexity, and Internet connectivity
facility, was analysed, and revealed that they make good candidates for IoT-based
solutions.
Nowadays, IoT is one of the most advanced, efficient, and cost less technological
solution which encompasses various hardware and software resources; and allows
remotely connected sensing devices to sense with more capabilities, provides efficiency
and can be monitored and controlled through deployed of existing systems or
infrastructures, resulting the physical World integration with computer controllers (or
systems).
When IoT is augmented with sensors and actuators, the technology becomes an
instance of the more general class of cyber-physical systems, which also encompasses
technologies such as smart grids, smart homes, intelligent transportation and smart
cities. Each thing is uniquely identifiable through its embedded computing system but
67
Dept.of.ECE
is able to interoperate within the existing Internet infrastructure. Experts estimate that
the IoT will consist of almost 50 billion objects by 2020.
68
Dept.of.ECE
do most of the work without human intervention, although people can interact with the
devices -- for instance, to set them up, give them instructions or access the data.
The connectivity, networking and communication protocols used with these web-
enabled devices largely depend on the specific IoT applications deployed.
IoT can also make use of artificial intelligence (AI) and machine learning to aid in
making data collecting processes easier and more dynamic.
Fig 3.1 Example of an IOT system
69
Dept.of.ECE
As such, IoT is one of the most important technologies of everyday life, and it will
continue to pick up steam as more businesses realize the potential of connected devices
to keep them competitive.
What are the benefits of IoT to organizations?
The internet of things offers several benefits to organizations. Some benefits are
industry-specific, and some are applicable across multiple industries. Some of the
common benefits of IoT enable businesses to:
• monitor their overall business processes;
• improve the customer experience (CX);
• save time and money;
• enhance employee productivity;
• integrate and adapt business models;
• make better business decisions; and
• generate more revenue.
IoT encourages companies to rethink the ways they approach their businesses and gives
them the tools to improve their business strategies.
Generally, IoT is most abundant in manufacturing, transportation and utility
organizations, making use of sensors and other IoT devices; however, it has also found
use cases for organizations within the agriculture, infrastructure and home automation
industries, leading some organizations toward digital transformation.
IoT can benefit farmers in agriculture by making their job easier. Sensors can collect
data on rainfall, humidity, temperature and soil content, as well as other factors, that
would help automate farming techniques.
The ability to monitor operations surrounding infrastructure is also a factor that IoT can
help with. Sensors, for example, could be used to monitor events or changes within
structural buildings, bridges and other infrastructure. This brings benefits with it, such
as cost saving, saved time, quality-of-life workflow changes and paperless workflow.
A home automation business can utilize IoT to monitor and manipulate mechanical and
electrical systems in a building. On a broader scale, smart cities can help citizens reduce
waste and energy consumption.
IoT touches every industry, including businesses within healthcare, finance, retail and
manufacturing.
70
Dept.of.ECE
Some of the advantages of IoT include the following:
• ability to access information from anywhere at any time on any device;
• improved communication between connected electronic devices;
• transferring data packets over a connected network saving time and money; and
• automating tasks helping to improve the quality of a business's services and
reducing the need for human intervention.
Some disadvantages of IoT include the following:
• As the number of connected devices increases and more information is shared
between devices, the potential that a hacker could steal confidential information
also increases.
• Enterprises may eventually have to deal with massive numbers -- maybe even
millions -- of IoT devices, and collecting and managing the data from all those
devices will be challenging.
• If there's a bug in the system, it's likely that every connected device will become
corrupted.
• Since there's no international standard of compatibility for IoT, it's difficult for
devices from different manufacturers to communicate with each other.
71
Dept.of.ECE
• OneM2M is a machine-to-machine service layer that can be embedded in
software and hardware to connect devices. The global standardization body,
OneM2M, was created to develop reusable standards to enable IoT applications
across different verticals to communicate.
• Data Distribution Service (DDS) was developed by the Object Management
Group (OMG) and is an IoT standard for real-time, scalable and high-
performance M2M communication.
• Advanced Message Queuing Protocol (AMQP) is an open source published
standard for asynchronous messaging by wire. AMQP enables encrypted and
interoperable messaging between organizations and applications. The protocol
is used in client-server messaging and in IoT device management.
• Constrained Application Protocol (CoAP) is a protocol designed by the IETF
that specifies how low-power, compute-constrained devices can operate in the
internet of things.
• Long Range Wide Area Network (LoRaWAN) is a protocol for WANs
designed to support huge networks, such as smart cities, with millions of low-
power devices.
72
Dept.of.ECE
based OS for the development of embedded low-power devices, and Weave, an
IoT-oriented communication protocol that serves as the communication
language between the device and the cloud.
• Calvin is an open source IoT platform released by Ericsson designed for
building and managing distributed applications that enable devices to talk to
each other. Calvin includes a development framework for application
developers, as well as a runtime environment for handling the running
application.
73
Dept.of.ECE
In a smart city, IoT sensors and deployments, such as smart streetlights and smart
meters, can help alleviate traffic, conserve energy, monitor and address environmental
concerns, and improve sanitation.
74
Dept.of.ECE
CHAPTER 4
SOFTWARE SPECIFICATION
4.1 The Arduino Integrated Development Environment
Arduino Software (IDE) - contains a text editor for writing code, a message area, a text
console, a toolbar with buttons for common functions and a series of menus. It connects
to the Arduino and Genuino hardware to upload programs and communicate with them.
WRITING SKETCHES
Programs written using Arduino Software (IDE) are called sketches. These sketches are
written in the text editor and are saved with the file extension .ino. The editor has
features for cutting/pasting and for searching/replacing text. The message area gives
feedback while saving and exporting and also displays errors. The console displays text
output by the Arduino Software (IDE), including complete error messages and other
information. The bottom righthand corner of the window displays the configured board
and serial port. The toolbar buttons allow you to verify and upload programs, create,
open, and save sketches, and open the serial monitor.
NB: Versions of the Arduino Software (IDE) prior to 1.0 saved sketches with the
extension .pde. It is possible to open these files with version 1.0, you will be prompted
to save the sketch with the .ino extension on save.
Verify
Checks your code for errors compiling it.
Upload
Compiles your code and uploads it to the configured board.
See uploading below for details.
Note: If you are using an external programmer with your board, you can
hold down the "shift" key on your computer when using this icon. The text
will change to "Upload using Programmer"
New
Creates a new sketch.
75
Dept.of.ECE
Open
Presents a menu of all the sketches in your sketchbook. Clicking one will
open it within the current window overwriting its content.
Note: due to a bug in Java, this menu doesn't scroll; if you need to open a
sketch late in the list, use the File | Sketchbookmenu instead.
Save
Saves your sketch.
Serial Monitor
Opens the serial monitor.
Additional commands are found within the five menus: File, Edit, Sketch, Tools, Help.
The menus are context sensitive, which means only those items relevant to the work
currently being carried out are available.
76
Dept.of.ECE
FILE
• New
Creates a new instance of the editor, with the bare minimum structure of a sketch already
in place.
• Open
Allows to load a sketch file browsing through the computer drives and folders.
• Open Recent
Provides a short list of the most recent sketches, ready to be opened.
• Sketchbook
Shows the current sketches within the sketchbook folder structure; clicking on any name
opens the corresponding sketch in a new editor instance.
• Examples
Any example provided by the Arduino Software (IDE) or library shows up in this menu
item. All the examples are structured in a tree that allows easy access by topic or library.
• Close
Closes the instance of the Arduino Software from which it is clicked.
• Save
Saves the sketch with the current name. If the file hasn't been named before, a name will
be provided in a "Save as.." window.
• Save as...
Allows to save the current sketch with a different name.
• Page Setup
It shows the Page Setup window for printing.
77
Dept.of.ECE
• Print
Sends the current sketch to the printer according to the settings defined in Page Setup.
• Preferences
Opens the Preferences window where some settings of the IDE may be customized, as
the language of the IDE interface.
• Quit
Closes all IDE windows. The same sketches open when Quit was chosen will be
automatically reopened the next time you start the IDE.
EDIT
• Undo/Redo
Goes back of one or more steps you did while editing; when you go back, you may go
forward with Redo.
• Cut
Removes the selected text from the editor and places it into the clipboard.
• Copy
Duplicates the selected text in the editor and places it into the clipboard.
• Copy for Forum
Copies the code of your sketch to the clipboard in a form suitable for posting to the
forum, complete with syntax coloring.
• Copy as HTML
Copies the code of your sketch to the clipboard as HTML, suitable for embedding in
web pages.
• Paste
Puts the contents of the clipboard at the cursor position, in the editor.
• Select All
Selects and highlights the whole content of the editor.
• Comment/Uncomment
Puts or removes the // comment marker at the beginning of each selected line.
• Increase/Decrease Indent
Adds or subtracts a space at the beginning of each selected line, moving the text one
space on the right or eliminating a space at the beginning.
78
Dept.of.ECE
• Find
Opens the Find and Replace window where you can specify text to search inside the
current sketch according to several options.
• Find Next
Highlights the next occurrence - if any - of the string specified as the search item in
the Find window, relative to the cursor position.
• Find Previous
Highlights the previous occurrence - if any - of the string specified as the search item
in the Find window relative to the cursor position.
SKETCH
• Verify/Compile
Checks your sketch for errors compiling it; it will report memory usage for code and
variables in the console area.
• Upload
Compiles and loads the binary file onto the configured board through the configured
Port.
79
Dept.of.ECE
• Upload Using Programmer
This will overwrite the bootloader on the board; you will need to use Tools > Burn
Bootloader to restore it and be able to Upload to USB serial port again. However, it
allows you to use the full capacity of the Flash memory for your sketch. Please note
that this command will NOT burn the fuses. To do so a Tools -> Burn
Bootloader command must be executed.
• Export Compiled Binary
Saves a .hex file that may be kept as archive or sent to the board using other tools.
• Show Sketch Folder
Opens the current sketch folder.
• Include Library
Adds a library to your sketch by inserting #include statements at the start of your code.
For more details, see libraries below. Additionally, from this menu item you can
access the Library Manager and import new libraries from .zip files.
• Add File...
Adds a source file to the sketch (it will be copied from its current location). The new
file appears in a new tab in the sketch window. Files can be removed from the sketch
using the tab menu accessible clicking on the small triangle icon below the serial
monitor one on the right side o the toolbar.
TOOLS
• Auto Format
This formats your code nicely: i.e. indents it so that opening and closing curly braces
line up, and that the statements inside curly braces are indented more.
80
Dept.of.ECE
• Archive Sketch
Archives a copy of the current sketch in .zip format. The archive is placed in the same
directory as the sketch.
• Fix Encoding & Reload
Fixes possible discrepancies between the editor char map encoding and other
operating systems char maps.
• Serial Monitor
Opens the serial monitor window and initiates the exchange of data with any
connected board on the currently selected Port. This usually resets the board, if the
board supports Reset over serial port opening.
• Board
Select the board that you're using. See below for descriptions of the various boards.
• Port
This menu contains all the serial devices (real or virtual) on your machine. It should
automatically refresh every time you open the top-level tools menu.
• Programmer
For selecting a harware programmer when programming a board or chip and not using
the onboard USB-serial connection. Normally you won't need this, but if
you're burning a bootloader to a new microcontroller, you will use this.
• Burn Bootloader
The items in this menu allow you to burn a bootloader onto the microcontroller on an
Arduino board. This is not required for normal use of an Arduino or Genuino board
but is useful if you purchase a new ATmega microcontroller (which normally come
without a bootloader). Ensure that you've selected the correct board from
the Boards menu before burning the bootloader on the target board. This command
also set the right fuses.
Help
Here you find easy access to a number of documents that come with the Arduino
Software (IDE). You have access to Getting Started, Reference, this guide to the IDE
and other documents locally, without an internet connection. The documents are a
local copy of the online ones and may link back to our online website.
• Find in Reference
This is the only interactive function of the Help menu: it directly selects the relevant
page in the local copy of the Reference for the function or command under the cursor.
81
Dept.of.ECE
SKETCHBOOK
The Arduino Software (IDE) uses the concept of a sketchbook: a standard place to store
your programs (or sketches). The sketches in your sketchbook can be opened from
the File >Sketchbook menu or from the Open button on the toolbar. The first time you
run the Arduino software, it will automatically create a directory for your sketchbook.
You can view or change the location of the sketchbook location from with
the Preferences dialog.
Beginning with version 1.0, files are saved with a .ino file extension. Previous versions
use the .pde extension. You may still open .pde named files in version 1.0 and later, the
software will automatically rename the extension to .ino.
Tabs, Multiple Files, and Compilation
Allows you to manage sketches with more than one file (each of which appears in its
own tab). These can be normal Arduino code files (no visible extension), C files (.c
extension), C++ files (.cpp), or header files (.h).
UPLOADING
Before uploading your sketch, you need to select the correct items from the Tools >
Board and Tools > Port menus. The boards are described below. On the Mac, the serial
port is probably something like /dev/tty.usbmodem241 (for an Uno or Mega2560 or
Leonardo) or /dev/tty.usbserial-1B1 (for a Duemilanove or earlier USB board),
or /dev/tty.USA19QW1b1P1.1 (for a serial board connected with a Keyspan USB-to-
Serial adapter). On Windows, it's probably COM1 or COM2 (for a serial board)
or COM4, COM5, COM7, or higher (for a USB board) - to find out, you look for USB
serial device in the ports section of the Windows Device Manager. On Linux, it should
be /dev/ttyACMx , /dev/ttyUSBx or similar. Once you've selected the correct serial port
and board, press the upload button in the toolbar or select the Upload item from
the Sketch menu. Current Arduino boards will reset automatically and begin the upload.
With older boards (pre-Diecimila) that lack auto-reset, you'll need to press the reset
button on the board just before starting the upload. On most boards, you'll see the RX
and TX LEDs blink as the sketch is uploaded. The Arduino Software (IDE) will display
a message when the upload is complete, or show an error.
When you upload a sketch, you're using the Arduino bootloader, a small program that
has been loaded on to the microcontroller on your board. It allows you to upload code
82
Dept.of.ECE
without using any additional hardware. The bootloader is active for a few seconds when
the board resets; then it starts whichever sketch was most recently uploaded to the
microcontroller. The bootloader will blink the on-board (pin 13) LED when it starts (i.e.
when the board resets).
LIBRARIES
Libraries provide extra functionality for use in sketches, e.g. working with hardware or
manipulating data. To use a library in a sketch, select it from the Sketch > Import
Library menu. This will insert one or more #include statements at the top of the sketch
and compile the library with your sketch. Because libraries are uploaded to the board
with your sketch, they increase the amount of space it takes up. If a sketch no longer
needs a library, simply delete its #includestatements from the top of your code.
There is a list of libraries in the reference. Some libraries are included with the Arduino
software. Others can be downloaded from a variety of sources or through the Library
Manager. Starting with version 1.0.5 of the IDE, you do can import a library from a zip
file and use it in an open sketch. See these instructions for installing a third-party library.
To write your own library, see this tutorial.
Third-Party Hardware
Support for third-party hardware can be added to the hardware directory of your
sketchbook directory. Platforms installed there may include board definitions (which
appear in the board menu), core libraries, bootloaders, and programmer definitions. To
install, create the hardware directory, then unzip the third-party platform into its own
sub-directory. (Don't use "arduino" as the sub-directory name or you'll override the
built-in Arduino platform.) To uninstall, simply delete its directory.
For details on creating packages for third-party hardware, see the Arduino IDE 1.5 3rd
party Hardware specification.
SERIAL MONITOR
Displays serial data being sent from the Arduino or Genuino board (USB or serial
board). To send data to the board, enter text and click on the "send" button or press enter.
Choose the baud rate from the drop-down that matches the rate passed to Serial.begin in
your sketch. Note that on Windows, Mac or Linux, the Arduino or Genuino board will
reset (rerun your sketch execution to the beginning) when you connect with the serial
monitor.
83
Dept.of.ECE
You can also talk to the board from Processing, Flash, MaxMSP, etc (see the interfacing
page for details).
PREFERENCES
Some preferences can be set in the preferences dialog (found under the Arduino menu
on the Mac, or File on Windows and Linux). The rest can be found in the preferences
file, whose location is shown in the preference dialog.
LANGUAGE SUPPORT
Since version 1.0.1, the Arduino Software (IDE) has been translated into 30+ different
languages. By default, the IDE loads in the language selected by your operating system.
(Note: on Windows and possibly Linux, this is determined by the locale setting which
controls currency and date formats, not by the language the operating system is
displayed in.)
If you would like to change the language manually, start the Arduino Software (IDE)
and open the Preferences window. Next to the Editor Language there is a dropdown
menu of currently supported languages. Select your preferred language from the menu,
and restart the software to use the selected language. If your operating system language
is not supported, the Arduino Software (IDE) will default to English.
84
Dept.of.ECE
You can return the software to its default setting of selecting its language based on your
operating system by selecting System Default from the Editor Language drop-down.
This setting will take effect when you restart the Arduino Software (IDE). Similarly,
after changing your operating system's settings, you must restart the Arduino Software
(IDE) to update it to the new default language.
BOARDS
The board selection has two effects: it sets the parameters (e.g. CPU speed and baud
rate) used when compiling and uploading sketches; and sets and the file and fuse settings
used by the burn bootloader command. Some of the board definitions differ only in the
latter, so even if you've been uploading successfully with a particular selection you'll
want to check it before burning the bootloader. You can find a comparison table between
the various boards here.
Arduino Software (IDE) includes the built in support for the boards in the following list,
all based on the AVR Core. The Boards Manager included in the standard installation
allows to add support for the growing number of new boards based on different cores
like Arduino Due, Arduino Zero, Edison, Galileo and so on.
85
Dept.of.ECE
CHAPTER 5
IMPLEMENTATION
5.1 SCHEMATIC
86
Dept.of.ECE
CHAPTER 6
SIMULATION AND DESIGN
6.1 OUTPUT SCREEN SHOTS
87
Dept.of.ECE
CHAPTER 7
CONCLUSION
The aim of this project was to study, assume, estimate and reverse engineer existing
systems in order to design and develop our own home automation system. This goal was
successful as IVA’s design was heavily influenced by the studied home automation
architectures. The network architecture resembles close to that of Belkin’s Wemo
switch, whereas the voice commands and natural language processing is influenced by
the Amazon’s Echo design. A device in a room idea was inculcated in IVA’s
architecture by understanding how Nest thermostat works. Thus, the working prototype
architecture of Intelligent Voice Activated Home Automation (IVA) was developed and
tested based on combination of number of home automation systems designed and
developed by few of the top innovating software and hardware companies like Google,
Amazon, Apple, and Belkin
88
Dept.of.ECE
REFERENCES
89
Dept.of.ECE
[18] Arduino and Android through Wi-Fi:
http://electronics.stackexchange.com/questions/56633/simplest-way-to-connect-
anrduino
-to-android-wirelessly
[19] ABI Research on home automation future: https://www.abiresearch.com/press/15-
million-home-automation-systems-installed-in-th
[20] Speech Recognition by HowStuffWorks:
http://electronics.howstuffworks.com/gadgets/high-tech-gadgets/speech-
recognition1.htm
[21] Business Insider smartphone vs PC:
http://www.businessinsider.com/smartphonebigger-than-pc-market-2011-2
[22] Forbes: Mobile Is Eating the World:
http://www.forbes.com/sites/louiscolumbus/2014/11/09/mobile-is-eating-the-world/
[23] Gigaom.com: https://gigaom.com/2014/10/03/belkin-looks-at-the-smart-home-
and-doesnt-see-a-place-for-hubs/
[24] wikispace Arduino pinouts: https://arduino-info.wikispaces.com/MegaQuickRef
[25] ZigBee as Communication Platform for smart house applications: International
Journal of Engineering - ISSN: 1584–2673
90
Dept.of.ECE