Implementation smart home using internet of things

Development in technology of information today provides various facilities to support human activity. One technology that facilitates human is the use of automated systems, the application of smart home system makes it easier for users to control household electronic devices. This study addresses one of the smart home solutions with automation systems. The system is built using ESP8266 and Raspberry Pi devices, by utilizing MQTT, REST and Laravel framework protocols. With Arduino, Python and PHP programming, household devices can be controlled both automatically and manually. Control system can be done by using web, chatbot, and physically. The communication used utilizes wireless network. With the designed system, the users can control the device, gain information and get warning. The information provided by the system is obtained from open data on the internet and from the sensor installed on the device.

ISSN: 1693-6930 ◼ Implementation smart home using internet of things (Afrizal Mayub) 3127 desig a platform that consists of hardware and software as the foundation in the manufacture of Internet of Things (IoT) device, and to implement the results of the designed platform as the basis for making the smart home.

Research Method 2.1. Smart Home Architectures
Home is a building that cannot be separated from human life because home is a primary necessity. To be able to function physiologically, a home must be equipped with various facilities required, such as electricity, water, lighting and others [13]. Along with the developments that LED to the digital era, nowadays there are a lot of research trying to make a home becomes easier to control. The term smart home has widely stated by researchers and activists in automation field. But to make a house into a smart home, it is needed a system to handle this. Smart home control system (SCS) is a system to manage and to control a home in order to improve the safety and comfort of home owners by improving the system of environmental protection, energy savings, simplifying the setting of both digital devices and mechanical devices becomes easier [14].

MQTT dan REST Protocols
Message Queuing Telemetry Transport (MQTT) Protocol is a protocol that runs at over TCP/IP stack and has a data packet size with small low overhead (minimum 2 bytes) that has an impact on the consumption of the power supply that is also quite small [15]. This protocol is the type of data-agnostic protocol which means that it can transmit any data such as binary data, text even XML or JSON and this protocol applies publish/subscribe model as shown in Figure 2, where the model is different from most protocol that typically uses client-server model. By default, MQTT protocol runs on TCP/IP port 1883, the protocol is widely used in communication Machine to Machine (M2M) and IoT. This is because MQTT is appropriate to be used on devices that have limited capabilities in terms of bandwidth and data transmission as well as is limited to the reliability of data transmission [16]. MQTT is a message-based protocol with the address of a message specifically mentioned as a Topic.
Representational State Transfer (REST) is an architecture of communication method that used HTTP protocol for data changing and this method is often applied in application development. The goal is to make a system that has a good performance, quick and easy to be developed (scale), particularly in the exchange and communication of data. REST is also one of the mechanisms of integration that has been very dominant to be used on the internet, REST has four essential components in it such as URL Design, HTTP Verbs, HTTP Response Code, Format Response [17,18]. In Figure 2 it is explained that a REST server will handle the data exchange process between REST client with the database.

