Design and Implementation of a Contactless Smart House Network System

ABSTRACT


INTRODUCTION
Smart house systems are an extension type of building automation. Smart house primarily decreases the efforts of human and improve the connection to the house with enhanced service, facility, and security. A smart house is now widespread as the concept of Internet of Things (IoT) technology has attached to it. With the aid of IoT technology, Smart house controls the house devices such as control of air conditioning, lighting, heating, opening and closing door and monitoring other household appliances. Any electric device of house connects with each other in smart house system network. These devices are associated with this system to give control from any PC, laptop, smartphone or tablet that has an Internet access. Through the exchange of information technologies, the house devices can run in more intelligent with the support of IoT technology which results in more convenience, power efficiency, safety and facility [1]. Smart house system is the way of managing smart devices, that which understanding the events of real actions and convert that to a stream of data to produce more safety, ease, security and also energy and cost saving which is very beneficial in today's environment [2].
The examination survey of the smart house system and how to use its, depend on the requirements in the nations. The number of using smart house systems reach to 6.6 million and expected to develop intensely and reach to 44.9 million in 2020 [3] as shown in Figure 1. There are a lot of related works in the field of smart houses, this type of system is developed rapidly with the development of technology. Most of the researchers aim to obtain many features to control and access house appliances in flexible and easy Figure 1. The number of using smart house systems [3] Bharanialankar and ManikandaBabu (2014) proposed a system to control the device in the form of SMS by using GSM network provided with an AVR PIC microcontroller [5]. The user enters commands which send via SMS to GSM module that is connected to the AVR. It receives the commands and uses it to communicate with the modem and control the appliances. However, the disadvantage of this system is the cost of GSM network.
Jivani (2014) presented the system module to monitor the home appliances based on GSM technology via SMS services [6]. The Adriano board microcontroller is used o interface the devices through GSM modem. It uses the "App Inventor" visual programming platform to create an Android application to user interface design. The user sends commands via SMS messages from the android application to control the appliances remotely. The disadvantages of this system are the reliability and cost of SMS and the impossibility to update the user interface according to the requirement. Rao and Uma (2015) presented home automation using a smartphone and Raspberry Pi [7]. It is designed to help the user and elderly people to control home devices through their own smartphone and make their life more independent. They can control any appliances connected to Raspberry Pi. It focuses on control the door sensor, light switch, and webcam surveillance. Azni et al. (2016) presented a wireless home automation system using Wi-Fi [8]. The end user can control and monitor the home devices by using a web server or android application. It uses Restful Application Programming Interface (API) framework and other functions to use Hypertext Transfer Protocol (HTTP) request to control the General-purpose input/output (GPIO) of Raspberry PI. This system used to turn on/off the electrical appliances of home wirelessly through a Wi-Fi connection. Jabbar et al. (2016) proposed a smart home system focuses on the utilization of the IBoard Adriano microcontroller and the XBee with the interface through Android smartphone application [9]. The IBoard is a different Adriano board which have many features like Ethernet port, XBee socket interface, Micro SD socket and an ATMEGA32. Moreover, it works as web server connects the system to the network through Ethernet by the router and it allows a user to control the house appliances through an Android application. Android platform access by IP address and it consists of on/off button for switches and status declaration in addition to the automatic button for electronic work. Yi et al. (2016) proposed a system of controlling the house using ZigBee [10]. It used LM3S8962 32-bit processor as a master controller of the system and to transmit and receive data over TCP/IP protocol through gateway interface. The ZigBee coordinator connected to the master controller and ZigBee routers connected to the home devices and used the STC89C52 processor as the main processor in the terminal home node. Sayuti et al. (2017) presented a smart home and an ambient assisted living (SHAAL) system based on the internet of things [11]. This system consists of two parts: the network part and the application part. The network part used ZigBee technology and different types of sensors to develop this system. The server of this network operated on the third generation (3G) to connect to the gateway and cloud network. The performance delay of this system is less than other systems however the cost of implemented and tested was more than other systems.
Gunawan et al. (2017) proposed a prototype of a smart home control system (SHCS) [12]. This system used four type of sensors to integrated with the home environment. It allowed the users to switch on and off any home devices remotely through the internet of things. It used Arduino Mega, Ethernet shield, and APC220 wireless in the actual design of hardware. The home devices are integrated successfully with control system through relay boards. The overall performance of this system was developed as a prototype.
Gunawan et al. (2018) presented an enhance performance of a smart home system and evaluated the performance of the previous systems [13]. The presented system also used internet of things technology and different type of sensors to integrated with the home environment. A solar charger added to this system which increases the whole performance including hardware and software. The results of this system are tested in a real environment and improve the performance compared with the previous systems.
Therefore, there are many challenges that face the smart house networking system, including the high cost of implementation and upgrading, high power consumption, and supported limited features such as the limitation of access only single room and fixed the configuration of a system. Some of the current system as explained in the previous section using license bands like GSM and others using Wi-Fi or Bluetooth, all of its required high-power consumption, limited in the range of transmitting, static configuration and upgrading, and required a separated web server for gateway node and data storage. This paper presents a wireless house network system based on IoT technology and combined the gateway node and web server in single Raspberry Pi unit. This system is used ZigBee communication to transmit and receive data between each node in-house and main station and real time communication to connect between the remote user and main station.

