0% found this document useful (0 votes)
293 views71 pages

Design and Implementation of A Remote Control System of Doors and Lights Using An Android Phone

Uploaded by

Vedant Gaikwad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
293 views71 pages

Design and Implementation of A Remote Control System of Doors and Lights Using An Android Phone

Uploaded by

Vedant Gaikwad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

DESIGN AND IMPLEMENTATION OF A REMOTE CONTROL SYSTEM OF

DOORS AND LIGHTS USING AN ANDROID PHONE.


Final year project report submitted to
Kampala International University in partial fulfillment
of the requirement for the award of the degree

of

Bachelor of Science in Computer Engineering

by
KIMBUGWE JAMES
BCI/40240/131/DU

And
BOWGO JOHN KUR DENG
BCI/34648/122/DF

DEPARTMENT OF ELECTRICAL, COMPUTER AND


TELECOMMUNICATION ENGINEERING
SCHOOL OF ENGINEERING AND APPLIED SCIENCES
NOVEMBER 2016.
© 2016, James and John. All rights reserved

1
DECLARATION

This is to certify that the report entitled “DESIGN AND IMPLEMENTATION OF


REMOTE CONTROL SYSTEM OF DOORS AND LIGHTS USING AN ANDROID
PHONE IN OFFICES” is our original and the results embodied in this report has
not been submitted to any other university or institute for the award of any degree
or diploma.

Signature………………………………………………. Date …………………………………………


KIMBUGWE JAMES

Signature……………………………………………….Date…………………………………………..
BOWGO JOHN KUR

i
APPROVAL

The project report entitled, “DESIGN AND IMPLEMENTATION OF A REMOTE


CONTROL SYSTEM OF DOORS AND LIGHTS USING AN ANDROID PHONE” is hereby
approved by Kampala international university, Department of Electrical and
Telecommunication Engineering as a creditable study of research topic and has been
presented in a satisfactory manner to warrant its acceptance as prerequisite to the
degree for which it was submitted.

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

CHAPTER ONE: INTRODUCTION. .......................................................................... 1


1.1 BACKGROUND. .............................................................................................. 2
1. 2 PROBLEM STATEMENT. ................................................................................. 2
1.3 Objective of the project. ................................................................................. 3
1.3.1 Main Objectives. .......................................................................................... 3
1.3.2 Specific objective ......................................................................................... 3
1.4 SCOPE. ......................................................................................................... 3
1.4.1 Physical scope. ............................................................................................ 3
1.4.2 Technical scope. ......................................................................................... 3
1.5 Significance of the Project. ............................................................................. 4

CHAPTER TWO: LITERATURE REVIEW. ................................................................. 5


2.1 Internet Based Monitoring. ............................................................................. 5
2.2 Remote Monitoring using Wireless Sensor Networks (WSN), Bluetooth, WiFi,
Zigbee technologies: ............................................................................................ 8
2.3 The major strengths and weaknesses drawn from the conclusions laid by various
researchers are as under: ................................................................................... 12
2.3.1 Major strengths:........................................................................................ 12
2.3.2 Major Weaknesses: ................................................................................... 13

CHAPTER THREE: METHODOLOGY. .................................................................... 14


3.1 Development Model. ..................................................................................... 14

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

CHAPTER FOUR: TESTING AND RESULTS............................................................ 27


4.1 Introduction ................................................................................................. 27
4.1.1 System Study ............................................................................................ 27
4.1.2 Existing System ......................................................................................... 27
4.1.3 Functional Requirements ........................................................................... 27

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

CHAPTER FIE: CONCLUSIONS AND RECOMMENDATIONS .................................... 32


5.1 Introduction ................................................................................................. 32
5.2 Challenges encountered. ............................................................................... 32
5.3 Future Recommendations .............................................................................. 32
5.4 Conclusion .................................................................................................... 33

APPENDIX I: GHANT CHAT ................................................................................. 34


APPENDIX II: BUDGET ....................................................................................... 35

References: ....................................................................................................... 36

viii
LIST OF FIGURES AND TABLES

Figure 3.0 shows the agile development process model……………………………………..15


Figure 3.1 shows the block diagram of the proposed system………………………………16
Figure 3.2 circuit diagram of the system……………………………………………………………17
Figure 3.3 shows Arduino Uno………………………………………………………………………….19
1