Overview of the Smart Home System
Smart home control systems work by connecting electronic devices in the house with a control device which has been designed to connect to the Internet network, either wired or wireless. These electronic devices will be controlled by the state of data transmitted over MQTT protocol, the data is obtained from the user's command or triggered based on data from other systems, such as weather prediction system. In addition to taking orders in the form of specific states, the electronic device on the smart home system can also transmit data to other devices, so that data such as temperature, humidity and security conditions, can be monitored remotely via the web. The following is the design of smart home system as a whole which is presented in Figure 3 (a). Smart home control system design is done by utilizing m-Platform. Some of the features that will be covered in this study include lighting control, air conditioning control, garage door control, all of which can be remotely controlled either manually or automatically. Prototyping house is done using CAD software and has a size of 1:30 of the size of the original house. House design used as prototypes in this study has two floors, with a total of three rooms on the first floor and four rooms on the second floor, where the design of a prototype of this house is shown in Figure 3 Installation of Light Emitting Diode (LED) lights in each room as many as 2-6 items is used as a substitute for AC lighting installations simulation in the home. The use of home prototypes with a ratio of 1:30 is meant to be able to simulate the use of m-Node as a replacement of the manual switch, because the majority of the electrical installation in the house puts the light switch of a room located in one place, so that to implement the system of these prototypes in real homes, users should only replace the switch part into m-node device, as shown in Figure 4. The use of m-Node in addition to be used to control lights, can also be used to control other household appliances, such as water pumps, plants watering, fan and other equipment's. Thus, only by using an m-Node, the household appliances of conventional equipment can be turned into connected to the Internet and can be controlled remotely. In the garage, in addition to control lights, m-Node is also used to control a servo motor which then can be used to open and close the garage door remotely and automatically. In Figure 5 (a) it can be seen that for installation on the first floor, it needs four pieces of m-Node from ESP8266.  m-node configuration on the second floor does not use ESP8266, but it uses the Raspberry Pi, the use of Raspberry Pi is intended to try to implement m-Node system on multiple devices. By using the Raspberry Pi, the installation of wiring the lights on the second floor will be like in Figure 5 (b), where all the cable light will lead to specific location, such configuration is appropriate to be applied to new buildings, because the design of cable installation can be set up from the beginning, so it will not interfere with an existing electrical installation. Raspberry Pi has several advantages compared with ESP8266, among others, can be connected with some kind of connectivity, such as Wi-Fi, ethernet and Bluetooth. In addition, the Raspberry Pi is also equipped with an output that can be used as an interface, such as HDMI and Audio Jack, so in this study, the audio output will be used to give warnings and information such as weather conditions, as well as congestion. This information data will be obtained from several providers of information on the Internet through Application Programming Interface (API), the use of API will allow any person to obtain data and to integrate it on the device that is being developed, so that there will be more integrated devices in the future. The examples of data obtained freely from weather data provider among others are information about temperature, humidity, pressure, wind speed, cloud conditions, visibility and other information. The data is used as reference of the system developed in this study.

m-Node
Any device that can connect to the Internet, ranging from censorship of the simplest to the complex cloud servers are the parts of the IoT in which the phrase 'Things' refers to objects  that vary widely such as lamps, IP cameras, thermostats, alarm clock and others [19]. All electronic equipment's in the world can be a component of the IoT if it has internet connectivity, therefore in this study it will be made an m-node device as additional device that integrate electronics with the internet. On Figure 6 (b) indicated that the m-Node device requires the ability to bridge both the data transmission from the electronic device to the internet and vice versa. Therefore, there is a lot of choice in developing m-Node, among others ESP8266, Raspberry Pi and Arduino. All three devices are examples of some of the electronic platform that can be used as m-Node, but in this study, the discussion will be more focused on the use of ESP8266 and Raspberry Pi [20], this is because both of these devices have had the ability to connect to the internet by using Wi-Fi and ethernet. In use, each m-Node will have each 'NodeID' and 'NodeKey' as identity. NodeID and NodeKey are obtained from the website of 'nodemanager' in which they will be unique.

m-Broker
Currently the development of IoT is very rapid, ranging from household appliances, enterprises to industrial equipment. To handle the IoT devices that are increasing in number, it needed a messaging intermediary (broker) who is able to handle the amount of communication among IoT devices [21]. A broker serves to bridge the data transmission between the connected devices. In this research, will use the MQTT protocol as a broker. As shown in Figure 7 (a), a data will be transmitted through a broker to mark it as a topic [22]. There are several open-source projects that handle the development of MQTT Broker, one of which is mosquitto. The use of mosquitto in this research because mosquito is easy to install and have already implementing MQTT protocols version 3.1.1 [23].

m-Gateway
The development of IoT in the future will combine the real world with the virtual world, where the interaction between devices will make human life better. However, to make virtual objects can interact with users, it certainly does not like the communication made by the device to other devices, moreover, it is necessary for a solution where the development of this interaction can be done easily by all devices or by users [24]. This research will try to combine two protocol in order to deal with the existing problems, the MQTT protocol will handle communication between devices, while the REST protocol will handle communications between the user and the device. Figure 7 (b) explained that both protocols will be set to use on Data Layer, where basically all the data either received or requested on each protocol will be stored in the same database.

