A Digitalized Smart Mobile Home Automation and Security System via Bluetooth/Wi-Fi Using Android Platform

: Home automation involves introducing a degree of automatic control to certain electrical and electronic systems in a building such as lighting, temperature control etc. This work presents the design, specification, and prototype implementation of a composite home automation system using Bluetooth/Wi-Fi over android platform. The research work provides multiple yet simple design approaches for developing flexible and robust home automation system to cater for the deficiency in overall control of user appliances. It also tackles the problems with complex, multiple, incompatible standards and the resulting expenses in the existing systems. The proposed system features an Arduino Mega board with core AVR microcontroller (ATmega2560) interfaced to the ubiquitous ESP8266 Wi-Fi chip, Infrared transmitter and receiver mechanism, power relay interface as well as user contact LCD and Keypad. With the HTML5 based intuitive mobile and web applications, unlimited flexibility is induced in the system operations and management. Overall, the system extends the capabilities of home automation beyond the basic appliances switching and monitoring by giving broad control over the appliances’ functionalities in addition to switching their power.


Introduction
Home automation or Smart Homes can be described as introduction of technology within the home environment to provide convenience, comfort, security and energy efficiency to its occupants [1]. It involves introducing a degree of automatic control to certain electrical and electronic systems in a building, including lighting, temperature control, etc. [2]. Adding intelligence to home environment can provide increased quality of life for the elderly and disabled people who might otherwise require care givers or institutional care [3]. Today, Smart Phones are more than just Phones, they are now the main Human Interaction Devices and users thus want to control/accomplish most of their tasks from their Smart Phones rather than conventional ways. The many wireless protocols that come embedded on a Smart Phone has introduced a wireless lifestyle reliving people from the "wired" cable chaos [4].
Home automation not only reduces human efforts but also energy efficiency and time saving. Although home automation today is not a new thing but most advanced Home automation systems in existence today require a big and expensive change of infrastructure [5]. Authors in [6] observed that there are few issues involved when designing a home automation system. The system should be scalable so that new devices can easily be integrated into it. It should provide a user-friendly interface on the host side, so that the devices can be easily setup, monitored and controlled. The interface should also provide some diagnostic services so that if there is any problem with the system, it can be tracked down. More over the overall system should be fast enough to realize the true power of wireless technology. Also the system should be cost effective in order to justify its application in home automation. Home automation provides the following [3]: a. Increase your independence and give you greater control of your home environment. b. Make it easier to communicate with your family. c. Save you time and effort. d. Improve your personal safety. e. Reduce your heating and cooling costs. f. Increase your home's energy efficiency. g. Alert you audibly and visually to emergency situations. h. Allow you to monitor your home while you are away. Figure 1 below shows a typical block diagram of home automation system which comprises of the user phone connected to home devices through Arduino BT controller. However, this research work presents the design, specification, and prototype implementation of a composite home automation system using Bluetooth/Wi-Fi over an android platform. The design is based on a standalone embedded system board Android ADK (Accessory Development Kit) at Home. The work seeks to provide multiple yet simple design approaches for developing flexible and robust home automation system to cater for the deficiency in overall control of user appliances. Bluetooth/Wi-Fi based home automation project allows the control of electrical appliances using android smart mobile phone. The research demonstrates a simple Home automation system which contains a remote mobile host controller and several client modules (Home appliances). The client modules communicate with the host controller through a wireless device such as a Bluetooth enabled mobile phone using an Android based Smart phone. It also provides home security and emergency system to be activated.

Research Objectives
The aim of this research is to construct a complete home automation system which can control major electric components via Bluetooth/Wi-Fi using Android mobile phone. The objectives are: i. To design smart home automation system that will allow people to control home appliances from anywhere. ii. To design a system that will give instant alerts in critical situations.
iii. To set up a simple Prototype home automation mechanism.

Related Work
There has been a significant increase in home automation in recent years due to higher affordability and advancement in Smart phones and tablets which allows vast connectivity [3]. A telephone and PIC based remote control system where pin-check algorithm was also been introduced by [5]. Researchers in [6] design home automation and security system using Android ADK. The design is based on a standalone embedded system board Android ADK (Accessory Development Kit) at home. Authors in [7] present a design and prototype implementation of new home automation system that uses Wi-Fi technology as a network infrastructure connecting its parts. Their proposed system consists of two main components; the first part is the server (web server), which presents system core that manages, controls, and monitors user's home.
Also, Authors in [8] present a low cost, flexible and secure cell phone based home automation system. The design is based on a standalone Arduino BT board and the home appliances are connected to the input/ output ports of this board via relays. The communication between the cell phone and the Arduino BT board is wireless. Researchers in [9] also presented the architecture for home automation where the system was based on a dedicated network. This system only shows how to solve home automation problems at software level and no hardware aspects were considered. Also to remotely control home appliances such as oven, air conditioner and computer by telephones which offer easy usage has been investigated by [10].
It is worth mentioning the contributions of authors in [18] that designed a flexible and secure cell phone based device automation system. The design is based on a standalone Arduino BT (ATMega 238) board and the home appliances are connected to the input/ output ports of this board via relays. The system can be used by any person who can operate an android phone. The system is low cost and scalable that allows variety of devices to be controlled with minimum changes to its core.
Finally, the above reviewed systems have made significant contributions to the design and development of home automation systems. None of them combined the use of Bluetooth and Wi-Fi together. Also the existing works were mainly focused on switching and controlling home appliances or connected devices rather than remotely monitoring of home environment.

