Professional Documents
Culture Documents
BY
FEBRUARY, 2021
|1
CERTIFICATION
We certify that this project report titled: “Home Automation System Using Arduino
and Wireless Control Via Bluetooth Module” has been duly presented by JOSEPH
IORHILE ABE (BSU/SC/CMP/15/32089) of the Department of Mathematics and
Computer Science, Faculty of Science, Benue State University, Makurdi, and has been
examined and approved as meeting the requirements for the award of Bachelor of
Science (B.Sc. Hons) Degree in Computer Science.
………......................................... Date:………………………….
Dr. Adekunle Adeyelu
(Project Supervisor)
………................................................ Date:……………………
Prof. Nachamada Vachaku Blama
(External Examiner)
|2
DECLARATION
I, JOSEPH IORHILE ABE (BSU/SC/CMP/15/32089) declare that this project has been
written by me and it is an account of my research carried out in the Department of
Mathematics and Computer Science, Faculty of Science, Benue State University
Makurdi under the supervision of Dr Adekunle Adeyelu and that no part of this project
report to the best of my knowledge has been presented, or published at any time
anywhere for the award of any degree. And also, that all the quotations and references
herein have been duly acknowledged.
|3
DEDICATION
I dedicate this project report to God Almighty for His infinite mercy that He has granted
me throughout my years of studying in Benue State University, Makurdi. I also dedicate
this work to my paternal grandfather and mother, Late Pa Abe Asoo and Late Mama
Shishi Abe, and my late uncle, Thomas T. Adorowa.
|4
ACKNOWLEDGEMENTS
I also appreciate the scholarly efforts of all the lecturers in the Department of
Mathematics and Computer Science, Benue State University, Makurdi for imparting
knowledge in me. I am particularly grateful for their advice, patience, and co-operation,
especially my acting HOD, Dr Musa Egahi, late Prof. Moses Abanyam Chiawa, Dr
Michael T. Imande, Mr Tivlumun Ge, Dr. Patrick Obilikwu, Dr Aamo Iorliam, Dr
Stephen S. Akuma, Dr Mrs Samera Bright Otor, Mr Agber Selumun, Mrs Beatrice
Akumba, Mr Adom Isaac, Dr Innocent Ogwuche, Dr Harold Kpojime and many others
too numerous to be mentioned herein.
Also, worthy of appreciation are my parents; my mother Mrs Juliana Abe and my father,
Mr Samuel Abe, my half brother and sister; Terlumun and Msuurshima Abe, my elder
brother Mr. Terkura Adorowa and my cousins Shiaondo Anyam, Philip Anyam, Sunday
Anyam, Desmond Anyam, my uncles: Chief Emmanuel Adorowa, James Maator
Adorowa, Terhemba Adorowa, my aunt, Miss Blessing Adorowa; and my uncle, elder
|5
brother and father, Prof. Wilfred Terlumun Uji. Your co-operation, encouragements,
support, and prayers laid the foundation for my studies and made my stay at the
university a success. May God bless you continuously.
My special appreciation goes to my aunty and her husband, Mrs Janeth Akegh and Mr
Terfa Akegh, my uncle, Mr Samuel Adorowa for their efforts and contributions to the
success of my academic pursuit in Benue State University, Makurdi. Moreso, in a very
special way, I like to appreciate some special persons who have turned ‘family’ in this
life. First, is, Prof. S.D. Shishima and wife (mummy) Mrs Rose Shishima, Dr Andrew
Philips Adega, Dr Victor Kwaghfan Tarnongo, Dr Magnus Terna Ate, Dr Lyam-Yisa
Marcellinus, Dr Robert Iornenge Katsina, Dr Elijah Terdoo Ikpanor, Mrs Yuadoo Tina
Doughdough, Dr. Abel Iyah, Dr. Chris K. Ukande, Dr Usman Karim, Mr Tortya Jeffery
Ushahemba, Miss Lilian Nguwasen Terkula, Tyokua Tertese Meshack, Akaa Bem
Richie, Mummy Rejoice James, Mr. Torhemen Moses, Iorase Emmanuel Depinen, Mr
and Mrs Habilla Ezekiel, Williams Terzulum, Dr Ogabo Godwins, Gege Simon Bem,
Terna Anum, Pevjor T. Joseph, Akahaan Sesugh Emmanuel, Solomon Terhemen
Anyugu, Basil Bemsen Lyemen, Samuel Sesugh Deke, Benedict Tertsea Deke, and ‘my
granddaughter’, Miss Uchara Faith Ote.
I must also appreciate my course mates most especially, Oche Peter, Agbo Godwin,
Hemen Edward Aondona, Emmanuel Ocheme, Agbo Mendel Gregor, Ahar Elizabeth,
Ahule Aondofa, Songum Paul Tertese, Gande Fidelia, Igbo Stephanie, Acha Sandra,
Ujah Emmanuel, Achika Peter ‘Sherrif’ and all others whom their companionship
meant a lot to me during my school days. Similarly, I appreciate the wonderful
contributions of many scholars whose works, I have richly benefited from. Your
contributions made this work and my studies what it is today. God bless you all. I must
also appreciate suitably, the AMACOSS EXCOs of the 2017/2018 and 2018/2019
academic sessions respectively.
Finally, while appreciating the contributions of many whose names are too numerous
to mention herein, I like to state unambiguously that I accept full responsibilities for the
errors, both of omission and interpretation that may be unconsciously present in the
research work.
Joseph I. ABE
February 2021
|6
TABLE OF CONTENTS
Title Page … … … … … … … … … i
Certification … … … … … … … … … ii
Declaration … … … … … … … … … iii
Dedication … … … … … … … … … … iv
Acknowledgements … … … … … … … … v
Table of Contents … … … … … … … … … vii
List of Tables … … … … … … … … … ix
List of Figures … … … … … … … … x
Abstract … … … … … … … … … xi
|7
3.2.2 Software … … … … … … … … 23
3.3 Project flow … … … … … … … … 30
3.4 Programming the Arduino-Uno … … … … … 30
3.4.1 Project Code (sketch) and Explanation … … … … 30
3.4.1.1 Program Code Explanation … … … … … … 32
3.4.2 Connecting the Arduino-Uno board to the Bluetooth module … 34
3.4.3 Android Phone + Android App … … … … … 35
3.5 Testing the Connection … … … … … … 36
3.6 Connecting the Appliances to the Arduino Board … … … 36
3.7 Working of Arduino-Based Home Automation … … … 38
CHAPTER FOUR: RESULTS AND DISCUSSION
4.1 Results … … … … … … … … … 39
4.1.1 Mobile App … … … … … … … … 39
4.1.2 Arduino, Bluetooth and Relay Module Control … … … … 40
4.1.3 Packaging of the Entire System … … … … … … 41
4.2 Discussion … … … … … … … … 42
4.3 Limitations and Problems Encountered … … … … 42
CHAPTER FIVE: SUMMARY, CONCLUSION AND RECOMMENDATIONS
5.1 Summary … … … … … … … … 44
5.2 Conclusion … … … … … … … … 44
5.3 Recommendations … … … … … … … 46
REFERENCES … … … … … … … 48
|8
LIST OF TABLES
Table Title Page
Table 1: Pin description of HC-06 bluetooth Module 26
|9
LIST OF FIGURES
| 10
ABSTRACT
Technology has headed towards automation for a long time. The very basic principle
of technology is to make lives easier by leaving fewer things to be explicitly done by
humans. There is no doubt that automation is the future and it is happening the most
significantly right in our homes. With this, life is getting simpler and easier in all
aspects. Automated systems are preferred over manual systems the world over. The
rising increase in the number of users of internet in recent decades, has made internet a
part and parcel of life, and IoT is the latest and emerging internet technology. Internet
of things has been a growing network of everyday object-from industrial machine to
consumer goods that can share information and complete tasks while one is busy with
other activities. Wireless Home Automation system (WHAS) is an IoT-based system
that uses computers or mobile devices to control basic home functions and features
automatically through internet from anywhere around the world. An automated home
is sometimes called a smart home and is meant to save the electric power and human
energy. Home automation system varies from other systems by allowing the user to
operate the system using wireless connections via smartphones and the internet. This
research project presents a Home Automation system (HAS) using arduino and wireless
control via Bluetooth module that employs the integration of wireless communication
using Bluetooth of an android smartphone to provide the user with remote control of
various lights, fans, and appliances within their home. This system was designed so as
to enhance cost effectiveness and expandable allowing a variety of devices to be
controlled.
| 11
CHAPTER ONE
INTRODUCTION
In the present day, security systems play an important role in the protection of lives
and investment. This is achieved by the incorporation of various subsystems into
the security system with a single control unit such as surveillance, intruder control,
access control, fire detection, etc. A smart home is one that is equipped with
lighting, heating, and electronic devices that can be controlled remotely by
Smartphone or via the internet. An internet-based home automation system focuses
on controlling home electronic devices whether you are inside or outside your home
(Nathan, Abafor, Aronu & Edoga, 2015). Home automation gives an individual the
ability to remotely or automatically control things around the home. A home
appliance is a device or instrument designed to perform a specific function,
especially an electrical device, such as a refrigerator, for household use. The words
appliance and devices are used interchangeably.
Automation is today’s fact, where things are being controlled automatically usually
the basic tasks of turning ON/OFF certain devices and beyond, either remotely or
in close proximity. Automation lowers the human judgment to the lowest degree
possible but does not completely eliminate it. The concept of remote management
of household devices over the internet from anywhere, any time in the world today
is a reality. Assume a system where from the office desk, the user could view the
status of the devices and decides to take control by tuning his TV set to his favourite
channel, turns on the cooling system, say the air conditioner, and switches on or off
some of the lights. This, the user could walk back home and only find a very
comfortable, pleasant home. The recent developments in technology which permit
the use of Bluetooth and Wi-Fi have enabled different devices to have capabilities
of connecting with each other. Using a WIFI shield to act as a Micro web server for
the Arduino eliminates the need for wired connections between the Arduino board
and computer which reduces cost and enables it to work as a standalone device. The
Wi-Fi shield needs connection to the internet from a wireless router or wireless
| 12
hotspot and this would act as the gateway for the Arduino to communicate with the
internet.
Home automation system is getting popular and widely used in a lot of houses
worldwide. It has tons of advantages to users even more to the handicapped and/or
elderly users in which it will make it easier for them to control their home
appliances. Home automation systems can be labeled to two media in which how it
is connected and they are either wired or wirelessly connected. The main difference
between these two kinds is that home appliances are linked wirelessly to a central
controller if it is a wireless home automation system. On the other hand, the
appliances are connected to a central controller if the medium uses wired
communication method. Wireless system had been introduced in order to dispose
of wired communication among home appliances.
In the present day, home automation is becoming essential for the purpose of
improving life conditions. Home automation offers convenience and ease in the use
of home appliances. This ranges from using a smart phone in turning on a TV to
locking and unlocking doors. It also offers an efficient use of energy. However, to
get or acquire such systems installed costs a lot of money and that is the major
reason why home automation has not received much demand and attention in some
parts of the world (including Nigeria). In addition, it is also complex to install and
| 13
configure. There is therefore the need to develop a cost effective and easy to
configure system so that a lot of people will be willing to acquire it in their homes,
offices and schools.
The aim of this study is to design and implement an automated arduino-based home
automation using android application. The following are the ancillary objectives of
the study.
iii. To develop a remotely control system that enables data transfer through
wireless transfer medium.
In order to fulfill the stated objectives, several steps must be taken. These steps
involve both software programming and hardware implementation. These steps are
as follows:
ii. Create a simple, yet, reliable home automation system using Arduino as a
microcontroller that will be the medium between the android and the home
appliances.
iii. To find a suitable app that will work efficiently with the Arduino board in
order to control the home appliances.
iv. Program the Arduino board in a way that will let it interact with the android
| 14
app.
This study will be undertaken to create a home automation system at low cost and
easy to create, this will benefit both the manufacturer and the client. It will help the
manufacturer by making it easy and cheaper to apply it, and it will also benefit the
clients by making it cost effective and the most important advantage is that it will
make the house a much more convenient place for the clients especially for the
elders and the handicapped.
DigitalRead: DigitalRead is used to read the status of any digital Pin in Arduino.
We have to give the digital Pin number in the small brackets.
Dupont connector: Dupont is also called Jumper Wire cables. They are low cost
and used to connect hardware such as sensors, Arduino boards and
breadboards together.
Jumper wires: Jumper wires are simply wire that have connector pins at each end,
allowing them to be used to connect two points to each other without
soldering. Jumper wires are typically used with breadboards and other
prototyping tools in order to make it easy to change a circuit as needed.
Male and Female headers: Just like people the Male has a sticking out “pin” which
he plugs into something. The Females on the other hand have a “hole” in
which to receive something, usually a “pin”!
Male breakaway header: Breakaway header is like the duct tape of electronics.
It’s great for connecting things together, soldering to perf-boards, fits into
| 16
any breakout or breadboard, etc.
Pin headers: Pin headers are stiff metallic connectors that are soldered to a circuit
board and stick up to receive a connection from a female socket.
Smart Home: Smart home is a term that refers to modern homes that have
appliances, lighting and/or electronic devices that can be controlled remotely
by the owner, often via a mobile app. Smart home-enabled devices can also
operate in conjunction with other devices in the home and communicate
information to other smart devices.
Smart object or device: A smart object is an object that enhances the interaction
with not only people but also with other smart objects. Also known as smart
connected products or smart connected things, they are products, assets and
other things embedded with processors, sensors, software and connectivity
that allow data to be exchanged between the product and its environment,
manufacturer, operator/user, and other products and systems. Connectivity
also enables some capabilities of the product to exist outside the physical
device, in what is known as the product cloud.
| 17
complex or intricate whole. Every system is delineated by its spatial and
temporal boundaries, surrounded and influenced by its environment,
described by its structure and purpose and expressed in its functioning. All
parts of a system work together to achieve a common goal. This is a set of
things working together as parts of a mechanism or an interconnecting
network; a complex whole.
| 18
CHAPTER TWO
LITERATURE REVIEW
2.1 Introduction
The onus of this chapter is to present a review of related works on the subject matter
of investigation. Herein, the review is conducted under the concept of home
automation system, arduino, android and home automation in the real world.
Different types of approaches have been made towards home automation. An SMS
based method uses GSM technology available in phones to communicate with a
microcontroller which acts as the main control for access to home appliances. A
| 19
GSM module is also required to be attached to the microcontroller through a port
to enable SMS capability (AlShu’eili, Gupta & Mukhopadhyay, 2011). The
disadvantage of such a system is that it is not user friendly, as there is no graphical
user interface, and access codes and command codes must be remembered to
operate the system.
Arduino is instrument used to build a better version of a computer which can control,
interact and sense more than a normal desktop computer. It is an open-source
physical processing stage focused around a straightforward microcontroller board,
and an environment for composing programs for the board. Arduino can be utilised
to create interactive items, taking inputs from a diverse collection of switches or
sensors and controlling an assortment of lights, engines, and other physical output.
| 20
Arduino activities can be remaining solitary or they can be associated with programs
running on a machine (e.g. flash, processing and maxmsp). The board can be
amassed by hand or brought preassembled; the open-source IDE can be downloaded
free of charge. Focused around the processing media programming language is an
execution of wiring, a comparative physical computing platform (Ahmed 2015).
Terminology
The term Arduino covers the hardware, software, development team, design
philosophy, and morale of the user community. Originally developed in Ivrea, Italy,
Arduino was named after the king of Italy about 1000 years ago, “Arduin of Ivrea”.
The name Arduino is a masculine Italian name meaning “strong friend”, and is
always capitalized being a proper name. The Arduino I/O Board is the physical,
tangible part of the Arduino system. The board is based on the Atmel AVR
ATmega8 microprocessor and later derivatives containing a serial port, power
supply circuitry, expansion connectors, and various support components.
Serial Port
The serial port is used to communicate between the Arduino and PC in the
development stage when uploading programs to the I/O Board. There are several
types of serial communication protocols. The Arduino’s serial port is used in an
| 21
asynchronous mode, meaning it doesn’t require an independent clock signal. The
asynchronous method uses one signal to transmit data and another to receive data
(Barret 2012).
Power Supply
There are a number of ways to power an Adruino, the simplest method having the
Arduino’s USB cable connected to a PC. The USB standard allows for the supply
of up to 100mA for an unenumerated USB device and as much as 500mA for a
properly enumerated USB device, which is enough to power several LEDs and low-
power sensors. For greater electrical loads, however, an external, stronger power
supply will be required (Wheat 2011).
Expansion Connectors/Ports
The Arduino Uno provides four sets of expansion connectors with the purpose of
adding additional circuitry: Power connector, Analog connector, and Digital I/O
connectors (2 sets). The power connector provides connection to the main supply
voltages (Vin, 5V, 3V3, GND) as well as the –RESET pin. The analog connector
presents the six analog inputs, A0-A6, which can also be configured to be used as
digital I/O lines (Wheat 2011). In the ATmega328 convention, these digital I/O
connectors are called ports, namely Port B, Port C, and Port D. Each of the I/O pin
has an alternate peripheral function, configurable when programming the Arduino
(Wheat 2011).
Shields
Additional features and external hardware may be added to the Arduino using the
daughter card concept, known as “Shields” in the Arduino convention. These shields
mate with the expansion connectors on the arduino board, allowing the I/O Board
to act like a small motherboard, providing mechanical and electrical connections to
additional circuitry.
This section will give an overview of how the Arduino Uno is programmed. A
| 22
compiler, hosted on a computer separate from the Arduino Uno, produces a machine
code to be uploaded into the Arduino board (.hex file), using the program source
files provided by the program writer (.c and .h files). This is done in three steps.
- Compilation – program source files are converted into assembly code (.asm
file).
The Arduino Development Environment contains a text editor, a message area for
status displays, a text console, a tool bar of common functions, and a menu bar.
ADE also provides a user-friendly interface allowing for quick code upload, which
is possible as the Arduino is ready-made with a bootloader program (Azrul, 2013).
ADE is a user-friendly interface making the development and programming process
easier.
Verify/Compile
Save
New
Open
Upload
| 23
Arduino Development Environment buttons
The figure above shows the buttons available on the ADE toolbar. The buttons
provide single click access to the most commonly used features. “Upload to I/O
Board” button compiles written code and uploads it to the Arduino Board, while
“Serial Monitor” button opens the serial monitor feature, allowing text data to be
send to and received from the Arduino board. The other buttons are self-
explanatory.
Sketchbook Concept
In order to make the Arduino a friendly platform for art students, the sketchbook
concept is employed in the Arduino Environment. Programs written are called
‘sketches’ and maintained within a sketchbook in the Arduino environment. An
individual sketch can be accessed via the ‘Sketchbook’ entry under the file tab
(Azrul, 2013).
Built-in Functions
The Arduino WiFi Shield is based on the HDG104 Wireless LAN 802.11b/g System
in-Package (SiP), allowing an Arduino board to connect to the internet using the
802.11b and 802.11g wireless specifications (WiFi). The WiFi library is used to
write sketches (programs) to connect to the internet using the shield. An onboard
micro-SD card slot accessible through the SD Library is also available and can be
used to store files for serving over the network (Azrul, 2013).
The Arduino WiFi Shield communicates with the Arduino using the SPI (serial
peripheral interface) bus through the ICSP header, located on pins 11, 12, and 13 on
the Arduino Uno. Pin 10 is used to select the HDG104 and pin 4 is used for the SD
card. Additionally, pin 7 is used as a handshake pin between the WiFi shield and the
Arduino. As a result, each of these pins cannot be used for general I/O (Azrul, 2013).
Connecting to a network with the WiFi shield requires the name of the network,
| 24
known as SSID (service set identifier) and a password or key depending on the type
of connection. The WiFi shield can connect to open networks or secured networks
with WEP, WPA, or WPA2 encryption. A password is required for WPA and WPA2
networks, while for WEP a key and key index is necessary (Azrul, 2013).
Android is a Linux based operating system which is primarily designed for touch
screen mobile devices such as smart phones and tablet computers. The operating
system has developed a lot in the last 15 years starting from black and white phones
to recent smart phones. The android is a powerful operating system and it supports
large number of applications in Smartphones. These applications are more
comfortable and advanced for the users. The hardware that supports android
software is based on ARM architecture platform. The android is an open source
operating system means that it’s free and any one can use it. The android has got
millions of apps available that can help you managing your life one or other way
and it is available low cost in market at that reason android is very popular.
According to Nikhil, Agrawal and Pande (2017), the first commercial android
version (Android 1.0) was released in September 2008. Since then, it has been
continually developed by Google and the Open Handset Alliance. It has seen a
number of updates to its base operating system since the initial release. Versions 1.0
and 1.1 were not released under specific code names, but since 2009, Android 1.5
Cupcake and other Android versions have had confectionery-themed code names.
A version of Android KitKat exclusive to Android Wear devices was released on
June 25, 2014, with an API level of 20. Each is in alphabetical order with Android
7.0 Nougat version released in August 2016 (Nikhil, Agrawal & Pande, 2017). As
at September 03, 2019, the latest version of android system was version 10.0. Unlike
the previous versions, this version did not have an attractive sweet name or any other
type of name beyond the version number.
Many Android users use their Android phones just for calls, SMS, browsing and
basic apps. However, from the development prospective, one must know about the
| 25
Android internal structure. Android uses several partitions like boot, system,
recovery, data etc to organise files and folders on the device just like Windows OS.
Each of these partitions has its own functionality, which most of us do not know the
significance of each partition and its contents. There are mainly 6 partitions in
Android phones, tablets and other Android devices (Nikhil, Agrawal & Pande,
2017).
Android libraries: Android libraries are available on top of Linux kernel. There is
a set of libraries including open-source Web browser engine web kit, well known
library like SqLite database which is a useful option for storage and sharing of
application data, libraries to play and record and video, secured socket layer (SSL)
libraries responsible for internet security etc.
Android Runtime system: This section which is the third part of the android
architecture, provides a key component called Dalvik Virtual Machine specially
designed and optimised for android. The Dalvik Virtual Machine makes use of
Linux core features like memory management and multi-threaded, which is intrinsic
in the java language. The Dalvik Virtual Machine enables every android application
to run in its own process, with its own instance of the Dalvik Virtual Machine.
Android Linux Kernel: In the Linux layers Linux 2.6 with approximately 115
patches. This provides basic system functionality like process management,
memory management, device management like camera, keypad, display etc. also,
the kernel handles all the things that Linux is really good such s networking and a
vast array of device drivers, which take the pain out of interfacing to peripheral
hardware.
| 26
2.5 Home Automation in the Real World
In an ideal world, any device that can be connected to a remote network can be
automated and controlled. In the real world, home automation most commonly,
connects simple binary devices. This includes “on and off” devices such as lights,
power outlets and electronic locks. Also, devices such as security sensors which
have only two states, open and closed are automated as well. For a home to become
truly smart, internet enabled devices must be attached to this network and controlled
remotely. The home computer was the classic control unit for which most of the
earlier home automation systems were built or designed. In recent times, most
especially in the 21st century, home automation systems distribute programming
and monitoring control between dedicated devices in the home like the control panel
of a security system interdem with a user-friendly application interface that can be
accessed via internet enabled-PC, smart phone, tablet, etc.
Manufacturers have produced a wide variety of “smart” devices, many of which are
full of innovative features but few of which offer the kind of integration needed to
be part of a complete home automation system. Much of the problem has been that
each manufacturer has a different idea of how these devices should be connected
and controlled. So, while one may have a “smart” TV, washing machine,
refrigerator, thermostat, coffee maker or any of the other Internet-ready household
devices on the market, the end result is usually a separate control scheme for each
device (Ahmed 2015).
In the near future, home automation may be standardised to let users truly take
advantage of all of these additional possibilities. For manufacturers in the present
times, home security systems specialized in home automation is hinged on the most
critical and useful part of a smart home. This means that doors, windows and
environmental devices (thermostat, smoke detectors, temperature, humidity, fire
and carbon dioxide sensors) at the basic level. For a real-time security, convenience
and control, home automation systems from security providers also include options
for video cameras.
| 27
2.5.1 Advantages of Home Automation Systems
The 21st century homes have become more and more self-controlled and automated
due to the comfort automation provides, especially when employed in a private
home. Home automation system serves as a means that allow users to control
electric appliances of varying kind. Many existing and well-established home
automation systems are based on wired communication. This does not pose a
problem until the system is planned well in advance and installed during the
physical construction of the building. Nonetheless, for already existing buildings,
the implementation cost goes very high. In contrast, Wireless systems can be of
great help for automated systems. With the advancement of wireless technologies
such as Wi-Fi, cloud networks in the recent past, wireless systems are used every
day and everywhere. This reduces the hitches associated with wired-network.
Wireless systems like Wi-Fi have become more and more common in automated
homes. Likewise, in home and building automation systems, the use of wireless
technologies gives several advantages that could not be achieved using a wired
network only.
| 28
refurbishment and for new installations.
Rajneesh, Abhinav and Sh. Nishant (2015) while investigating internet of things
| 29
based controlling of appliances using GSM/GPRS enabled embedded server for
remote access observed that the internet has initially started as the “Internet Of
Computers”, a global network enabling services that now include the World Wide
Web (WWW), File Transfer Protocol and others allowing computers and hence
users to communicate with each other and exchange information. There are several
definitions for the Internet of Things (IoT) that explain what are the main
functionalities of it and what we should expect from when connecting “Things”
with each other and with the internet. Internet of Things (IoT) is an ideal emerging
technology to influence the internet and communication technologies. Simply
“Internet of Things” connects living and nonliving things through internet.
It can therefore be inferred from the above that the main aim of IoTs is to enable
the users to control and monitor smart devices through internet. In this an interface
between users and smart home by using GSM and internet technologies or simply
creating GSM based wireless communication from the web server into the smart
home.
Corroborating the above view in their paper titled “Home Automation Using
Internet of Things”, Vinay and Kusuma (2015) noted that with advancement in
Automation technology, life is getting simpler and easier in all aspects. In today’s
world Automatic systems are being preferred over manual system. With the rapid
increase in the number of users of internet, IoT is the latest and emerging internet
technology. Internet of things is a growing network of everyday object-from
industrial machine to consumer goods that can share information and complete
tasks while you are busy with other activities. Wireless Home Automation system
(WHAS) using IoT is a system that uses computers or mobile devices to control
basic home functions and features automatically through internet from anywhere
around the world, an automated home is sometimes called a smart home. It is meant
to save the electric power and human energy. The home automation system differs
from other system by allowing the user to operate the system from anywhere around
the world through internet connection.
Sirsath, Dhole, Mohire, Naik and Ratnaparkhi (2013)’s work on “Home Automation
using Cloud Network and Mobile Devices” proposed a Home Automation system
| 30
that employs the integration of multi-touch mobile devices, cloud networking,
wireless communication, and power-line communication to provide the user with
remote control of various lights and appliances within their home. This system uses
a consolidation of a mobile phone application and PC based program to provide a
means of user interface to the consumer.
Basil Hamed (2012) designed and implemented a control and monitor system for
smart house. Smart house system consists of many systems that controlled by
LabVIEW software as the main controlling system. Also, the smart house system
was supported by remote control system as a sub controlling system. The system
also is connected to the internet to monitor and control the house equipment’s from
anywhere in the world using LabVIEW.
Deepali, Mohd and Shreerang (2013) also conducted a study and investigated Home
Automation and Security System Using Android ADK. The prime objective of this
paper is to assist handicapped/old aged people. It gives basic idea of how to control
various home appliances and provide a security using Android phone/tab. The
design consists of Android phone with home automation application, Arduino Mega
ADK. User can interact with the android phone and send control signal to the
Arduino ADK which in turn will control other embedded devices/sensors.
Basma, Sherine and Mahmoud (2013) proposed a new design for the smart home
using the wireless sensor network and the biometric technologies. The proposed
system employs the biometric in the authentication for home entrance which
enhances home security as well as easiness of home entering process. The structure
of the system is described and the incorporated communications are analyzed, also
an estimation for the whole system cost is given which is something lacking in a lot
of other smart home designs offers. WB-SH is designed to be capable of
incorporating in a building automation system and it can be applied to offices, clinics,
and other places. The authors argued that with an imagination for the future, the
smart home will employ the biometric technology in a larger and more
comprehensive form.
| 31
2.7 Summary of Literature Review
This chapter has reviewed works related to home automation, arduino technology
and android technology. It is apparent from the literature review that the rapid
growth of technology has drastically changed the living standards of modern
society. Based on the increasing number of electronic devices being made in a
household, automated home control system has become an increasing useful
feature. Current systems, however, have problems with complexity, high costs, non-
open sources and multiple incompatible standards; resulting in the limited venture
of the home automation into the homes of the rich or hobbyists. This project intends
to design an affordable and easy to use home automation system, which will be
done by interfacing the Arduino microcontroller with wireless control via Bluetooth
while creating a simple, easy-to-use system to control home appliances.
| 32
CHAPTER THREE
METHODOLOGY
3.1 Methodology
• Each phase is presented for approval before moving to the next phase.
• It identifies needs, specifies requirements and design the model first before
going into implementation.
To achieve these purposes, this chapter tend to answer questions like “the why, the
how or by what means people do what they do”. With respect to this work, this
chapter will be focusing wholistically with detailed analysis and the design of the
proposed home automation system using arduino uno.
| 33
3.2 Analysis of the Proposed System
arduino UNO
Proto board
Android phone
Some resistors
jumper wires
Relay modules
Light bulbs
Block connectors.
3.2.2 Software
Arduino UNO
| 34
communication protocols. This board is usually programmed using Arduino IDE
and using a micro USB cable. ATmega328 comes with preprogrammed onboard
boot loader which makes it easier to upload the code without the help on external
hardware. The C and C++ language is used to program the board which is very easy
to learn and use. The Arduino IDE makes it much easier to program. It separates the
code in two parts i.e. void setup() and void loop(). The function void setup() runs
only one time and is used for mainly initiating some process whereas void loop()
consists the part of the code which should be executed continuously.
The arduino model consists of 6 analog input pins and 14 digital GPIO pins which
can be used as input-output, 6 of which provides PWM output and analog using
pinMode(), digitalWrite(), digitalRead() and analogRead() functions. 6 analog input
channels are from pins A0 to A5 and provide 10-bit resolution. The board can be
powered either from using a USB cable which operates at 5 volts or by DC jack
which operates between 7 to 20 volts. There is an onboard voltage regulator to
generate 3.3 volts for operating low powered devices. Since the ATmega328 work
on USART, SPI and I2C communication protocol, has 0 (Rx) and 1(Tx) pins for
USART communication, SDA (A4) and SCL (A5) pin for I2C and SS (10), MOSI
(11), MISO (12) and SCK (13) pins for SPI communication protocol. These
specifications make Arduino Uno board perfect for Home Automation project.
| 35
to access the configuration setting of HC-06 using some AT commands, the data
mode is used to send the data serially. Command mode can be accessed by
grounding the “key” pin and using AT commands; we can change its setting. There
are AT commands which can be used to change the name, password, baud rate, etc.
of the module. Here are few AT commands:
➢ AT+UART = 9600, 1, 0 – for changing the baud rate to 9600, stop bit to 1
and parity bit to 0.
EN/Key pin: This pin is used to set Bluetooth module in either command mode or
data mode. Command mode can be accessed by setting this pin high and data mode
can be accessed setting it low. By default, it is set as low in data mode.
VCC: This is the power supply pin which is connected to either 5V or 3.3V.
State: This pin tells whether the module is connected or disconnected with the other
device.
| 36
Table 1: Pin description of HC-06 bluetooth Module
VCC 3.3 V to 5 V
GND Ground
HC-06 Bluetooth module has built-in red led which indicates the connection status.
Before any connection, it blinks continuously in some periodic manner and after it
gets connected, its blinking speed slows down.
• GPS receiver
• Industrial control
• Microcontroller projects
| 37
Relay
Relay Configurations
There are various configurations for a relay’s contacts depending on its use. Four
common types of relays will be discussed here (Azrul, 2013):
Single Pole, Single Throw (SPST): This type of relay uses one coil to control one
switch with two contacts
Single Pole, Double Throw (SPDT): This type of relay uses one coil to operate one
switch with three contacts.
Double Pole, Single Throw (DPST): One coil is used to operate independent SPST
switches at the same time. It is useful for switching two loads at the same time.
Double Pole, Double Throw (DPDT): This type of relay uses one coil to operate
two independent DPDT switches at the same time. This relay can be configured as
an H-bridge circuit.
| 38
Figure 1: Relay Configurations (Azrul, 2013)
In this project, we are going to use an electromagnetic relay to turn on and off the
home appliances like, bulb, fan or any ac powered source in our home by giving DC
signals from the Arduino UNO. The relay has 6 pins, two of which VCC and Ground
are used to give power to the relay. One pin is the Data pin which is used to take the
signal either “1” or “0” from microcontrollers. Other 3 pins Normally Closed (NC),
Common, Normally Open (NO) are used to connect AC powered appliances. This
relay works in two conditions either in Normally Open or in Normally Close
condition:
Normally Open: It closes the circuit whenever the relay is activated and it opens
the circuit whenever the relay is deactivated.
Normally Close: It opens the circuit whenever the relay is activated and it closes
the circuit whenever the relay is deactivated.
| 39
Table 2: Pinout of Relay
VCC 5V
GND Ground
Data pin “1” or “0” from
microcontroller
NC For Normally Closed Circuit
COM Common
NO For Normally Open Circuit
(Source: Author’s computation, 2021)
• They are used to control a high voltage circuit with a small voltage signal.
• Relays are used in substation and grids when supplying electricity from one
point to another.
Functionality
The circuit is designed using Arduino, Bluetooth, relay, and electric bulbs. We have
connected the Bluetooth serially with the Arduino. The relay is used to operate the
home appliances. We have used four relays for four appliances. We can change the
numbers of the relay to operate various home appliances accordingly. While moving
to the hardware, the LEDs will be replaced by Bulbs. The command for controlling
the home appliances will be sent through a “Bluetooth terminal HC-05 app” from
your smartphone to the Bluetooth, connected to the Arduino. The Arduino reads the
data coming serially to the Bluetooth. Hence, actions are performed according to
the command coming from the Bluetooth to the Arduino.
| 40
3.3 Project flow
In order for the Arduino-Uno board to be able to interact with the application used
in this project certain program (code called sketch) needs to be uploaded to the
Arduino-Uno. Arduino Company provides user friendly software which allows
writing any code for any function wanted to be performed by the Arduino-Uno and
upload it to the board. See section 3.4.1 below for the full source code of the
Arduino-Uno board.
#include<SoftwareSerial.h>
int bulb1 = 8;
int bulb2 = 9;
int bulb3 = 10;
int bulb4 = 11;
SoftwareSerial bt(0,1); /* (Rx,Tx) */
String str;
void setup() {
bt.begin(9600);
Serial.begin(9600);
pinMode(bulb1,OUTPUT);
| 41
pinMode(bulb2,OUTPUT);
pinMode(bulb3,OUTPUT);
pinMode(bulb4,OUTPUT);
}
void loop() {
if (bt.available())
{
str = bt.read();
Serial.println(str);
//bulb1
if(str==”bulb1 on”)
{
digitalWrite(bulb1,HIGH);
Serial.println(“BUlB 1 is ON”);
}
else if(str==”bulb1 off”)
{
digitalWrite(bulb1,LOW);
Serial.println(“BUlB 1 is OFF”);
}
else
{
digitalWrite(bulb1,LOW);
}
//bulb2
if(str==”bulb2 on”)
{
digitalWrite(bulb2,HIGH);
Serial.println(“BUlB 2 is ON”);
}
else if(str==”bulb2 off”)
{
digitalWrite(bulb2,LOW);
Serial.println(“BUlB 2 is OFF”);
}
else
{
digitalWrite(bulb2,LOW);
}
////bulb3
if(str==”bulb3 on”)
{
digitalWrite(bulb3,HIGH);
Serial.println(“BUlB 3 is ON”);
}
else if(str==”bulb3 off”)
{
| 42
digitalWrite(bulb3,LOW);
Serial.println(“BUlB 3 is OFF”);
}
else
{
digitalWrite(bulb3,LOW);
}
//bulb4
if(str==”bulb4 on”)
{
digitalWrite(bulb4,HIGH);
Serial.println(“BUlB 4 is ON”);
}
else if(str==”bulb4 off”)
{
digitalWrite(bulb4,LOW);
Serial.println(“BUlB 4 is OFF”);
}
else
{
digitalWrite(bulb4,LOW);
}
}
}
To include the libraries required for the project, SoftwareSerial.h library is imported
for serial communication with Bluetooth Module HC-06.
#include<SoftwareSerial.h>
int bulb1 = 8;
int bulb2 = 9;
int bulb3 = 10;
int bulb4 = 11;
String str;
pinMode(bulb1,OUTPUT);
| 43
pinMode(bulb2,OUTPUT);
pinMode(bulb3,OUTPUT);
pinMode(bulb4,OUTPUT);
Bluetooth serial communication and serial monitor are initiated at 9600 baud rate.
bt.begin(9600);
Serial.begin(9600);
If the data got from the smartphone using Bluetooth Module HC-06 is “bulb1 on”
then we turn on the bulb 1 by setting data pin of the relay as HIGH. If data is “bulb1
off” then we turn off the bulb by setting the data pin of the relay as LOW. If no data
received for bulb 1 then we set our bulb 1 to LOW. The same thing is done for bulb
2, bulb 3, bulb 4.
if(str==”bulb1 on”)
{
digitalWrite(bulb1,HIGH);
Serial.println(“BUlB 1 is ON”);
}
else if(str==”bulb1 off”)
{
digitalWrite(bulb1,LOW);
Serial.println(“BUlB 1 is OFF”);
}
else
{
digitalWrite(bulb1, LOW);
}
Hence, you can control any home appliance in your home by using Arduino UNO,
Bluetooth, and relay. We have also provided the technical information for the
components required for constructing this project. The circuit diagram consists of
| 44
LEDs which will be replaced by the AC bulbs used in the home.
| 45
Figure 3: Bluetooth -Arduino Uno Board connection process.
In this project, an android phone is used as the remote control for the user alongside
with an App called Arduino Bluetooth Home Automation. Arduino Bluetooth Home
Automation is a simple Android app that will make controlling the pins of Arduino-
Uno from an Android phone wirelessly possible. Arduino Bluetooth Home
Automation employs a simple Android user interface to control Arduino Uno's
digital and PWM pins, send text commands to Arduino-Uno and receive data from
Arduino over Bluetooth serial module. In this Project the Digital Pin Function is
only required to make the system work, so the Arduino-Uno Board should be
| 46
programmed to only support that feature.
After installing the app on the phone and connecting the Arduino-Uno board with
the Bluetooth module, a test to make sure that the phone is interacting with arduino
via the Bluetooth module is needed.
After everything is set and ready (android phone is connected to the Arduino)
connecting the Arduino to the home appliances is needed. Using wires and
connector blocks connect the positive end of the home appliance (e.g. portable fan)
to the normally open (in this project we want to make the output active high) port in
the relay module and the negative end of the appliance to a power source. Then
connect the IN-port of the same relay module to the wanted Arduino-Uno port. Apply
the same for the other appliances only use different relays and different Arduino-
Uno Ports. Connect the android phone with the Bluetooth module and now all the
connected appliances can be controlled wirelessly using the android device.
| 47
Figure 4: Connecting the Appliances to the Arduino Board
Make the connection for Home Automation project as given in the circuit diagram.
First of all, we connect the bulb with AC powered sources and with relays as given
in the circuit diagram. Then the relays are given DC power from the Arduino Uno
board. Data pins of the relays are connected at pins 8, 9, 10 and 11 to the Arduino
which are the output pins of Arduino. Then connect the HC-06 module with the
Arduino Board as shown in the diagram and power the Adruino Board. Upload the
code given at the end of the project using Arduino IDE. Turn on the Bluetooth in
your smartphone and connect the HC-06 module by entering the password. By
default, the password is “0000” or “1234”. After successfully connecting your
| 48
smartphone with the HC-06, Open “Bluetooth terminal HC-06 app in your
smartphone” and it will show your device connected to HC-06. Now send the data
“Bulb1 turn on” or “Bulb2 to turn off” to turn on or off any bulb. This is how you
can control other appliances in your home remotely.
| 49
CHAPTER FOUR
This chapter discusses the results and any limitation and/or problems encountered
during the period of the project.
4.1 Results
Figure 5: Mobile App for controlling communication with Arduino via bluetooth
module
As seen in Figure 5 above, the android app helps in establishing the connection
between Bluetooth module. It also helps in controlling the appliance connected to
| 50
the Arduino via Bluetooth module. Once the ON button is pressed on the screen, the
first appliance, in this case, a light bulb will be switched on. Once it is pressed OFF,
it will switch off.
The sketch as shown in chapter three was uploaded into the Arduino after
connections (wiring) were done. The code was then uploaded into the Arduino and
tested for communication. Figure 6 below illustrates the connection and
communication between Bluetooth module and Arduino. Thereafter, connection
was also established between the Relay module, Arduino and home appliances and
tested for automation.
| 51
4.1.3 Packaging of the Entire System
The whole system was packaged using adapter box. The Arduino was powered with
an adapter of AC 12v 500mA 6VA. The reading represents respectively: alternating
current, maximum output load and power, expressed in VA (that can always be
obtained by means of the P=V*I formula). In some cases, in the place of the AC
abbreviation, the symbol “~” may be found, and it still means “alternating current”.
This reason for packing is because when we want to use an Arduino board in stand-
alone mode, the first problem to face is the one of how to power it, once it is
disconnected from the computer’s USB port. Unfortunately, a faulty knowledge of
the theme of powering sometimes leads people to make unforgivable mistakes, since
the first result is often that of seeing the board go up in smoke and almost always
irremediably, since from that moment it will not work anymore. Figure 8 below
shows the fully packaged system.
| 52
Figure 8: Packaged Home Automation System Prototype Using Adapter Box
4.2 Discussion
Some problems and issues were encountered during this project. Bluetooth
| 53
connection between the android phone and the Arduino-Uno board was
unsuccessful in the early stages of this project. This problem was encountered when
the HC-05 Bluetooth module was meant to be used for this project. This problem
has been tackled by research on the matter and finally replacing the HC-05 module
with the HC-06 Bluetooth module.
Another issue is it was using the relay modules and connecting them. At first normal
relays were intentioned to be used in the project however soldering them into a
breadboard was troublesome because of the whole not matching the relay pins and
the breadboard needed specific modification, not to mention connecting everything
using soldering iron is not the ideal way if several tests and wiring and unwiring is
in order. This problem was tackled by using relay modules. Furthermore, one of
major limitations of the present research premised on the fact that the system does
not store data in a cloud server since it does not employ the integration of cloud
networking.
| 54
CHAPTER FIVE
5.1 Summary
This research was set up to establish a home automation system using Arduino
microcontroller and android device as a remote-control through Bluetooth module.
The home automation circuit is built around an Arduino Uno board, Bluetooth
module HC-06 and a 2-channel relay board. The number of channels depends on
the number of appliances you wish to control. Arduino Uno was powered with a
12V DC adaptor/power source. The relay module and Bluetooth module were in
turn, powered using a board power supply of Arduino Uno. Results of the
experiment through the prototype shows that the home appliances can be controlled
using an android app. We can either use on/off buttons to control the appliances. It
is also discovered that we can control more electrical appliances by increasing the
number of channels in the relay used. For instance, using an 8-channel relay, we can
control up to eight devices.
5.2 Conclusion
| 55
Home automation system can make home even more intelligent. This System can
be used for building automation, industrial automation, hospital automation for
patients and agricultural automation for farmers. Different sensor can interface with
the system such as motion sensor, light sensor, flame sensor, temperature sensor etc.
Automation toggling of device based on certain situation can also be implemented
WIfi and Ethernet based home automation systems can be developed.
Using this system as framework, the system can be expanded to a distributed home
automation system that consists of server, sensors. Server controls and monitors the
various sensors, and can be easily configured to handle more hardware interface
module (sensors) with various other options which could include home security
features like capturing the photo of a person moving around the house and storing
it onto the cloud. This will reduce the data storage than using the CCTV camera
which will record all the time and stores it. The system can be expanded for energy
monitoring, or weather stations. This kind of a system with respective changes can
be implemented in the hospitals for disabled persons or in industries where human
invasion is impossible or dangerous, and it can also be implemented for
environmental monitoring.
It is deduced from the study that IoT has become so vital in daily life and it is
creating a big impact for the future. For example, solutions can be provided instantly
for traffic flows, reminders about vehicle maintenance, reduce energy consumption,
etc. Monitoring sensors will diagnose pending maintenance issues, and even
prioritise maintenance crew schedules for repair equipment. Data analysis systems
will help metropolitan and cosmopolitan cities to function easily in terms of traffic
management, waste management, pollution control, law enforcement and other
major functions efficiently.
Linked devices can help people personally get an alert from the refrigerator
reminding them to shop some vegetables when the vegetable tray is empty, the home
security systems enables people to open the door for some guest with help of
connected devices (IoT). Since there is a massive growth in number of devices day
| 56
by day, the amount of data generated would also be enormous. Here is where Big
Data and IoT go hand in hand.
Big Data manages the enormous amount of data generated using its technologies.
The Internet of Things (IoT) and big data are two vital subjects in commercial,
industrial, and many other applications. The name IoT refers to the world of
machines or devices connected to the Internet, by which a large amount of big data
is collected, stored and managed. Big data additionally refers to the analysis of this
generated data to produce useful results. The main motivating power behind the IoT
and big data has been the collection and analysis of data related to consumer
activities in order to find out why and what customers buy.
It was not too long ago that visualised houses of the future where things would be
done on their own- lights coming on by themselves, coffee being brewed just the
way an individual like, as waking up and taking a shower knowing the weather
outside and adjusting the water temperature accordingly. The world is at a point
where technology to achieve all that has been around for a while and has now
become affordable. Hence, it is not a particularly big surprise that the world is
witnessing some amazing things happening in the world of automation.
5.3 Recommendations
There are some recommendations for Future works. Some of them are:
a) The home automation system was limited to control Lights on/off, Fan
on/off, On/off different appliance which makes use of Bluetooth wireless
control. Future work should make use of cloud networking connection and
also include temperature and humidity, motion detection, fire and smoke
detection and light level control and data stored in a cloud server. This will
enable users to control their homes remotely from anywhere using internet
service and smartphones.
b) There is the need to design a smart home which employs the biometric
technology in a larger and more comprehensive form.
c) Better to use relay modules and connect it directly than using normal relays
| 57
with breadboard.
d) Try to find a way to amplify the Bluetooth module signal to work in greater
distance.
e) Test each and every component before using them especially the relays for
safety purposes.
| 58
REFERENCES
| 59
Rajneesh, Abhinav and Sh. Nishant (2015). “Internet of Things based Controlling
of Appliances using GSM/GPRS Enabled Embedded Server for Remote
Access”. IJSRD - International Journal for Scientific Research &
Development, Vol. 3, Issue 05, 939- 941.
Sirsath N. S, Dhole P. S, Mohire N. P, Naik S. C & Ratnaparkhi N.S (2013). “Home
Automation using Cloud Network and Mobile Devices”. Department of
Computer Engineering, 44, Vidyanagari, Parvati, Pune-411009, India
University of Pune,
Vinay, Sagar, K.N. and Kusuma S.M. (2015). “Home Automation Using Internet of
Things”. International Research Journal of Engineering and Technology
(IRJET), Volume: 02 Issue: 03, pp.1965- 1970
Wheat, D. (2011). Arduino Internals. USA: Apress.
| 60