Professional Documents
Culture Documents
By
Muhammad Areeb Irfan
Taha Ahmad Sheikh
Supervisor
Mr. Haroon Ibrahim
Co-Supervisor
Mr. Ahmed Raheeq Sultan
By
Muhammad Areeb Irfan
Taha Ahmad Sheikh
Supervisor
Mr. Haroon Ibrahim
Co-Supervisor
Mr. Ahmed Raheeq Sultan
i
Institute of Space Technology
By
Muhammad Areeb Irfan
Taha Ahmad Sheikh
ii
AUTHOR’S DECLARATION
We take entire and full responsibility for all the research conducted for our project
“Home Automation with Voice”.
We solemnly declare that all the research undertaken, and all the development
undergone for the work presented in this thesis is done entirely by us. A little help has been
taken from sources which have been cited and referenced accordingly. Apart from this, no
foreign assistance or help is administered. This thesis is written in its entirety by us.
Furthermore, this thesis, nor any parts of this thesis, has been presented to any Institution.
We are clearly and aware of IST’s policy towards plagiarism and understand that
no tolerance is held regarding this concern. We solemnly declare that no part of this thesis
has been plagiarized. All references have been cited and there is no literal citation of more
than 100 words in total. All and any work presented in this thesis is our own original work.
Relevantly cited work has been distinguished from the originality of our research and
development.
3
We hereby acknowledge that submitted thesis is final version and should be
scrutinized for plagiarism as per IST’s policy.
Dated: ________________
4
CERTIFICATE
This is to certify that the research work described in this thesis is the original work
of the authors and has been carried out under my direct supervision. I have personally gone
through all the data/results/materials reported in the manuscript and certify their
correctness/authenticity. I further certify that the material included in this thesis is not
plagiarized and has not been used in part or full in a manuscript already submitted or in the
process of submission in partial/complete fulfillment of the award of any other degree from
any institution. I also certify that the thesis has been prepared under my supervision
according to the prescribed format and I endorse its evaluation for the award of Bachelor
of Science in Electrical Engineering degree through the official procedures of the Institute.
____________________
(Mr. Haroon Ibrahim)
v
COPYRIGHT STATEMENT
Copyright in text of this thesis rests with the student author. Copies (by any process)
either in full, or of extracts, may be made only in accordance with instructions given by the
author and lodged in the Library of Institute of Space Technology (IST). Details may be
obtained by the Librarian. This page must form part of any such copies made. Further
copies (by any process) may not be made without the permission (in writing) of the author.
The ownership of any intellectual property rights which may be described in this
thesis is vested in Institute of Space Technology (IST), subject to any prior agreement to
the contrary, and may not be made available for use by third parties without the written
permission of the IST, which will prescribe the terms and conditions of any such
agreement.
Further information on the conditions under which disclosures and exploitation
may take place is available from the Library of Institute of Space Technology (IST),
Islamabad.
vi
DEDICATION
“To Allah ‘alone’ belongs the dominion of the heavens and the earth; He creates what He
wills. He gives to whom He wills female [children], and He gives to whom He wills
males [children]. Or He makes them [both] males and females, and He renders whom He
wills barren. He is indeed All-Knowing, Most Capable.”
Dedicated to our exceptional parents, adored siblings, teachers and friends; whose
tremendous support and cooperation led us to this wonderful triumph; and of course, to
our beloved country Pakistan.
vii
ACKNOWLEDGEMENTS
First and foremost, we would use this opportunity to thank Allah Almighty for
granting us the spirit and strength to continue and complete this project. Without his
blessings, we are nothing. All praises for HIM and HIM alone.
We will thank our project and academic supervisor Mr. Haroon Ibrahim, who
guided us through all the technicalities and complexities of this project. His expertise and
guidance have made this project a very beneficial experience.
Finally, we would like to express our gratefulness to all the people who have
provided valuable support to our study and whose names we couldn’t bring to memory.
viii
ABSTRACT
The emergence of technology has enabled mankind to automate his daily life in
ways that was considered impossible a few years ago. Humans have grown accustomed to
smart systems that can offer help in daily-life tasks for as minimal effort as possible. The
need for comfort is the sole motivation behind smart-oriented environments. This project
aims to bring that comfort in the hands of the user as he gains total control over his own
living space. We’re using smart voice control along with android interface that allows in-
app control to the user and enables him to perform tasks such as turning the lights on or
turning the fans off without having to move. With the help of an app, the user relays a
voice-command to a smart Arduino - controlled system. With the help of integrated relays,
this system conveys the command to the required unit and performs that task. The virtual
assistant can be modified to fit the users’ daily routines. This project can soon find
integration in all households at a very effective cost, allowing room for further upgrades.
This approach to home automation should be attractive to people who seek to have control
over basic tasks without much mobility. In addition, the hardware needed to implement the
system is commonly available and inexpensive. The most sophisticated device in this entire
project is an android smart phone which has inarguably become one of the most crucial
integrations in our daily lives.
ix
This page is left intentionally blank.
x
TABLE OF CONTENTS
1 INTRODUCTION ...................................................................................................... 1
2 PRELIMINARIES ...................................................................................................... 4
2.1 Components.......................................................................................................... 4
xi
2.3.6 Voice Commands ........................................................................................ 10
4.2.1 Platform....................................................................................................... 21
6 BIBLIOGRAPHY ..................................................................................................... 26
APPENDICES ................................................................................................................. 27
Pin Configuration.................................................................................................... 27
Pin Configuration.................................................................................................... 29
Pin Configuration.................................................................................................... 31
Schematic ................................................................................................................. 34
Pin Configuration.................................................................................................... 34
xiii
TABLE OF FIGURES
xiv
Chapter 1
INTRODUCTION
1.1 Accessibility of smartphones
This advancing age of technology has enabled us to carry fast and powerful devices
in our pockets for daily life usage. The bulky computers have become smaller, faster, and
more reliable, and thus are finding more and more integrations in our lives. A smartphone
of today carries more processing power than a desktop from a few years ago. According to
trusted outlets such as Forbes [1], and Business Inside [2], smartphones have become one
of the most rapidly growing industries.
A few years ago, in Pakistan, smartphones had just begun to expand as a daily utility.
As tradition calls, older generation was less uncomfortable with adapting to this but with
the passage of time they have grown more comfortable with it. As reported by Pew
Research Center [4]: older people, mostly above 65 years of age had difficulties in learning
computers then. For them, computers were huge, unnecessary, and considered difficult to
learn and operate, whereas nowadays, the elderly population in the Pakistan is getting more
open to using smartphones than personal computers. This is as a result of more and more
accessible features such as portability, easy interface, etc. Sensors such as health monitors,
voice recognition software allow for more ease of access. In addition, smartphones provide
a real-time connection to the surroundings using the internet.
1
Devices and objects with built in sensors are connected to an Internet of Things
platform, which integrates data from the different devices and applies analytics to share the
most valuable information with applications built to address specific needs.
Now a day, the technology for making homes smart, malleable, fast, and responsive
with less errors and crashes is ready, and so are its consumers. The homes of today are
getting ready to being controlled by a single universal smart remote. They are getting smart
enough to automatically decide, how appliances can interact or how to adapt to their
owner’s requirements. There are already smart thermostats and sensors setup in modern
homes, which can learn and study their users' needs and preferences. It can then adapt to
the new habits, and changing routines of its user
The first patent for a remote-controlled system was, however, was put forward by
Nikola Tesla.
2
automation as well as industrial automation. Big companies such as Amazon and Google
have jumped in on the race to commercialize smart residency. These will be discussed later.
a.
1.5 Contribution
This thesis will contribute in the following ways:
a.
Chapter 1: Introduction.
Chapter 2: Preliminaries.
Chapter 6: Bibliography
3
Chapter 2
PRELIMINARIES
Before digging into the solution, there are some preliminaries that need to be
addressed. The literature review is also carried out in this chapter.
2.1 Components
2.1.1 Arduino Uno
Arduino Uno is our choice of micro-controller for this project. It is one of the most
widely used prototyping microcontroller platform. It is built and tested on robust AT mega
controller series from Atmel Corporation. Arduino hardware platform already has the
power, reset circuitry setup, as well as circuitry to program and communicate with the
microcontroller over USB. It offers 14 digital I/O pins and 6 analog pins. 6 out of the 14
digital I/O pins can also be used for a PWM output. Further, it comes with a 16 MHz quartz
crystal [7]. We will now discuss why we chose Arduino Uno over any other
Microcontroller.
2.1.1.1 Price
Arduino Uno is a very cost-effective gateway into the world of automation. It is
cheap as compared to other pricey alternatives such as the raspberry-pi. Price plays a very
vital role in this project since the goal is to provide home automation at a relatively lower
cost. This goal can be achieved by utilizing the processing capabilities of Arduino Uno
with a very low cost. An Arduino board costs around $10-15.
2.1.1.2 Availability
Arduino is readily available, and one does not have to wait for foreign deliveries to
get hands on one. Its availability is one major factor in giving it preference over other
controllers. Combined with its cost effectiveness, this becomes the most ideal component
for us.
Furthermore, the hardware interaction and integration of devices with the Arduino
is very straightforward and does not require much mastery of the subject. This makes
Arduino very favorable and comfortable to work with.
Furthermore, Wi-Fi technology has a large range of connection, and it can cover
wide areas without any hindrance. In contrast, Bluetooth is unable to cover the span of an
entire house, so it becomes hard to believe that Bluetooth can be used as a substitute for
Wi-Fi. These reasons have made Wi-Fi our primary mode of communication between the
user and the appliances.
2.1.2.2 Price
Esp8266 Wi-Fi module is a very cost-effective solution to our needs. We need a
low-price module that can emulate a Wi-Fi connection. It is easy to interface with the
Arduino and comes with Flash presets that can make it ready to be used with home
automated systems.
5
2.1.2.3 Availability
This section falls more in line regards to availability of Wi-Fi in general. As
described earlier, internet has become one of the most integral parts of our lives and we
need Wi-Fi to access it easily at most times. This has made Wi-Fi technology easily
accessible and available throughout the globe. Any household that chooses to employ home
automation must have already a Wi-Fi system integrated into their homes and daily
lifestyles. This ease of availability makes Wi-Fi, and the Esp8266 module, our preferred
solution.
6
Fig 2.2 4-channel relay module
Solid State Relays: This kind of relay does not have any mechanical or moving parts.
Unlike other types, this relay is made up of a semiconductor in conjunction with an opto –
coupler. As current passes, a lit up led emits light onto the semi-conductor and this
phenomenon emulates a switch.
Hybrid Relays: As is obvious by the name, this kind of relay is a mix between an
electromechanical and a solid-state relay. This relay reduces heat and limits any kind of
loss.
Choice for Relay: We have chosen to implement an electromechanical relay for our
project. This kind of module is best suited for the functioning of home automation. A hub
of 12-V relays will be used to act as switches throughout our circuitry.
7
2.1.5 Transistor 2N2222
This transistor is an NPN BJT transistor. We need a transistor because the relay needs
a 12V input to turn on. However, since we are controlling through Arduino, we can only
provide a 5V signal. The 2N222 transistor allows the 5V signal from Arduino to switch a
12V signal and turning it on. Also, this transistor acts as a protection in case of a current
flowing backwards.
2.2 Deliverables
The deliverables for the project are as follows:
In 2010, former Apple engineer Tony Fadell founded Nest Labs [5] with his partner
Matt Rogers. This company specializes in the production of smart devices and smart-home
based systems that can find easy integrations in an ordinary home. This company was
bought by Google in 2014 for $3.2 billion. The acquisition of a smart-based company by
Google is a marker of the technology’s significance.
Most of the world’s top technology companies have been working on developing
their own version of home automation technology. The research has been ongoing for a
couple of years now. Many of them have either come up with their version of the
technology for the general public to buy, or they have their initial prototypes, ready to be
launched soon.
Amazon has also been leading the Home-automation industry through their line of
Alexa/Echo products which aim at providing a smart user-friendly environment.
8
2.3.2 Popular Advancements in Automation
It is essential to study in the work already done in this field in order to make the
current work more effective. For this we look at some of the most popular advancements
in the field of home automation and study their aspects.
9
Fig 2.4 Speculated architecture of Amazon Alexa
10
2.3.7.1 Basic Concept of Google Home
Google home integrates Nest as an essential part of its system. It uses the same
approach as any automation system where the command is sent forward to the server to be
processed and give feedback. We can take the Nest Thermostat for example which is
programmed to learn the user’s preferred settings for specific times of the, or for specific
days of the year.
2.3.7.2 Interface
Google is a vital component in almost any software we use. Let it be operating
systems, search engines, or smartphone integrations. Google has made itself a necessary
inclusion in all fields of work. Due to this, it is always in the palm of our hands and a simple
touch away. In smartphones, saying ‘OK Google’ acts as a wake-up trigger for the smart
assistant to meet the user’s needs. Similarly, all Google appliances can be interacted with
via the Google assistant. This is highly user-friendly and extremely comfortable to get used
to.
The interface is not limited to a single device either. The Google home mini or the
Google home device, can act as a universal assistant which stays always connected to
Google. It can receive audio commands and process them as per the users’ requirements.
11
2.3.8 Leviton Decora Smart Switch
Leviton is a leading name when it comes to smart home appliances. It specializes
in smart switches. The switch is primarily used for smart lights or dimmers and can be
controlled with any smartphone provided the application is installed. This resembles very
closely to our project.
The user must manually connect to the Wi-Fi access point of Leviton Decora
switch. The app then requests user to enter the main router’s login credentials. This router
is the Wi-Fi router that connects to your smart device. The app then sends the credentials
to the Leviton Decora switch. The Leviton Decora switch uses this login credentials to
authenticate itself as a device on the wireless network and receives an IP address on the
network. The switch then sends it to its app, which stores it in its memory for sending and
receiving messages.
12
Fig 2.7 Architecture for Leviton smart switch
13
Chapter 3
The user would input a command in the application installed on their device. The
method of input is entirely up to the user. The application processes this command and
communicates it to the dedicated micro-controller. This micro-controller is itself integrated
to the house’s electrical system through a series of relays. These relays act as switches and
upon receiving a command from the micro-controller, turn ON or OFF. This will be
elaborated further.
16
Chapter 4
We will download the AT v0.9.4.2 firmware for our module and flash it into the
chip. Before this process, we attach the GP_IO and ground pins of the Wi-Fi module to
ground of Arduino and the CH-PD and Vcc pins of the module to 3.3v pin of Arduino.
After the chip has been flashed, we can use it for communication between the app and the
micro-controller.
18
a. “AT+RST\r\n” is the command to reset the module and flush any existing garbage
values.
b. “AT+CWMODE=2\r\n” configures the module to serve as an access point.
c. “AT+CIFSR\r\n” receives the Ip address for the home device for effective
communication.
d. “AT+CIPMUX=1\r\n” configures the module to allow multiple connections. This can
be configured as per the user’s desires whether if he requires multiple devices to access
the automation system or not.
e. Finally, “AT+CIPSERVER=1, 80\r\n” configures the module to turn the server on at
port 80.
This piece of code first checks if the Esp8266 is receiving anything from the phone
and relaying it to the Arduino. In case it is doing that, it reads and displays the command
that is coming from the client.
19
4.1.2.5 Switching relays on and off
After reading variables and getting the incoming data, the relay must be switched
ON or OFF. This is where we utilize the flags. If the command is to turn the relay OFF,
but the flag is already 0, it will do nothing. And vice versa.
The string is sent either through voice or a touch command from the app. The same
is done for all other relays.
4.1.2.6 Feedback
Another crucial aspect of home automation is that one should have complete
awareness of whatever appliances are on or off. For this, a piece of code is written which
can provide this feedback to the user.
4.2.1 Platform
We used MIT app inventor for this task. This site has frameworks that have already
been optimized to build an effective app. Instead of having to re-invent the wheel, one can
access components and utilize them together as per required.
This figure represents label which we can modify to fit our needs. This block is a
list picker. What it means is that this is a type of button which when clicked, will drop
down a list of our desired category. In our case, it will be the available Wi-Fi Devices of
the Smartphone in which the app is running.
21
Fig 4.9 Connection status
Now, in the figure, the highlighted pat shows that in Label 2 changes its color from
red to green of the text in Label 2. And now the Label Shows Connected instead of not
Connected. Now the User knows that the connection is established successfully.
The speech is then converted into text and as Strings to be sent to the client who is
again the Bluetooth/Wi-Fi Client that we had picked from the List Picker. As soon as these
strings reach the Arduino, the code of the Arduino acts accordingly, and the digital pins
are set High and Low and accordingly the subsequent relays are controlled. The problem
with the speech recognizer is that when the user speaks 'one' it will never be converted to
text as '1'. It will always be considered as 'one'.
23
Chapter 5
5.3 Deliverables
This section contains the Achieved and Un-achieved deliverables that were taken
upon at the start of the project. All simulations and prototyping were conducted as
per the timeline of the project.
5.3.1 Achieved Deliverables
We have achieved the following:
a. We have successfully built a functioning control box that can switch appliances ON
and OFF.
b. We have interacted with this control box using an android application
c. We have created such an application that can get voice command or touch command
from user and can relay this information to be processed by the Arduino. The Speech
recognition is done within the application
24
5.4 Differences between Simulation and Practical Results
During testing, no noticeable differences were observed between simulated and
practical results. Surprisingly, it was easier to achieve practical results since the need for
extra simulating software to emulate Wi-Fi port connectivity was eliminated.
The major portion of this project relied on software, and no difference between
simulation and practical application was observed.
25
Chapter 6
BIBLIOGRAPHY
1. http://www.forbes.com/sites/louiscolumbus/2014/11/09/mobile-is-eating-the-
world/
2. http://www.businessinsider.com/smartphone-bigger-than-pc-market-2011-2
3. https://www.ibm.com/blogs/internet-of-things/what-is-the-iot/
4. https://computerhistory.org/blog/the-echo-iv-home-computer-50-years-later/
5. https://www.cleverism.com/company/nest-labs/
6. https://www.mydimmerswitch.com/reviews/leviton-smart-switch/
7. https://www.arduino.cc/en/Main/arduinoBoardUno>.
8. https://robu.in/arduino-pin-configuration/
9. https://components101.com/wireless/esp8266-pinout-configuration-features-
datasheet
10. https://www.etechnophiles.com/hc-05-pinout-specifications-datasheet/
11. https://www.componentsinfo.com/2n2222-transistor-pinout-equivalent/
26
APPENDICES
Arduino [8]
Pin Configuration
Vin: This is the input voltage pin of the Arduino board used to provide input supply from
an external power source.
5V: This pin of the Arduino board is used as a regulated power supply voltage, and it is
used to give supply to the board as well as onboard components.
3.3V: This pin of the board is used to provide a supply of 3.3V which is generated from a
voltage regulator on the board
GND: This pin of the board is used to ground the Arduino board.
27
Reset: This pin of the board is used to reset the microcontroller. It is used to Resets the
microcontroller.
Analog Pins: The pins A0 to A5 are used as an analog input and it is in the range of 0-5V.
Digital Pins: The pins 0 to 13 are used as a digital input or output for the Arduino board.
Serial Pins: These pins are also known as a UART pin. It is used for communication
between the Arduino board and a computer or other devices. The transmitter pin number 1
and receiver pin number 0 are used to transmit and receive the data resp.
External Interrupt Pins: This pin of the Arduino board is used to produce the External
interrupt and it is done by pin numbers 2 and 3.
PWM Pins: These pins of the board are used to convert the digital signal into an analog
by varying the width of the Pulse. The pin numbers 3, 5, 6, 9, 10 and 11 are used as a PWM
pin.
SPI Pins: This is the Serial Peripheral Interface pin; it is used to maintain SPI
communication with the help of the SPI library. SPI pins include:
LED Pin: The board has an inbuilt LED using digital pin-13. The LED glows only when
the digital pin becomes high.
AREF Pin: This is an analog reference pin of the Arduino board. It is used to provide a
reference voltage from an external power supply.
28
Esp8266 Wi-Fi module [9]
Pin Configuration
29
ESP8266-01 Features
a. Low cost, compact and powerful Wi-Fi Module
30
HC – 05 Bluetooth module [10]
Pin Configuration
31
HC-05 Specifications and Features
a. Bluetooth protocol: Bluetooth Specification v2.0+EDR (Enhanced Data Rate)
m. HC-05 Bluetooth module follows the IEEE 802.15.1 standardized protocol, through
which one can build a wireless Personal Area Network (PAN). It uses frequency-
hopping spread spectrum (FHSS) radio technology to send data over the air.
32
2N222 Transistor [11]
j. Max Storage & Operating temperature Should Be: -55 to +150 Centigrade
33
12V Relay module
Schematic
Pin Configuration
34