Research Methodology
This research focuses on developing a control board prototype and two Graphical User Interfaces (GUIs) on computer and smart phone. The main control board is constructed by a main controller device, Microcontroller. The microcontroller interacts with GUIs on computer and smart phone in order to control and monitor the function of target home appliances by using relay circuit. The microcontroller connects to sensor in order to monitor the temperature and humidity level at home. The main control board is designed so that it complies with the household electrical standards. The system features an Arduino Mega board with core AVR microcontroller (ATmega 2560) interfaced to the ubiquitous ESP8266 Wi-Fi chip, Infrared transmitter and receiver mechanism, power relay interface as well as user contact LCD and Keypad.
The GUI designed on computer is implemented with the HTML5 based intuitive mobile and web applications. The client modules communicate with the host controller through Bluetooth devices. As a central controller; we are using a standalone embedded module that communicates with an Android application, our user interface. Figures 2 and 3 below give the architectural details of composite home automation and block diagram of Home Automation System using Android respectively.

Hardware Design
This section mainly discusses the hardware construction of main control board. The key hardware components that make up the home automation system are the Smart Phone, the Microcontroller Board, the Bluetooth module connected to the Microcontroller board and relay boards that drive the electrical appliances. ADK stands for Accessory Development Kit. Android accessory is a physical accessory that can be attached to your Android device. The Arduino ADK [6] is a microcontroller board based on the ATmega2560. It has a USB host interface to connect with Android based phones, based on the MAX3421e IC. Figure 3 below shows Arduino ADK. The Microcontroller on the Arduino is programmed in C++ through the Arduino IDE available freely.  memory and the information can be retained even after restart. It is typically utilized for keeping the states of the appliances port after power off. Also, it is in where all the system configurations are saved. d. Web Server -This is a custom configuration interface server which is accessible via smart phone, tablet or PC's web browsers. Depending on the connection, this server listens on standard port 80 and on the URL bar of the web browser; either of the CPE IP can be entered. e. Websocket Server -This allows the CPE to be controlled within the local network. An android or a web application can communicate with this server through either of the CPE IP on port 600. f. Websocket Client -The CPE communicates with the cloud services platform through this client which runs on port 500. The CPE must be connected to an Internet gateway to be able to route packet to the server. The associated settings can be reviewed on the CPE configuration portal. g. NTP Client -The time and date functionalities are synchronized with any chosen Network Time Server (NTP) at a certain refresh rate. The NTP address, port and associated settings are accessible via the CPE configuration portal. h. OLED -The process flows and the states and transitions are displayed on the dedicated 0.9-inch OLED screen. There are adequate delays for user to capture the information. The menu displays the current time, the connection states and importantly the CPE IP addresses. i. LED -The operations of the CPE is coded in green LED flashes. The number of flashes represents a particular state/operation. It is mainly used in debugging the CPE and it is secondary to the display. j. USART -This is an advanced debugging tool and it involves the use of a USB-to-TTL/ USB-Serial converter. k. The hardware consists of the following as shown in the diagram.

Software Design
Software design section includes the main functions of the system designed in the PIC (Port Interface Card) microcontroller and the two GUIs (Window and Android application). The GUI designed on computer is implemented with the HTML5 based intuitive mobile and web applications, unlimited flexibility are induced in the system operations and management. The user interface is designed as simple and powerful as possible, and operates in a selforganized way. The application consists of main function like electronics appliances controlling, motion detection, light intensity. Smoke detection and Temperature sensing. When the application is started, users will be able to navigate to the main screen. The main screen has a list of all functions among which user can select any one function which he/she wants to control. Figures 6, 7

System Setup and Implementation
Upon the execution of the program, it first checks if Bluetooth is already enabled on the phone. If Bluetooth is enabled, the device and service discovery process will run. The software will check if there are already predefined devices stored in the phone memory. The program then checks to see if the selected device is within range. It will then verify if the device is a Bluetooth transceiver (Arduino BT board). Now if there are no devices stored in memory, the program will search for Bluetooth-enabled devices within the area. Once discovered, these devices will be displayed on the screen and also stored in memory. Once it is confirmed that the device is indeed a transceiver, the software will store the unique addresses of all the controller modules connected to it, in this case Arduino BT. The following steps will be used to implement the system:

Conclusion
The research work has introduced the design and implementation of a low cost android based home automation system. It gives basic idea of how to control various home appliances using Android phone. We have chosen Android platform so that most of the people can benefit because of its wide usage. User can interact with the android phone and send control signal to the Arduino which in turn will control other embedded devices. This will improve the security of home and also assist in conserving energy like if you left any home appliance switched on by mistake, then you can switch it off using the internet connectivity. We can also keep an eye on home through an internet connected to the user's mobile phone or PC or laptop. This system can be easily manufactured on a large scale for mass adoption owing to its simplicity and ease of design. Another advantage of is the fact that application software is based on Android, which today has the largest smart phone base, any Android based Smart phone with built in support for Bluetooth/Wi-Fi can be used to access and control the devices at home. When a Wi-Fi connection is not available, mobile cellular networks such as 3G or 4G can be used to access the system.