PROPOSED SYSTEM ARCHITECTURE
The architecture design of the smart house network system (SHNS) is adopted ZigBee technology to connect the devices of house, the ZigBee wireless technology protocol is chosen because it is low power M2M wireless network, unlicensed, low cost and can communicate in a different type of topology including mesh topology [14]. It consists of two main parts: the low cost, small size Raspberry Pi microprocessor is used as the main station part and combined the gateway node, database server and webserver on it instead of using any type of PC server.
The second part is the wireless house nodes which consist of three different nodes, Room1 and Room2 nodes are used to monitor and control the environment, the healthcare node is used to monitor the body temperature of the patient remotely. Room1 and Room2 nodes consist of Arduino, Arduino XBee Shield, XBee module and number of sensors. Healthcare node consists of XBee module and temperature sensor which are wearable by the patient to measure the heating dynamically from any location. The local and remote user can access this system using any web browser. The remote user can access the system by assigning a public IP address to the Raspberry Pi. Figure 2 shows the architectural design of the SHNS.
ZigBee standard defines three different types of devices: Coordinator device, Router device and End device. Coordinator device has the capability to act the controlling of personal area network and establish the connection of network. Router device has the capability to transmit and receive messages, and route these messages if necessary to extend the coverage area. Finally, End device has fewest features and can connect either to Coordinator device or to Router device. Each ZigBee network must have only one Coordinator device and unlimited number Router devices and End devices [15]. There are different types of XBee module and in SHNS XBee Pro S2 Module is used and it operates in two types of operation: transparent operation mode (AT operation mode) and application programming interface operation mode (API operation mode). AT mode is the default operation mode in XBee module and it considers a serial line replacement between the modules, all incoming UART data from DI pin is waited for RF immediately sending [16]. API mode is the advantage mode and a frame based mode. When XBee module running this mode all incoming and outcoming data are comprised of frames. These frames provided the address, payload data, AT command and other fields of configuration. This mode has the ability of multicast and broadcast transmission and can receive status frame about each sending frame also it contained a checksum for integration data [16].

HARDWARE AND SOFTWARE DESIGN OF SHNS 3.1. Design of Wireless House Nodes
The wireless house nodes are chosen as a prototype of necessary required sensor and actuator nodes in each house. The Room1 and Room2 nodes are used to environment monitoring of temperature, humidity, gas and smoke detection, and remote control of any appliances in these rooms through Internet using a number of sensors and relays. Health care node is a special dynamic health care node which holds to the  [20]. Arduino XBee shield is an add-on board used to enable Arduino board to connect wirelessly to another board using XBee module. It is connected vertically on the top of Arduino and then XBee connects on the top of it [21]. DHT22 humidity and temperature sensor [22] and MQ-2 gas and smoke detection sensor [23] are the sensors that used in Room1 and Room2 nodes also an electrical switch relay [24] used in these nodes. The Healthcare node consist of only XBee Pro Series2 and LM35 temperature sensor [25]. The selection of these components faciltate the proof of concepts of adopting Zigbee technology and other components could be added without the loss of generality.

Design of Main Station
One of the hardware component that can be used as a server in IoT technology is Raspberry Pi. Which is a small size board computer, low cost, flexible, has an Extended GPIO port and can use for different purposes [26]. It considers the main station of the SHNS and included the gateway node, database server, webserver and user interfaces as shown in Figure 3. The XBee module that connected to Raspberry Pi is configured as coordinator and operated in API mode. The gateway node considers the communication layer between house nodes and main station. It has the ability of writing to and reading from the database and it is responsible to select the mode of operation and determined the house nodes that will be used to send and receive data between XBee modules in the dynamic configuration. The gateway node programmed using Python programming language with number of packages including MySQL-python package, XBee 2.1.0 package and PySerial 2.7 package. MySQL database is used to store the configuration table, control table and data tables of system. Apache web server with PHP programming language is used at the server side of SHNS. The End user can access the system interfaces through any PC or tablet or any device that has an Internet access.