Figure 3.4 shows a Bluetooth module……………………………………………………………….20


Figure 3.5 shows a servo motor……………………………………………………………………….22
Figure 3.6 shows a relay switch……………………………………………………………………….22
Figure 3.7 shows some of the capacitors…………………………………………………………..23
Figure 3.8 shows a Vero board used in the project…………………………………………….24
Figure 3.9 shows different jumper wires used……………………………………………………24

Table 1 shows the Bluetooth strength ................................................................. 31

ix
LIST OF ACRONYMS AND ABBREVIATIONS

ABI Association of British Insurance


FTP File Transfer Protocol
GPRS General Packet Radio Service
GSM Global System for Mobile Communication
HAVI Home Audio Video Interoperability
HAVI Home Audio Video Interoperability
HTML Hyper Text Mark Up Language
Http Hypertext Transfer Protocol
IDE Integrated Development Environment
IE Internet Explorer
IEEE Institute of Electrical and Electronic Engineering
JDK Java Development Kit
OS Operating System
PDA Personal Digital Assistant
PDA Personal Digital Assistant
PHP Hypertext Preprocessor
RAM Random Access Memory
RF Radio Frequency
SDK Software Development Kit
SPI Serial Peripheral Interface
SRAM Static Random Access Memory
TCP/IP Transmission Control Protocol/Internet Protocol
TM Transmitting Module
UART Universal Asynchronous Receiver Transmitter
WAP Wireless Application Protocol
WPAN Wireless Personal Area Network.
WSN Wireless Sensor Network
μc Microcontroller

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

The system that is going to be developed is “DESIGN AND IMPLEMENTATION OF


REMOTE CONTROL OF DOORS AND LIGHTS USING AN ANDROID PHONE”, which is
a smart technology that will be used in companies and homes to control doors and
lights over a local network. According to the Smart Homes Association the best
definition of smart home technology is: the combination of technology and services
through home networking for a better value of living. This technology can be used to
monitor, alert and execute, according to the desired functions. The technology will
make automatic connection with environment via Bluetooth. Smart companies and
homes actually have the ability to make life easier and more proper. Home
networking can also offer peace of mind. Whether you're at job or on holiday, the
system will alert you to what's going on and make sure security is implemented The
use of Bluetooth technology in a smart phone today is not just for the transfer of
data and files only. In recent years, automation is one of the applications of
Bluetooth technology. Bluetooth technology operate over unlicensed, its available at
2.4GHz frequency, it can also link digital devices within a range of 10m to 100m at
the speed of up to 3Mbps but it depending on the Bluetooth device class With these
qualifications of Bluetooth; we offer a door automation system based on Bluetooth
technology, especially in door automation system.

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.

1.4.2 Technical scope.


Hardware such as computer with 2 GB RAM 500GB hard disk and with battery that
does not go off immediately when power goes off., flash disks.
An android smart phone is also required, bulbs, servo motors, voltage regulators,
transistors, resistors, jumpers, Vero board, solder wire
The following applications/programs were used;
a. Workbench for drawing EER diagrams
b. Android sdk, this kit will allow us to develop the code for the Android mobile
device. Although the code could be written manually, the Eclipse IDE and plug-in
allow a much more refined and improved development experience including a full
graphical interface editor and a wide range of debugging tools.
c. Arduino IDE. In order to test the Arduino code (as well as write most of the code
for the Arduino), the Arduino official software will be installed. This allows us to
build, compile and run the Arduino code from the computer to the boards
themselves.

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.

2.1 Internet Based Monitoring.


Internet monitoring is one of the common approaches for remote monitoring. Many
researchers have worked in field of Internet based remote monitoring.

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.

In the research based on internet monitoring by (Yen-Shin Lai et al., 2002),they


developed an Internet-based monitoring and control of fuzzy controlled inverter for
air conditioning system. The system consists of client/server, programmable logic
controller, D/A modules, inverters, induction motors and the temperature sensing
modules. The client accepts the command from the user and can also access the
database created in server, using Internet Explorer (IE) Browser. The server
performs function of fuzzy logic control, communication interface between server
and PLC, and receiving command from client. Furthermore, the server also creates a
database of the sensed temperature, speed of inverter-controlled motor drives, and
reference command.

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.

A system based on wireless monitoring developed by (Liu Zhong-xuan et al., 2010),