m-Dashboard
To be able to control or view data from IoT devices, it is necessary to have an interface system that can facilitate a user to manage the device in large quantities. There are many types of interfaces that can be used, but there is a very popular interface due to its ease of access, namely web interface, this interface can be easily accessed from all types of electronic devices such as computers, laptops, mobile phones even smart televisions can also access it. In this study, will use a web interface with a programming language of PHP (PHP Hypertext Preprocessor) and JavaScript, while for the base data that used, it will combine MySQL with Mongoo [25]. M-Dashboard Design will be made moreover users can customize to their individual needs, so users can adjust their Dashboard more freely, one example of the target results from the m-Dashboard can be seen in Figure 8. The use of m-Dashboard can also facilitate researchers to monitor the condition of the device, the interaction data both from and to the m-Dashboard is derived from m-Gateway, with communication media by using REST protocol.

Communication of MQTT
This study uses MQTT protocol as the communication protocol between devices, MQTT works by using the topic as a hierarchy of data transmission where each topic is a reference of the data transmitted. For example, a device wants to transmit data of temperature sensors, moreover, the topic example that that can be used is "device/1/sensor/temp" after a device transmits data on this topic, then the other device can take the data by subscribing to the same topic. Therefore, a topic should be regulated so as not to overlap one another. The composition of the topic used in this study are 28 topics, such as can be seen in Table 1.

Use Case Scenario
Users will be able to control the home electronic devices via a button on the device or through the Internet. Users can turn on or turn off the lights, control air conditioning temperature, open the garage door and other electronic devices that are connected to the m-Node. Users can access the interface from either system control page from the network or the Internet network. In addition to control, users can also obtain information from the m-Node, such as temperature, light intensity, door security conditions and others. The interface used in the form of web and chatbot. In general, the illustration of the use case scenario in this study is illustrated in Figure 9 (a).
In addition to working on the orders of users, this smart home system can also work automatically, in accordance with the rules set by the user, there are some automated systems that are used in this study, these systems are used to improve the comfort and the safety of users. The security system applied in the form of a forced door and window opening detection, this detection uses sensors that have been installed on the door or window, which if the condition of the door is supposed to be locked but is detected open, the system will automatically sound an alarm and notify users, and provide brief reports to security forces around the house, in general, this system is illustrated in Figure 9 (b).
When the afternoon and morning arrived, the automatic system for the garden lights will function. This system will turn on the garden lights if the time shows at 17.30 and will turn it off at 05.00. The data time is obtained from the server on the internet. But apart by time, to turn the lights are also based on data from the intensity of the light coming from the light sensor, these sensors can provide information about the intensity of light at a time and the user can set the minimum mark to turn lights on and off the garden light, in general, this automated system illustrated in Figure 10 (a). The smart home system can also arrange for all of the devices currently on the conditions is set out when users come from outside of a home or when the user leaves home. This system is referred to as home/away mode, or a mode that determines the presence of users. Users can set this mode through the web or through chatbot, therefore the users no longer need to turn on or turn off the electronic devices. In general, this system is illustrated in Figure 10  There are several features on the website that are used as smart home controllers, features designed to make it easier for users to control household devices at home. This website display can be viewed in Figure 11. There are some columns that divide each home device based on function and room. The web, which is designed to be opened through a computer or laptop device, can also be opened via mobile devices such as Android and iPhone, this is because the web display is designed responsively and mobile-friendly moreover the web display can adjust the screen size of the accessing device. The miniature results of prototypes design of a smart home are presented in Figure 12 and video [26] displays the test results of smart home design using m-Platform. Figure 11. Web appearance when opened on a mobile device Figure 12. The results of a prototype design of a house as a miniature smart house

Conclusion
This paper has described the designing process of the smart home using m-Platform by using the features of the website which can be accessed using a computer or laptop and can also be opened via mobile devices such as Android and iPhone. This study uses MQTT protocol as the communication protocol between devices, MQTT works by using the topic as a hierarchy of data transmission where each topic is a reference of the data transmitted. Furthermore, m-Platform is planned as an open-source project that can be studied, modified, improved and disseminated. Therefore, everyone who wants to create the IoT project can easily create prototypes for the project they want to make. In addition, by making m-Platform as an open-source project, it is expected that more people will contribute to the m-Platform development process, moreover, the development of IoT in Indonesia can be done more easily because there are already platforms that have handled the core part of technical development tools to be made.