Design of User Interface
The aim of designing the SHNS is to enable accessing from local and remote end user to house network and can select the required configuration to monitor its environments and control the appliances. So, four main web pages are designed that can verify the required purposes. The Setting page is constructed to manage the configuration of selecting the operation of house nodes. The Display page is constructed to display a real-time chart of selected house node. Chart of monitoring patient temperature in healthcare node and the humidity and temperature in Room1, Room1 nodes, all of information can be displayed from this page. The Data analysis page is constructed to access all the saved data in determined duration or in all time. Moreover, this page gives the ability to delete data when reaching special count. The Controlling page is constructed to control the state of each device connected to each house node. The designing of the user interface is done using HTML, CSS, PHP, and JavaScript for charting the data.

RESULTS AND ANALYSIS
The software implementation of Room1 and Room2 nodes is programmed using an open source Arduino IDE software. The software implementation of this node is responsible for many processes of receive data from XBee module through serial port and analysis it, collect data from DHT22 using its library and MQ-2 sensors, and then transmit these data to XBee module through serial port which transmits this data through ZigBee to XBee coordinator connected to the main station.
The last wireless house node is the healthcare node which has a dynamic moving capability for the patient. The implementation of this node is done through setting the first I/O pin of XBee module to ADC=1. This enables the connection of an LM35 temperature sensor to this pin, the real-time temperature of patient body sends periodically every 15 minutes and then XBee go to sleep mode. This cycle of sleeping 15 minutes and waking 5 minutes increasing the battery life for years. The reading and processing of the sampling data are done in the receiving process in the main station using Python programming language.
According to the last studies using modern methods, the normal temperature of human body is 37.0degree C. This standard has a wide range of consideration and differs from person to person, the age of the person, type of measurement, the activity level of the person and in different time of day. Therefore, the range from 36.1-degree C to 37.3-degree C consider the accepted range and perfectly normal.
In general, and depending on the experiences, the average normal reading of body temperature is different according to the type of measurement, an armpit temperature is 0.7-degree C to 1.2-degree C higher than hand temperature and 0.3-degree C to 0.6-degree C lower than an oral temperature.
According to the experimented results that are obtained, the reading of this node must be calibrated by adding an offset value to obtain an approximately equal result to the standard medical value of temperature reading. Table 2 and Table 3 shows the reading of body temperature without calibration and with calibration and compare with the standard reading.  Where: Experimental value is the reading result from healthcare node. Standard value is the reading from the thermometer Medical. The hardware implementations of Room1 node and healthcare node are shown in Figure 4. The hardware implementation of the main station is shown in Figure 5 which consist of Raspberry Pi and XBee module as coordinator that are connected to Raspberry Pi through XBee adapter. Raspberry Pi is connected to the Internet through Ethernet port or wirelessly through Wi-Fi.
The software implementation of the main station node is done using many programming languages. The processes and algorithms of transmitting and receive frames are implemented using Python programming language. Python is an object-oriented, open source, portable and consider a high-level language with ritch libraries. The collecting data from these operations is saved in MySQL database. MySQL is free, high performance, and have many other features. To access the data, there is a need for a server side and scripting languages. The Apache web server and PHP scripting language are used to access and modify the collected data.
The designing of the user interface is done using HTML, CSS, PHP, and JavaScript for charting the data. Figure 6 shows the chart of the patient body temperature measured from the healthcare node. An authorized user can access the SHNS to control and monitoring the environment of the house and select the required configuration from any web browser. Figure 7 shows the real-time chart of selected house node.

CONCLUSION
A prototype of the SHNS is designed and implemented successfully. The SHNS users can select the required operation of house nodes through dynamic user configuration. The overall system is portable, low cost and low power consumption, because using of small size Raspberry Pi as a web server and gateway node eliminated the needed of separated PC server and minimize the cost significantly. The SHNS supported healthcare part to any patient in-house through easy manner and contactless method and that is considered an application of IoT technology. In addition, the data storage and analytic is done locally (i.e., provides fog computing without the need of cloud platform). There are many suggestions can be done in future including extend the work to support smart cities and smart building to connected all the required things to Internet and verify the concept of IoT in the constructed application. In doing so, the big data analytic will be a major concern; however, fog computing could assist in minimizing the traffic from/to cloud environment.