Design and Implementation of A Remote Control System of Doors and Lights Using An Android Phone
Design and Implementation of A Remote Control System of Doors and Lights Using An Android Phone
of
by
KIMBUGWE JAMES
BCI/40240/131/DU
And
BOWGO JOHN KUR DENG
BCI/34648/122/DF
1
DECLARATION
Signature……………………………………………….Date…………………………………………..
BOWGO JOHN KUR
i
APPROVAL
Project Supervisor
Mr. KIYAGA OBEDI
Signature …………………………………………..
Date ……………………………………………
ii
DEDICATION
We dedicate this piece of work to our parents, they have been source of inspiration,
engine of courage and secret of our achievements since our childhood. We also
dedicate it to our sisters and brothers for all the support.
iii
ACKNOWLEDGEMENTS
First of all, we thank the Almighty God the most gracious and most merciful for the
wisdom and knowledge, the health and protection and all that he has bestowed on
us so that this report becomes a success.
Sincere gratitude to our beloved parents and guardians for the spiritual moral and
financial support accorded to us throughout the entire course of our education.
We would like to take this opportunity to express our gratitude towards all the
people who have been in various ways, helped in the successful completion of our
project report.
We must convey our gratitude to Mr. Kiyaga Obedi for giving us the constant source
of inspiration and help in preparing the project, personally correcting our work and
providing encouragement throughout the project.
We also thank all our faculty members for steering us through the tough as well as
easy phases of the project in a result oriented manner with concern attention.
iv
ABSTRACT
The new generation is now full of smart people using smart technology. Smart
devices make life of a person easy and updated. There are hundreds of goods
available today that allow us have power over the devices without human
intervention, either by remote control; or even by voice command. So in “Design and
Implementation of a Remote Control System of Doors and Lights Using an Android
Phone” controller and Bluetooth module from the mobile device is used for smart
lock system and switching on and off the lights. The designed system describes
improvement of a security system that is integrated with an Android mobile phone
device using Bluetooth as a wireless connection protocol. Android OS is currently the
go ahead on mobile market. This designed system allows a user to lock or unlock a
door or switch on and off the lights in a short range from the door. The application
was designed to allow the user to also check the status of the door. The mobile
device requires a password to increase the security of the system. The hardware on
the door uses an Arduino Uno microcontroller and servo motor to act as the locking
mechanism. The Bluetooth protocol was chosen as a communication method
because it is already integrated into many Android devices and is secured through
the protocol itself. It also fits well into the design requirements of the project for a
short range, wireless connection method.
In our project we used Bluetooth in a mobile device, so it will be more easy and
efficient to use. It was also based on Android and Arduino platform both of which
are free open source software. In this project, a system called design and
implementation of a remote control system of doors and lights using Bluetooth-
based Android Smartphone was designed and tested. First the hardware design and
software development we described, then the design of a Bluetooth-based
Smartphone application for locking/unlocking the door and switching the lights on
and off programmed. The hardware design for door and light system is the
combination of android smart phone as the task master, Bluetooth module as
command agent, Arduino microcontroller as controller centre / data processing
centre, and servo motors for rotations of doors.
v
TABLE OF CONTENTS
DECLARATION ...................................................................................................... i
APPROVAL ........................................................................................................... ii
DEDICATION ...................................................................................................... iii
ACKNOWLEDGEMENTS........................................................................................ iv
ABSTRACT ........................................................................................................... v
TABLE OF CONTENTS ......................................................................................... vi
LIST OF FIGURES AND TABLES............................................................................ ix
LIST OF ACRONYMS AND ABBREVIATIONS. .......................................................... x
vi
3.1.1 Agile (Iterative Development) Model: ......................................................... 14
3.2 Methods used to collect information. ............................................................. 15
3.3 SYSTEM DESIGN ....................................................................................... 15
3.3.1 Block diagram of the system ...................................................................... 16
Circuit diagram of the system ............................................................................ 16
3.4 Door and light Control Unit ........................................................................... 17
3.4.1Software requirement. ................................................................................ 18
3.4.1.1Arduino ................................................................................................... 18
3.4.2 Android Application. ................................................................................... 18
3.4.3 Hardware Requirement .............................................................................. 18
3.4.3.1 Arduino UNO ......................................................................................... 19
3.4.3.2 Bluetooth Technology ............................................................................. 19
3.4.4 CAPACITOR............................................................................................... 20
3.5 Voltage Regulator......................................................................................... 21
3.5.1 Servo Motors. ............................................................................................ 21
3.5.2 Relay Module ............................................................................................ 22
3.5.3 Resistors ................................................................................................... 22
3.5.4 Transistors ................................................................................................ 23
3.5.5 Wire connectors ........................................................................................ 23
3.5.6 Vero board................................................................................................ 23
3.5.7 Jump wires ............................................................................................... 24
3.6 Design and Implementation .......................................................................... 24
3.6.1 Software Implementation .......................................................................... 25
3.6.2 Android Phone and Android App ................................................................. 25
3.6.2.1 Programming the Arduino-Uno ................................................................ 25
3.7 Light system ............................................................................................. 26
vii
4.1.4 Non-functional Requirements ..................................................................... 28
4.2 System Architecture .................................................................................. 28
4.3 System Testing ............................................................................................ 28
4.4 Results of Testing......................................................................................... 29
4.5 IMPLEMENTATION. ................................................................................... 29
4.6 Measurement set-up for different location ...................................................... 30
References: ....................................................................................................... 36
viii
LIST OF FIGURES AND TABLES
ix
LIST OF ACRONYMS AND ABBREVIATIONS
x
CHAPTER ONE: INTRODUCTION.
Today, most mobile phones are a 'smart phone’, which offers more advanced
capabilities in connectivity issues than regular cell phones. According to an
investigation by ABI Research, at the end of 2013, 1.4billion smart phones were in
use: 798 million of them were running android, 294 million were running Apple’s
iOS, and 45 million running Windows Phone. Smart phone usually support one or
more short range wireless technologies such as Bluetooth and infrared, making it
possible to transfer data via these wireless connections. Smart phone can provide
computer mobility, ubiquitous data access, and pervasive intelligence for almost
every aspect of business processes and people’s daily lives
1
1.1 BACKGROUND.
With rapid development of information technology, the concept of Smart Living has
been put forward and emerged as an attractive field for researchers and investors in
the past decades. In 2006, Tom and Sitte proposed a reference model named Family
System which is used to describe a set of family processes, such as managing
finance, planning and preparing meals, family health care, education, household
maintenance, generating income and recreation and social life maintenance in Home
Automation (HA), as well as their relationships, and interaction with external
elements. The model of Family System can be a very useful platform for further
research into creating Smart Living in companies, institutions and homes to help
people in daily life. Bluetooth technology has been one of important technologies to
home, company and institution automation. It is a wireless technology developed to
replace cables on devices like mobile phones and PCs. Although "cable-replacement"
could create a point-to-point communication, Bluetooth allows wireless devices to be
able to communicate with each other within range. The network of a set of
Bluetooth devices is called "piconet" which is an ideal technology to network a smart
modern company, home or institution. Recently, more and more Smart Living
applications based on Android and Bluetooth have been developed Android system
equips with SDK and APIs for developers to build new applications. With Bluetooth
already integrated into Android system, many Smart Living systems are constructed
under Android system, currently many devices such as lamps and TVs don't have
Bluetooth module embedded in the devices, so a suitable Bluetooth module and
microcontroller need to be sought out from the marketplace so that a Bluetooth-
based Android application can then be built using JAVA based development tool like
the Eclipse or android studio.
1. 2 PROBLEM STATEMENT.
Due to the high costs involved in the current methods used by various companies
and institutions for monitoring lights and doors and other weaknesses like security
measures being compromised, these have driven us in developing and
implementing a cost effective remote control system of doors and lights using an
android phone via Bluetooth technology.
2
1.3 Objective of the project.
1.3.1 Main Objectives.
To develop and implement a remote control system of doors and lights using an
android phone
1.3.2 Specific objective
To design a remote control doors system
To design a remote control lights system
To design an android software application
To test and validate the implemented system
1.4 SCOPE.
1.4.1 Content scope.
The project was applied in offices such as institutions, companies and
organizations. Due to the fact that these institutions have a number of offices
which may need a lot of labor to monitor them.
3
1.5 Significance of the Project.
An automated system can replace good amount of human working force, moreover
humans are more prone to errors and in intensive conditions the probability of error
increases whereas, an automated device can work with diligence, versatility and with
almost zero error.
I. Economy improvement. Automation may improve in economy of enterprises,
society or most of humankind. For example, when an enterprise that has
invested in automation technology recovers its investment, or when a state or
country increases its income due to automation like Germany or Japan
II. Increasing efficiency and premises protection: Automation can be used to
ensure that at specific time intervals or at specific locations, the building is
secured, computers are shut down and security systems are enabled. This will
reduce cost and save energy, as well as protecting the premises against theft,
whilst at the same time ensuring nobody left inside the building. This eliminates
the human issue of security (where mistakes can be made or routines
forgotten.
III. Companies and businesses using the system would benefit from reduced
operating costs, and a huge amount of extendibility within the system. This
would replace existing, complex and highly expensive methods used in the
companies, institutions that will have used the system
IV. This is why this project looks into construction and implementation of a system
involving hardware and software to control doors and lights.
4
CHAPTER TWO: LITERATURE REVIEW.
There are many systems for remote monitoring and control designed as commercial
products or experimental research platforms. It is noticed that most of the research
carried out belongs to the following categories
a) Internet based Monitoring using Servers, GPRS modems, etc. with different
approaches.
b) GSM-SMS protocols using GSM module individually or in combination with
Internet Technologies.
c) Monitoring using Wireless Sensor Networks.
d) Wireless Monitoring using Bluetooth, Wi-Fi, Zig bee and RF.
e) Applications have varied widely like Home Automation, Security Systems, Bio-
medical applications, Agriculture, Environment, Reservoir, Bridge health
monitoring, etc.
According to (Saito et al., 2000) they developed home gateway system for
interconnecting home network consisting of IEEE 1394 AV network and X10 power
line home automation network with Internet. This provided remote access functions
from Internet for digital AV appliances like Digital Video Camera, Digital VCR
connected to IEEE 1394 network and home appliances like TV, desk lamp, electric
fan connected to X10 controller.
Al-Ali and Al-Rousan, 2004 developed Java based home automation system via
World Wide Web. The home appliances were controlled from ports of embedded
system board connected to PC based server at home.
The control of devices were established and their condition is monitored through the
Internet, (Alkar and Buhur, 2005) implemented Internet based wireless flexible
solution where home appliances are connected to slave node. The slave nodes
5
communicate with master node through RF and master node has serial RS232 link
with PC server. The nodes are based on PIC 16F877 μc. PC server is formed of a
user interface component, the database and the web server components. An
Internet page has been setup running on a Web server. The user interface and the
Internet front end are connected to a backend data base server.
According to (Al-Khateeb et al., 2009), they used X10 controller interfaced through
serial port to PC server for control of devices. The Common Gateway Interface (CGI)
is used to interface between the browser and the X10 protocol via http connection.
The server executes CGI programs in order to satisfy a particular request from the
browser, which expresses its request using the http.
In the research made by (Peng Liu et al., 2007), they developed a model of web
services based email extension for remote monitoring of embedded systems which
integrates web services into emails. It uses a general purpose email messaging
framework to connect devices and manipulators. This low cost model fits for systems
with low connection bandwidth, small data transportation volume and non-real time
control, e.g., monitoring of home appliances and remote meter-reading.
Tan and Soy, 2002 developed a system for controlling home electrical appliances
over the Internet by using Bluetooth wireless technology to provide a link from the
appliance to the Internet and Wireless Application Protocol (WAP) to provide a data
link between the Internet and a mobile phone. However, technical details relating
controller are not revealed.
According to (Nikolova et al., 2002) these demonstrated that the control of home
appliances can be extended beyond the home network to wireless mobile networks
without any modification in the network specifications. This was accomplished by
developing and implementing a HAVi (Home Audio Video Interoperability) - WAP UI
gateway that intermediates between a wired home network and a wireless
communication network using HAVi and WAP specifications, respectively. The
gateway use both pull and push technologies, improves the network integration and
6
provides opportunities for developing applications that combine mobile devices with
home network devices.
According to the system developed by (Ximin et al., 2005), these designed and
implemented an Internet home automation system. The design uses an embedded
controller based on C8051F005 microcontroller which is connected to a PC-based
home Web server via RS232 serial port. The home appliances are connected to the
input/output ports and the sensors are connected to the analog/digital converter
channels of the embedded controller. The software of the system is based on the
combination of Keil C, Java Server Pages, and JavaBeans, and dynamic DNS service
(DDNS) client. Password protection is used to block the unauthorized user from
accessing to the server.
The client can access central monitoring computer server through Internet and
know parameters of different wind turbines. According to (Chen Chao et al., 2009)
they developed a remote wireless monitoring system for off grid Wind turbine based
on the GPRS and the Internet. The remote monitoring system is made up of three
parts: controlling terminal, central monitoring computer and communication
network. Controlling terminal consists of microcontroller ARM7 LM3S1138, data
acquisition module and GPRS communication module WAVECOM Q2406B connected
7
to ARM7 system using serial port. GPRS module sends parameters relating wind
turbine to central monitoring computer.
Kumari and Malleswaran, 2010 developed real time based equipment condition
monitoring and controlling system using embedded web based technology which
directly connects the equipment to network as a node. The embedded system
consists of ARM7 based LPC 2148 microcontroller board, A/D, signal conditioning,
sensors, and communications interface. The function of web based system is to
collect the real time data information of the on-site equipment and remotely send
the data in the form of user defined data transmission style. The remote Computer
collects the data and running status through the network and provides the
comparison on the historical data. If the parameter value is different from the
original set value, the corrected signal is sent to the control unit. The embedded
remote monitoring system completes the data Collection in the embedded platform
and provides the data to remote host through the TCP/IP protocol from Web server.
It creates condition to realize unattended management through providing Web-
based graphical management interface for the Internet or LAN users.
8
flexibility, low operating charges, etc. Today Wireless Sensor Network are used into
an increasing number of commercial solutions, aimed at implementing distributed
monitoring and control system in a great number of different application areas.
In the system proposed by (Kanma et al., 2003) ,they proposed a home appliance
control system over Bluetooth with a cellular phone, which enables remote-control,
fault-diagnosis and software-update for home appliances through Java applications
on a cellular phone. The system consists of home appliances, a cellular phone and
Bluetooth communication adapters for the appliances. The communication adapter
hardware consists of a 20MHz 16bit CPU, SRAM and a Bluetooth module. The
communication adapter board is connected to the home appliance and to the cellular
phone through serial ports. The appliances can communicate with the cellular phone
control terminal via Bluetooth SPP.
9
According to (Flammini et al., 2007) suggested a novel architecture for
environmental tele monitoring that relies on GSM for sampling point delocalization,
while on-field nodes implement local subnets based on the DECT technology. Local
subnets contain two major blocks; Acquisition Station (AS) where sensors and
actuators are located and Transmitting Module (TM), i.e., the module that handles
several measurement stations and sends data to the control center (CC). Each AS
acts as a data logger, storing in its internal memory device field data;
communications between AS and TM are cyclic (round robin), with a cycle time of
about 1–10 min. On the contrary, communications between TM and CC occur once a
day for data-logging purposes, while alarms or threshold crossings are
communicated asynchronously by means of Short Message Service (SMS).
Prototypes have been realized to interface with temperature (T, AD590 from analog
devices), humidity (RH, HumirelHM1500), and carbon monoxide (CO, Figaro
TGS2442) sensors. DECT Siemens module MD32 and GSM module MC35 were used.
AS was based on Microchip's PIC18F452 microcontroller and TM was designed using
32-bit ARM-based microcontroller from Samsung (S3F441FX).
10
According to (Bencini et al., 2009),they developed state of the art WSN based
system for monitoring a series of physiological parameters in the vineyard to prevent
plant vine diseases. The different soil moistures in the same field is used to decide
the correct amount of water for irrigation; sandy soils have very different behavior to
irrigation in respect to clayey ones; water retention capacity is completely different
and measuring it exactly where it is needed can help in controlling the irrigation
system and saving water. Monitoring air temperature and humidity in different parts
of a vine can help in preventing and fighting plants diseases, reducing the amount of
pesticides only when and where they are necessary. Each node consists of MIDRA
mote is equipped with 868 MHz radio transceiver, Chipcon CC1000TM. The master
node of the Wireless Sensor Network is connected to a GPRS gateway board,
forwarding data to a remote server, using the TCP-IP standard protocol. It included
11 nodes with a total of 35 sensors distributed on 1 hectare area; monitor common
parameter using simple, unobtrusive, commercial and cheap sensors, forwarding
their measurements by the means of a heterogeneous infrastructure, consisting of
WSN technology, GPRS communication and ordinary Internet data transfer (TCP-IP
protocol). Data coming from sensors are stored in a database that can be queried by
users everywhere in world, only using a laptop or a PDA: the Smart User Interface
also allows to read and to analyze data in an easy way.
(Harms et al., 2010) described the emerging wireless sensor networks (WSN) for
autonomous Structural Health monitoring SHM systems for bridges. In Smart Brick
Network, the base station and sensor nodes collect data from the onboard and
external sensors. The sensor nodes communicate their data from quasi-static
sensors, e.g., temperature sensors, strain gauges and seismic detectors to the base
station over the Zig Bee connection. The base station processes these data and
communicates them, along with any alerts generated, to a number of destinations
over the GSM/GPRS link provided by the cellular phone infrastructure. The data are
reported by email and FTP to redundant servers, via the Internet, at regular intervals
or on an event-triggered basis. The alerts are sent directly by SMS text messaging
and by email. Wireless sensor networks are the key enabler of the most reliable and
11
durable systems for long-term SHM and have the potential to dramatically increase
public safety by providing early warning of impending structural hazards.
2.3 The major strengths and weaknesses drawn from the conclusions
laid by various researchers are as under:
2.3.1 Major strengths:
I. Exhaustive research has been carried out on Internet based Monitoring scheme
with various protocols and systems providing detailed description of remote
process states to the authorized users.
II. .Many remote monitoring systems have been designed and experimented by
using GSM-SMS which normally involved the use of GSM modem for carrying
sensing and control of devices in the system by users having cellular coverage. It
12
is popular because of its un parallel availability and modest security at the
affordable price.
III. Numerous systems have been developed using Wireless Sensor Networks which
consists of several sensor nodes in proximity and having data transmission and
reception capability between nodes and central base station for wide range of
applications. Though initial deployment cost may be high, the operational cost of
data communication within the system is negligible.
From the above drawbacks of the designed systems, This lead us to the a low
cost system is more effective in terms of operation and will benefit most of our
clients.
13
CHAPTER THREE: METHODOLOGY.
The project specification above is clear and defined, and so we were capable of
building a system that can perform these actions. However, in order to build this
system we first ascertain what was required to complete these tasks. In this chapter,
we covered what tools and methods we used to reach our objectives.
Furthermore, we also identified and justified any risks for the project.
This ensures that at each major step of the way we have a working (or at least
partially working) system.
14
Furthermore, if any major changes occur in the system due to any reason the
project requirements and specifications can evolve around these. The major features
of the development model we are using can be seen in the following image.
We developed models of the system that served as design. There are two main
categories of modeling such as procedural and object-oriented modeling.
This project mainly adopted object-oriented modeling. Object-oriented modeling is a
software engineering approach that models a system as a group of interacting
objects. Each object represented some entity of interest in the system being
15
modeled, and is characterized by its class, its state (data elements), and its
behaviour (Vostro, 2012).
Door 2 Door 1
Mobile
application
Servo motor
Arduino Uno
Bluetooth
module
Light 1
Light 2
16
3.3.2 Circuit diagram of the system
17
3.4.1 Software requirement.
3.4.1.1Arduino
The software is designed with the use of Arduino Integrated Development Kit
Environment that allows writing, compiling and uploading code to the board. The
program or sketch is written using C programming language or C compiler.
Two programs are written for two different systems: First the program for the
remote control which allows the remote control to instruct light control system to
switch “ON” or “OFF” the lights. In the second system the program is written to
allow automatic closure and opening of the doors using the servo motor.
This part describes the implementation of the whole system, from Arduino no board
to the appliances. This system is integrated using Arduino-Uno board, an HC-06
Bluetooth module, relays modules, an android device, an android app to control the
Arduino board, and other electronics components.
18
3.4.3.1 Arduino UNO
Arduino is open source physical processing which is based on a microcontroller
board and an incorporated development environment for the board to be
programmed. Arduino gains a few inputs, for example, switches or sensors and
control a few multiple outputs, for example, lights, doors and others. Arduino
program can run on Windows, Macintosh and Linux operating systems (OS) opposite
to most microcontrollers’ frameworks which run only on Windows. Arduino can be
utilized to create interactive items, taking inputs from a diverse collection of switches
or sensors, and controlling an assortment of lights, doors, and other physical
outputs.
19
band of accessible recurrence all through the world. Correspondences can
acknowledge point to point and point to multipoint.
Bluetooth Module
Arduino-Uno board doesn’t support Bluetooth connection on its own, which makes
the idea of connecting it wirelessly to an Android device impossible. So a medium
between the Arduino-Uno board and android device is needed and in this project it is
a Bluetooth module specifically the HC-06 Bluetooth module. The HC-06 is a user
friendly need only basic knowledge and it is programmable using the AT commands.
It comes only in one fixed mode either master or slave. In this project the slave
module was used.
3.4.4 CAPACITOR.
A capacitor is an electrical/electronic device that can store energy in the electric field
between a pair of conductors (called "plates"). The process of storing energy in the
capacitor is known as "charging", and involves electric charges of equal magnitude,
20
but opposite polarity, building up on each plate. Capacitors are often used in electric
and electronic circuits as energy-storage devices. They can also be used to
differentiate between high-frequency and low-frequency signals. This property
makes them useful in electronic filters in this
The motor is paired with some type of encoder to provide position and speed
feedback. In the simplest case, only the position is measured. The measured
position of the output is compared to the command position, the external input to
the controller. If the output position differs from that required, an error signal is
generated which then causes the motor to rotate in either direction, as needed to
bring the output shaft to the appropriate position. As the positions approach, the
error signal reduces to zero and the motor stops.
21
Figure 3.5 shows a servo motor
3.5.3 Resistors
A resistor is a passive two-terminal electrical component that implements electrical
resistance as a circuit element. In our project resistors were used to reduce current
flow, adjust signal levels, to divide voltages, bias active elements, and terminate
transmission lines.
22
Figure 3.7 shows some of the capacitors.
3.5.4 Transistors
A transistor is a semiconductor device used to amplify or switch electronic signals
and electrical power. It is composed of semiconductor material usually with at least
three terminals for connection to an external circuit. The type of transistors used in
this project are NPN type. A small voltage at the base allows a larger voltage to flow
through the emitter and collector. When the switch button is pressed a current
passes through the relay into the base of the transistor, the transistor then allows
current flow from the +12 to 0. This allows the lamps to be powered on.
23
2.54 mm (0.1 inch) spacing and has a size of 13*13.4 centimetres. The holes are
ringed by round copper pads that enable components to be soldered onto the vero
board using a soldering wire and soldering gun.
24
3.6.1 Software Implementation
Under this section, the major goal was to achieve an application that uses android
platform from version 4.4 and above. This application was developed to run on
smart phones and tablets using the android operating system. The Extensible
Markup Language (XML) was the framework that was used to design the user
interfaces of this application.
The codes are then uploaded to the Arduino Uno, so that the Arduino can control
the Bluetooth module and be able to send the command in order to enable the relay
switches on/off and turn the servo motor to close and open the doors.
25
3.7 Light system
This light system is used in two places for internal section and external section. If a
user wants to switch the lights of the room on and it is dark outside then the lights
will switched on by placing the light button on the android phone for the specific
room and when its day the light will be switched off by the user. This ensures power
saving in case there is no need for lights.
26
CHAPTER FOUR: TESTING AND RESULTS
4.1 Introduction
This chapter describes and verifies strengths and weaknesses of the existing system.
It highlights the requirements of the developed system and its testing process and
result analysis.
27
All registered users are able to view other users with the same application thus
clearly being able to perform a backup in case need arises.
The registered users of the application are able to update (edit, delete) the
attributes they set during registration according to their security needs.
28
Our final testing phase was after development had been completed. This stage
tested all major and minor aspects of the application to ensure they worked in all
instances. This phase provided some very useful results for us to check the
effectiveness of the application, and identified several major issues which were then
rectified within our testing schedule
4.5 IMPLEMENTATION.
Power up the Circuit and scan the Bluetooth devices on your circuit and will be able
to find a Bluetooth.
Start Bluetooth connection of your mobile phone.
Open the ‘light and door control application on your
Select connect device from option
Bluetooth Serial Module will be available under ‘select a device to connect’ list.
Pair ‘Bluetooth Serial Module’ by providing pair code ‘2468’.
Start selecting particular device (lights or doors) for making ‘ON/OFF’ or closed or
opened.
The doors or lights should respond accordingly.
29
4.6 Measurement set-up for different location
There are three (3) different types of measurements that have been done;
(i) indoor
(ii) outdoor with non-obstacle area
(iii) Indoor with obstacle area. As shown in Table 1, it is found that, for indoor
(obstacle and non-obstacle area), the maximum distance that the receiver can
detect the RF signal from the Smartphone is around 15 meters in house while
for outdoor area, the maximum distance is 20 meters.
10 Connected
15 Intermittent
20 Disconnected
25 Disconnected
30 Disconnected
15 Connected
20 Intermittent
30
25 Intermittent
30 Disconnected
5 Connected
15 Connected
20 Intermittent
25 Intermittent
30 Disconnected
31
CHAPTER FIVE: CONCLUSIONS AND RECOMMENDATIONS
5.1 Introduction
The design and implementation of a remote control system of doors and lights using
an android phone was a success. This system consists of an Arduino-Uno board, a
Bluetooth Module, lights, servo motors an android Application. It is user friendly and
it is cost effective.
Also it can be concluded that the objectives of this project have been successfully
met and they are as follows:
To develop and implement a remote control system of doors and lights using an
android phone
To design a remote control of doors by android
To design a remote control of lights by android
To test and validate the implemented system
32
5.4 Conclusion
Since there are a lot of improvements in technology and the evolution of electronic
systems today, several individuals and organizations have shifted their work from
manual processes to automated process via Mobile applications. Individuals need to
employ such technologies in the area of security. This system also provides
convenience to Institutions or Organizations who emphasis security and
confidentiality on their premises and assets contained in these premises. These
institutes include; universities, banks, secondary schools, law firm offices and other
offices in general.
33
APPENDIX I: GHANT CHAT
34
APPENDIX II: BUDGET
SN ITEM QTY UNIT COST TOTAL
1 Breadboard 1 2,000 20,000
2 Jumpers 3 6,000 18,000
3 Resistors 4 5,000 20,000
4 Transistors 3 7,000 21,000
5 Voltage Regulators 2 6,000 12,000
6 Servo Motors 2 20,000 40,000
7 Arduino 1 100,000 100,000
8 Vero Board 1 3,000 3,000
9 Solder Wire 8 2,000 16,000
10 Bulbs 3 40,000 12,000
11 Relay 2 6,000 12,000
12 Printing 70,000
13 Transport 80,000
14 Diodes 4 1000 40000
15 Bluetooth module 1 60,000 60,000
16 Miscellaneous 150000
Total 638,000
35
REFERENCES:
Ahmed ElShafee, Karim Alaa Hamed,” Design and Implementation of a Wi-Fi Based
Home Automation System”, International Journal of Computer, Electrical,
Automation, Control and Information Engineering Vol: 6, No: 8, 2012.
Huang, Huiping, et al.”A remote home security system based on wireless sensor
network and GSM technology.” Networks Security Wireless Communications and
Trusted Computing (NSWCTC), 2010 Second International Conference on. Vol. 1.
IEEE, 2010.
Julius Bin Pelipos (2010), “Smart Key Door with Wireless Security System using RF
Signal,”
Junaina Mohd Shah (2009), “Door Locking System using RFID Technology,”
Piyare, R., and M. Tazil. ”Bluetooth based home automation system using cell
phone.” Consumer Electronics (ISCE), 2011 IEEE 15th International Symposium on.
IEEE, 2011.
Potts, Josh, and Somsak Sukittanon. ”Exploiting Bluetooth on Android mobile devices
for home security application.” Southeastcon, 2012 Proceedings of IEEE. IEEE, 2012.
Sarijari, Mohd Adib B., et al.”Wireless home security and automation system utilizing
zigbee based multi-hop communication.” Telecommunication Technologies 2008 and
36
2008 2nd Malaysia Conference on Photonics. NCTT-MCP 2008. 6th National
Conference on. IEEE, 2008.
Yuksekkaya, Baris, et al.”A GSM, internet and speech controlled wireless interactive
home automation system.” Consumer Electronics, IEEE Transactions on 52.3 (2006):
837-843.
37
38
39
/****************** Android Controlled lights and doors ******************/
/*Coder - james*/
#include <Servo.h>
Servo myservo;
// create servo object to control a servo
int pos = 0;
// variable to store the servo position
byte val;
void setup()
{
// Serial.begin(115200);
Serial.begin(9600);
myservo.attach(12);
// attaches the servo on pin 12 to the servo object
pinMode(13, OUTPUT);
//Light1 pin
pinMode(3, OUTPUT);
//Light2 pin
pinMode(4, OUTPUT);
//Light3 pin
pinMode(5, OUTPUT);
//AC pin
pinMode(12, OUTPUT);
//Door Lock
}
void loop()
{
int a=0;
40
if(Serial.available())
{
val=Serial.read();
Serial.println(int(val));
//Display received value on Serial Monitor
if(int(val)==49)//
Turn Light1 ON
digitalWrite(13,HIGH);
if(int(val)==53)//Turn Light3 ON
digitalWrite(4,HIGH);
else if(int(val)==54)//Turn Light3 OFF
digitalWrite(4,LOW);
if(int(val)==55)//Turn AC ON
digitalWrite(5,HIGH);
41
{ // in steps of 1 degree
myservo.write(pos);
codes for the android application
ARS automation
package com.ars.automation;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class ARSAutomationActivity extends Activity {
/** Called when the activity is first created. */
BluetoothAdapter mBluetoothAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startActivity(new Intent("com.ars.automation.MENU"));
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
Toast.makeText(this, "Bluetooth is not available",
Toast.LENGTH_LONG).show();
finish();
return;
}
}
public void onStart()
{
super.onStart();
if (!mBluetoothAdapter.isEnabled()) {
Intent enableIntent = new
Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableIntent, 3);
42
// Otherwise, setup the chat session
}
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
Menu
package com.ars.automation;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Set;
import java.util.UUID;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
43
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.widget.ToggleButton;
public class menu extends Activity {
BluetoothAdapter mBluetoothAdapter;
BluetoothSocket mmSocket;
BluetoothDevice mmDevice;
OutputStream mmOutputStream;
InputStream mmInputStream;
Editable nameb;
String blname;
int stat;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.rooms);
final EditText name = (EditText) (findViewById(R.id.editText1));
Button ok = (Button) (findViewById(R.id.button1));
ok.setOnClickListener(new View.OnClickListener() {
44
stat = 1;
} catch (IOException e) {
stat = 0;
e.printStackTrace();
}
}
});
45
Toast.LENGTH_LONG).show();
}else {
if (stat == 1){
try {
mmOutputStream.write('2');
}catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(menu.this,
"Connection not established with your
home",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
} else
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
}
}
});
final ToggleButton light2 = (ToggleButton)
findViewById(R.id.ToggleButton01);
light2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if (light2.isChecked()) {
if (stat == 1){
try {
mmOutputStream.write('3');
}catch (IOException e) {
46
// TODO Auto-generated catch block
Toast.makeText(menu.this,
"Connection not established with your
home",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
} else
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
}else {
if (stat == 1){
try {
mmOutputStream.write('4');
}catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
} else
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
}
}
});
47
final ToggleButton light3 = (ToggleButton)
findViewById(R.id.ToggleButton02);
light3.setOnClickListener(new View.OnClickListener() {
Toast.LENGTH_LONG).show();
}else {
if (stat == 1){
try {
mmOutputStream.write('6');
}catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
48
e.printStackTrace();
}
} else
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
}
}
});
final ToggleButton ac = (ToggleButton)
findViewById(R.id.ToggleButton03);
ac.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
if (ac.isChecked()) {
if (stat == 1){
try {
mmOutputStream.write('7');
}catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
} else
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
}else {
49
if (stat == 1){
try {
mmOutputStream.write('8');
}catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
} else
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
}
}
});
final ToggleButton door = (ToggleButton)
findViewById(R.id.ToggleButton04);
door.setOnClickListener(new View.OnClickListener() {
50
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
} else
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
}else {
if (stat == 1){
try {
mmOutputStream.write('0');
}catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
e.printStackTrace();
}
} else
Toast.makeText(menu.this,
"Connection not established with your home",
Toast.LENGTH_LONG).show();
}
}
});
51
void findBT() throws IOException
{
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
// if(mBluetoothAdapter == null)
//{
// myLabel.setText("No bluetooth adapter available");
//}
if(!mBluetoothAdapter.isEnabled())
{
Intent enableBluetooth = new
Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBluetooth, 1);
}
Set<BluetoothDevice> pairedDevices =
mBluetoothAdapter.getBondedDevices();
if(pairedDevices.size() > 0)
{
for(BluetoothDevice device : pairedDevices)
{
if(device.getName().equals(blname))//FireFly-B1A7Change to the name
of your bluetooth module (Case sensitive)
{
mmDevice = device;
break;
}
// myLabel.setText("Bluetooth Device Found");
UUID uuid = UUID.fromString("00001101-0000-1000-8000-
00805f9b34fb"); //Standard //SerialPortService ID
mmSocket = mmDevice.createRfcommSocketToServiceRecord(uuid);
52
mmSocket.connect();
mmOutputStream = mmSocket.getOutputStream();
mmInputStream = mmSocket.getInputStream();
// beginListenForData();
// myLabel.setText("Bluetooth Opened");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
super.onCreateOptionsMenu(menu);
MenuInflater h= getMenuInflater();
h.inflate(R.menu.hardmenu,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch(item.getItemId())
{
case R.id.abou:
startActivity(new Intent("com.ars.automation.ABOUT"));
return true;
}
return false;
}
About
package com.ars.automation;
import android.app.Activity;
53
import android.os.Bundle;
public class About extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
}
}
Rooms XML code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/back"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:weightSum="1">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="51dp"
android:gravity="center_horizontal"
android:text="Please select what you wish to control :"
android:textColor="#555"
android:textAppearance="?android:attr/textAppearanceLarge"
>
</TextView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
54
<ToggleButton
android:id="@+id/ToggleButton01"
android:layout_width="160sp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/toggleButton1"
android:layout_below="@+id/toggleButton1"
android:layout_marginTop="20dp"
android:text="ToggleButton"
android:textColor="#555"
/>
<ToggleButton
android:id="@+id/ToggleButton02"
android:layout_width="160sp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/ToggleButton01"
android:layout_below="@+id/ToggleButton01"
android:layout_marginTop="19dp"
android:text="ToggleButton"
android:textColor="#555"
/>
<ToggleButton
android:id="@+id/ToggleButton03"
android:layout_width="160sp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/ToggleButton02"
android:layout_below="@+id/ToggleButton02"
android:layout_marginTop="19dp"
android:text="ToggleButton"
android:textColor="#555"
/>
55
<ToggleButton
android:id="@+id/ToggleButton04"
android:layout_width="160sp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/ToggleButton03"
android:layout_below="@+id/ToggleButton03"
android:layout_marginTop="15dp"
android:text="ToggleButton"
android:textColor="#555"
/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/toggleButton1"
android:layout_marginLeft="15dp"
android:text="Light 1 :"
android:textColor="#555"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/ToggleButton01"
android:layout_alignBottom="@+id/ToggleButton01"
android:layout_alignLeft="@+id/textView2"
android:text="Light 2 :"
android:textColor="#555"
56
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/TextView01"
android:layout_alignTop="@+id/ToggleButton02"
android:text="Light 3 :"
android:textColor="#555"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/TextView03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/TextView02"
android:layout_alignTop="@+id/ToggleButton03"
android:text="Air Cond :"
android:textColor="#555"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/TextView04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/ToggleButton04"
android:layout_alignBottom="@+id/ToggleButton04"
android:layout_alignLeft="@+id/TextView03"
android:text="Door Lock:"
android:textColor="#555"
android:textAppearance="?android:attr/textAppearanceLarge" />
57
<ToggleButton
android:id="@+id/toggleButton1"
android:layout_width="160sp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="37dp"
android:layout_toRightOf="@+id/TextView04"
/>
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/ToggleButton04"
android:layout_alignRight="@+id/ToggleButton04"
android:layout_below="@+id/ToggleButton04"
android:layout_marginTop="14dp"
android:ems="10"
android:inputType="textPersonName"
android:hint="Bluetooth Name" >
<requestFocus />
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/editText1"
android:layout_alignRight="@+id/TextView02"
android:text="OK" />
<TextView
58
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/editText1"
android:text="DIYhacking.com"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#555" />
</RelativeLayout>
</LinearLayout>
About XML code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/back">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="18dp"
android:text="DIYhacking.com"
android:textColor="#555"
59
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/textView1"
android:layout_marginTop="31dp"
android:textColor="#555"
android:text="This DIY android application is created by Arvind Sanjeev.
Using this app you would be able to control all the devices you have hooked up to
your bluetooth controller, lamps, air conditioning, door locks, etc.Having a range of
control of about 100m. Happy hacking!"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</LinearLayout>
60