they designed a wireless remote monitoring system based on the GPRS (General
Packet Radio Service) and the MCU (Micro programmed Control Unit). System is
based on 89C58 microcontroller and PIML GPRS-MODEM as the core, can collect
data from eight sensors, control two-way Data Acquisition, in the local real-time
display and support remote Internet monitoring. The data from sensors are
encoded, sent to the WEB server (fixed IP address or fixed domain name website)
through the GPRS channel. The system also accepts commands from remote
monitoring centre.

2.2 Remote Monitoring using Wireless Sensor Networks (WSN),


Bluetooth, WiFi, Zigbee technologies:
Many Wireless Technologies like RF, Wi-Fi, Bluetooth and Zigbee have been
developed remote monitoring systems using these technologies are popular due to

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.

According to (Wijetunge et al., 2008),these designed a general purpose controlling


module designed with the capability of controlling and sensing up to five devices
simultaneously. The communication between the controlling module and the remote
server is done using Bluetooth technology. The server can communicate with many
such modules simultaneously. The controller is based on ATMega64 microcontroller
and Bluetooth communication TDK Blu2i (Class 1) module which provides a serial
interface for data communication. The designed controller was deployed in a home
automation application for a selected set of electrical appliances.

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.

According to Sung-Nien Yu and Jen-Chieh Cheng, 2005 proposed a wireless patient


monitoring system which integrates Bluetooth and WiFi wireless technologies. The
system consists of the mobile unit, which is set up on the patient’s side to acquire
the patient’s physiological signals, and the monitor units, which enable the medical
personnel to monitor the patient’s status remotely. The mobile unit is based on
AT89C51 microprocessor. The digitized vital-sign signals are transmitted to the local
monitor unit using a Bluetooth dongle. Four kinds of monitor units, namely, local
monitor unit, a control centre, mobile devices (personal digital assistant; PDA), and a
web page were designed to communicate via the WiFi wireless technology

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).

Automatic irrigation project system developed by (Yunseop Kim et al., 2008),these


described details of the design and instrumentation of variable rate irrigation, a
wireless sensor network, and software for real-time in-field sensing and control of a
site-specific precision linear-move irrigation system. Field conditions were site-
specifically monitored by six in-field sensor stations distributed across the field based
on a soil property map, and periodically sampled and wirelessly transmitted to a
base station. An irrigation machine was converted to be electronically controlled by a
programming logic controller (Siemens S7-226 with three relay expansion modules
activated electric over air solenoids to control 30 banks of sprinklers) that updates
geo-referenced location of sprinklers from a differential Global Positioning System
(GPS) (17HVS, Garmin) and wirelessly communicates with a computer at the base
station. Communication signals from the sensor network and irrigation controller to
the base station were successfully interfaced using low-cost Bluetooth wireless radio
communication through Bluetooth RS-232 serial adaptor (SD202, Initium Company).

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.

Further research on wireless medical interface was conducted by (Mulyadi et al.,


2009) and implemented a wireless medical interface based on Zig Bee and Bluetooth
technology. The purpose was to acquire, process, and transfer raw data from
medical devices to Bluetooth network. The Bluetooth network can be connected to
PC or PDA for further processing. The interface comprises two types of device: MDIZ
and MDIZB. MDIZ acquires data from medical device, processes them using
microcontroller, and transmit the data through Zig Bee network through UART.
MDIZB receives data from several MDIZs and transmit them out to PC through
Bluetooth network. MDIZB comprises of Zig Bee module, two processors, RAM, and
Bluetooth module. It receives data from Zig Bee network through its Zig Bee
module. The data are then sent to processor 1. Processor 1 decides priority of
MDIZs. In processor 1, the data frame is added with Start byte and End byte to
mark the beginning and the end of data frame. After being processed in processor 1,
the data are then sent to processor 2 through SPI (Serial Peripheral Interface).
Processor 2 transmits data to PC through Bluetooth network. Processor 2 controls
Bluetooth module. It also received commands given by PC through Bluetooth
network. The interface was connected with four different medical devices through
UART and analog port at 42 kbps of data rate.

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.

2.3.2 Major Weaknesses:


1. Most of systems based on Internet monitoring require higher operational cost
based on bandwidth / data speed requirements and hence is justified only in
industrial or biomedical applications in developing countries. These systems
generally do not have alert facilities against occurrence of abnormal
conditions. User needs to have PC / smart phone / PDA with suitable
software support. Security vulnerability is the most striking alert point of
Internet. No malicious party should ever gain control of system. Web usage
requires resources like flawless Internet connections and hosting servers,
which may not always fit to the concept of remote controlling. It is difficult to
upgrade existing conventional control systems with remote control
capabilities.
2. The GSM modem used in cellular based remote monitoring system increases
the cost of the system.
3. The long term operational cost of Internet and cellular monitoring systems is
relatively high due to usage charges incurred in each message transaction.

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.

3.1 Development Model.


The most substantial part of this project was the software to control the entire
system. This software takes on many different roles, including:
Controlling devices directly in the building environment.
A master unit to control these devices.
A web server to provide control between the mobile device and the master unit.
Mobile software to supply most of the features of the project.
In this project we used the agile model development process

3.1.1 Agile (Iterative Development) Model:


The iterative model is almost an entirely different model, designed for quick
prototyping and development. It takes some features of other models but
incorporates these into a much more flexible model. In this model, at each stage the
system gets to a releasable “state. This means that at each major or minor
milestone, you have a working system (albeit with less features than the required
software needs). This allows many prototypes to be built, evaluated, and if needed
the requirements can change based on feedback from these prototypes. This suits
our project particularly well. Considering that this project is mainly a research based
project to determine the effectiveness of the system, this is an incredibly Effective
development model.

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.

Figure 3.0 shows the agile development process model


3.2 Methods used to collect information.
a) Observation.
We aimed at getting firsthand information through physically observing the current
methods used to close doors and switch on lights plus their effects.

3.3 SYSTEM DESIGN.


The design procedures and working principles of the whole system is organized into
different units which include: control units remote control, door control unit and
Bluetooth android application.

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).

3.3.1 Block diagram of the system

Door 2 Door 1
Mobile
application

Servo motor

Arduino Uno
Bluetooth
module
Light 1

Light 2

Figure 3.1 shows the block diagram of the proposed system

16
3.3.2 Circuit diagram of the system

Figure 3.2 circuit diagram of the system

3.4 Door and light Control Unit


The general function of the unit is to send to the remote control whenever the doors
are open or closed and whenever the lights are on/off respectively. This unit is built
using Arduino, servo motors and a bread board contains resistors, jumper wires,
transistors and voltage regulators.

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.

3.4.2 Android Application.


Android operating system is open source focused around Linux kernel with Java
programming interface planned fundamentally for touch screen contraptions. Gadget
producers, remote transporters and fan engineers are permitted to adjust and
distribute the product under the Apache License.
This software was developed with the use of Eclipse Integrated Development Kit
Environment, Java Development Kit, Android SDK, and android development tools
(ADT) Plugin.

3.4.3 Hardware Requirement


The process began by soldering the relay switches, transistors, connectors and the
transformer with its rectifier circuit onto the Vero board. The Arduino board is
interfaced to the transistors that are soldered on the PCB through jumper wires. The
transistors are connected to relay modules that act as switches to the appliances
connected through the connectors.

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.

Figure 3.3 shows Arduino Uno


2.2

3.4.3.2 Bluetooth Technology


Bluetooth is a standard utilized as a part of connections of radio of short extension,
bound to substitute connections which use wires between electronic gadgets like
personal digital assistants (PDA), cell phones, personal computers (PC), Laptops, and
numerous different gadgets. Bluetooth technology can be utilized at homes, offices,
schools, hospitals and in cars. Users can get instantaneous connections with several
kinds of devices through this technology continuously.

The method for transmission utilized guarantees security against external


interference and Well-being in sending out data. Between the essential qualities,
these must be mentioned; the strength, low cost, small consumption of energy, low
complexity and the ease of use. The Bluetooth is a little microchip that works in a

19
band of accessible recurrence all through the world. Correspondences can
acknowledge point to point and point to multipoint.

How Bluetooth works


Each gadget must have a microchip installed in it that receive and transmits the
frequency of 2.4 GHz that is accessible throughout the whole world (with a few
varieties of transmission Bandwidth in diverse nations). Other than the data, three
channels of voice are accessible. The data can be traded to speeds of up to 1
megabit per second (2 megabits for second in the Second Generation of this
Technology). A plan of "frequency hop" (hops of frequencies) permits to the gadgets
to get connected comprehensive in territories where an incredible electromagnetic
interference exists. Other than that is given plans of encryption and check.

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.

Figure 3.4 shows a Bluetooth module

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

3.5 Voltage Regulator


A voltage regulator is an electrical regulator designed to automatically maintain a
constant voltage level.
A 5V voltage regulator (7805) is used to ensure that no more than 5V is delivered to
the circuit board .The regulator functions by using a diode to clamp the output
voltage at 5V AC regardless of the input voltage - excess voltage is converted to
heat and dissipated through the body of the regulator. If an AC supply of greater
than 12V is used, excessive heat is be generated, and the board may be damaged.

3.5.1 Servo Motors.


A servomotor is a rotary actuator or linear actuator that allows for precise control of
angular or linear position, velocity and acceleration. It consists of a suitable motor
coupled to a sensor for position feedback. It also requires a relatively sophisticated
controller, often a dedicated module designed specifically for use with servomotors.
A servomotor is a closed-loop servomechanism that uses position feedback to control
its motion and final position. The input to its control is some signal, either analogue
or digital, representing the position commanded for the output shaft.

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.2 Relay Module


A relay is a device that operates on electricity. It has a control and controlled
systems. It is mostly used to control circuit automatically. Basically, it is an
automatic switch to control using a low-current signal.

Figure 3.6 shows a relay switch.


3

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.

3.5.5 Wire connectors


These are wires used to connect lamp holders to the PCB, they are also used to
provide A/C power the transformer so that the circuit which is soldered on the PCB
can be powered.

3.5.6 Vero board


The vero board (also called DOT PCB) used in this project is an HS-07 standard PCB.
It is a thin, rigid sheet with holes pre-drilled at standard intervals across a grid of

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.

Figure 3.8 shows a Vero board used in the project

3.5.7 Jump wires


These are used to interface the Arduino Uno with the HC-05 bluetooth module and
the transistors. They help the bluetooth module to send commands from the android
phone to the microcontroller which is programmed to turn on and off the transistors
that are used to control the relay switches and the doors plus lights connected.

Figure 3.9 shows different jumper wires used

3.6 Design and Implementation


The design and implementation phases were organized separately and different
technologies were applied on each phase

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.

3.6.2 Android Phone and Android App


In this Project an android phone (Techno w4) was used as the remote control for
the user alongside with an App Called light and door application. Light and door
application is a simple Android app that made controlling the pins of Arduino-Uno
from an Android phone wirelessly possible. Bluetooth Serial Controller employs a
simple Android user interface to control Arduino Uno's digital and PWM pins, 27 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 was programmed to only support that feature.

3.6.2.1 Programming the Arduino-Uno


In this project, the Arduino Uno is programmed with the Arduino Software IDE.
Select "Arduino Uno from the Tools > Board menu (according to the microcontroller
on your board).
The ATmega328 on the Arduino Uno comes preprogramed with a boot loader that
allows you to upload new code to it without the use of an external hardware
programmer. It communicates using the original STK500 protocol.

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.

4.1.1 System Study


The system study involved looking at the structure of the systems that is currently in
use, identifying the problems with the existing systems. The major step involved in
this section included studying the present systems to verify the problem. The
information gathered from various prospective system users was analysed and
evaluated and the findings reviewed in order to establish specific system objectives
and user requirements as stated in our objectives.

4.1.2 Existing System


In Uganda today, there are many methods of switching on lights and closing doors,
these include; switching on and off lights directly from the wall switch, closing doors
and opening doors using keys and padlocks, opening automatically using internet
based connections and employing security guards to maintain security around offices
and rooms.
These systems being used are costly, time consuming and have weak security.

4.1.3 Functional Requirements


The functional requirements describe the functionality or services the system is
expected to provide, how the system reacts to particular inputs and how the system
should behave in particular situations. These requirements include;
 The system captures and stores user information before one can use the system
for example password.
 The system generates error messages for example in case of wrong password
inputs and usernames.

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.

4.1.4 Non-functional Requirements


This includes constraints that must be adhered to during the system development
for example operational costs, performance, reliability and others;
 The system allows access only to authorized users through creation of user
accounts and passwords.
 The system requires no Internet connection.
 The system allows only authorized users to make changes in their respective
accounts.
 The system also provides access to one user at a time i.e. only the phone holder
uses the application installed on his phone.
 The system supports users with varying levels of experience.

4.2 System Architecture


The system architecture defines the structure, behaviour and other views of the
system. The system architecture in particular, provides an overview of the entire
system, identifying all its elements at some level of abstraction. It provides definition
of the users' vision for what the system requires and strives to maintain the integrity
of that vision as it evolves during detailed design.

4.3 System Testing


The testing of the system took place in many stages, however there were two major
phases. The first phase was \in-development" testing which took place throughout
the development stage. At each minor and major version, we tested the newly
implemented features to ensure that they worked according to our specifications.
This testing method correctly identified most of the errors and bugs which existed in
our project, and so we could rectify these quickly before they had the possibility of
escalating.

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.4 Results of Testing


The application functionality was tested from a number of phones.
Component testing: In this case, tests were carried out on different units that make
up the system. The main units were tested independently, these units included the
lighting unit, and the door unit.
The Login, and password changes were changed periodically to test the independent
components and this was a success.
In the Login, tests involving whether users had right credentials for example
passwords for the system
The persons credential would be entered and saved perfectly and the user would be
prompted to login to ensure that it the rightful owner of the account.
System testing: In this case, tests were carried out on the entire system done after
all the components were integrated. This was to ensure that all units function
effectively as a single system.

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.

Reading area Distance/m Connected /disconnected /


Intermittent

First Indoor (obstacle) 5 Connected

10 Connected

15 Intermittent

20 Disconnected

25 Disconnected
30 Disconnected

Second Outdoor (non- 5 Connected


obstacle)
10 Connected

15 Connected

20 Intermittent

30
25 Intermittent

30 Disconnected

5 Connected

Third Indoor (non-


obstacle) 10 Connected

15 Connected

20 Intermittent

25 Intermittent

30 Disconnected

Table 4.1 shows the Bluetooth strength

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

5.2 Challenges encountered.


 The financial resources required to support the development of the system
during the project development process were not sufficient enough to have a
smooth development life cycle.
 It was hard integrating the Bluetooth connection with varying versions of android
platform on different devices for the application.

5.3 Future Recommendations


 Try to find a way to amplify the Bluetooth module signal to work in greater
distance.

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

ACTIVITY JULY AUGUST SEPTEMBER OCTOBER NOVEMBER


Research Topic
Requirement Analysis
Requirement Gathering
Writing Proposal
Proposal Presentation
System Design
System Testing
System Implementation
Report Presentation

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:

A.Göransson, D.C.Ruiz, "Android Open Accessory Programming with Arduino", John


Wiley & Sons, Inc., ISBN: 978-1-118-45476-3, 2013

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.

Al-Ali, A.R.and AL-Rousan,M. (2004) "Java-Based Home Automation System",IEEE


Transaction on Consumer Electronics
BluetoothConnectivity,http://developer.android.com/guide/topics/connectivity/blueto
oth.html

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);

else if (int(val)==50)//Turn Light1 OFF


digitalWrite(13,LOW);
if(int(val)==51)//Turn Light2 ON
digitalWrite(3,HIGH);
else if(int(val)==52)//Turn Light2 OFF
digitalWrite(3,LOW);

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);

else if(int(val)==56)//Turn AC OFF


digitalWrite(5,LOW);
if(int(val)==57)//Lock the DOOR //
digitalWrite(12,HIGH);
for(pos = 0; pos <= 180; pos += 1) // goes from 0 degrees to 180 degrees

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() {

public void onClick(View v) {


// TODO Auto-generated method stub
nameb = name.getText();
blname = nameb.toString();
try {
findBT();

44
stat = 1;
} catch (IOException e) {
stat = 0;
e.printStackTrace();
}
}
});

final ToggleButton light1 = (ToggleButton)


findViewById(R.id.toggleButton1);
light1.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {


// TODO Auto-generated method stub
if (light1.isChecked()) {
if (stat == 1){
try {
mmOutputStream.write('1');
}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",

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() {

public void onClick(View v) {


// TODO Auto-generated method stub
if (light3.isChecked()) {
if (stat == 1){
try {
mmOutputStream.write('5');
}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 {
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() {

public void onClick(View v) {


// TODO Auto-generated method stub
if (door.isChecked()) {
if (stat == 1){
try {
mmOutputStream.write('9');
}catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(menu.this,
"Connection not established with your home",

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

You might also like