Dual Mode System of Smart Home Based on Internet of Things

In the digitalization and automation era, the internet has become an inseparable part of human life It provides a place for devices that are connected and can be controlled wirelessly through a network infrastructure, which is called the internet of things (IoT). In this research, the dual mode system of smart home based on IoT is proposed. In this system, the smart home can be controlled both manually and automatically. The key component for the proposed system is the relay mode which can be controlled to select the mode. The hardware implementation was done to test the proposed system with good result. Blynk app is used to control in automatic mode with virtual switch. When the manual mode is selected, the automatic mode is turned off and vice versa. Keywords—Smart Home; IoT; Dual Mode; Internet of Things; Automatic


INTRODUCTION
The era of digitalization and automation has brought a change from manual systems to automated systems. In this era, the internet has become an inseparable part of human life [1], [2]. The internet provides a place for devices that are connected [3] and can be controlled wirelessly through a network infrastructure, which is hereinafter called the internet of things (IoT) [1], [4], [5].
The concept of IoT has become the focus of research in recent years [6], [7]. The IoT system consists of hardware devices such as microcontrollers, sensors, etc. which communicate the data to the server [4]. With the IoT, it is possible to create a smart home that can communicate and integrate home appliances and smartphones [8]- [11].
Currently, various smart home models have been developed. Ransing and Rajput [9] used the ZigBee protocol to monitor temperature because it consumes much less power. Kumar and Lee [12] use Bluetooth and REST full based web services as an interoperable layer. This system allows connectivity without the internet by Bluetooth or via the internet. Young-Guk Ha [13] implements a ZigBee-based intelligent automation system. The system is used for security purposes. Stankovic and Kiran [14] analyzed the need for smart nursing home sensors, for faster diagnosis and treatment. Noguchi, et al. [15] described the results of the accumulated sensor data and used them to predict the behavior of humans. Brundha and Lakshmi [10] make use of the home automation system to enhance the security system by capturing an image of someone entering the house.
Vikram, et al. [16] focus on developing smart homes at low cost. Soundhari and Sangeetha [17] developed a voicecontrolled android application to control home appliances. Chiao, et al. [18] implement a Bluetooth-based mobile sensor that can be controlled via an application on an android smartphone. Yang, et al. [19] proposed a home automation design that would promote the adoption of home automation and digital control.
Today Bluetooth-based automation systems are low cost and easy to install but lack sufficient flexibility. The use of Bluetooth is also limited to low distances [4], [20]- [22]. ZigBee-based systems also have similar problems regarding distance and are limited to indoor use. The use of a Wi-Fi system with IoT on a smart home provides advantages in real time access without distance limitations [22]- [25], low cost, and practicality [26]. However, it should be noted that in reality, not all users have a built-in internet router in their home.
In general, smart homes only offer and promote remote automatic switching systems. There is also a smart home offers an automatic remote system and physical switches such as the hotel swap switch. However, this method provides a confusing switching function in determining the on-off switch conditions. This can be anticipated by providing a detection sensor on the physical switch in order to know its condition, but this will increase the cost of making the system. This paper proposes a dual mode which combines manual and automatic switching system method based on IoT using a third-party smartphone application, Blynk. The system utilizes the NO (Normally Open) and NC (Normally Closed) functions in the relay. The number of the relays is adjusted to the number of electronic equipment to be controlled, plus one relay instead of mode. The modes are divided into two modes: manual and automatic. In the manual mode, the system can be controlled via a switch available in the house. On the other hand, in the automatic mode, the system can be controlled via buttons and timers on the Blynk application.
The key difference of the system is the presence of the one addition relay which controls the dual-mode function, so the system can be controlled both offline and online without any sensors needed. Both modes can overwrite each other as needed.

A. System Overview
In general, the system consists of three parts: high voltage, low voltage, and cross system. Between high voltage and low voltage is bridged by a relay. The relay is controlled by a Node MCU microcontroller. Node MCU acts as the system controlling brain, controls the relays, manages communication and data synchronization with Blynk. The system flow process can be seen in Fig. 1(a) whereas the block diagram is in Fig. 1 (b).

B. High Voltage Part
The high voltage part consists of components with a high voltage (220 V AC). In simple terms, the high voltage circuit can be seen in Fig. 2. There are two relays which is relay mode and relay control. The first one is used to select the mode, manual or automatic. Whereas the second one is for automatic control. In the high voltage section, it is divided into two conditions, namely conditions in manual mode and conditions in automatic mode. The first condition (default), when the system is using manual mode. This condition can be seen in Fig. 3. This condition allows for manual switching with a physical switch. In this mode, all forms of switching through the application will be disabled. Furthermore, in the automatic mode, it allows for switching through the Blynk application and automatically with a timer that can be set in the application. In this condition, the manual switch cannot be used for switching. Illustration of automatic conditions can be seen in Fig. 4

C. Low Voltage Part
The low voltage part is an important part because it regulates the whole system. The low voltage circuit can be seen in Fig.5. This system is handled by the Node MCU. This microcontroller works to set the relay when it is in automatic mode, by receiving commands given from the Blynk application. In this section, there is one physical switch (mode switch), to set the mode to be used. This switch will help when there is no internet network or do not have application access.
Node MCU will synchronize every certain time interval with the Blynk application. Synchronization will continue if there is an internet network available. Synchronization includes the currently selected mode and virtual switch conditions on the Blynk application when in automatic mode.

D. Node MCU
Node MCU is a microcontroller board with an ESP8266 chip. It has a microcontroller with built in Wi-Fi, so it does not require additional Wi-Fi devices. Node MCU uses the standard Lua programming firmware script, to make programming easier, the Arduino IDE software can be used by adding the Node MCU board library [27]. Figure 6 shows the I / O pins of a Node MCU [28]. Currently, many retailers are producing ESP8266 to facilitate IoT work. Node MCU is a board that is easy to use and has many variations of the pinout. In addition, Node MCU has a USB connection so it is easy to connect with a PC.

E. Blynk Apps
Blynk is an IoT platform that allows to control electronic equipment in real-time and remotely via an application on a smartphone. Blynk provides a dashboard that can be used by users to create a graphical interface based on widgets available in the Blynk application [29].
To start using Blynk, it is necessary to install the library on the Arduino IDE and create an account in the Blynk application. Once you have an account on it, you can create a Blynk interface by creating a new project. From the project, an authentication token will be sent to the email. This unique code will be used when programming Node MCU on the Arduino IDE. The working principle of Blynk is shown in Fig. 7.
In the Blynk application, there is a virtual switch that can be used in automatic mode and a timer function to turn on the relay for a certain period. This application is also equipped with a virtual switch to set the mode if the user wants to use and check the condition of the mode.

III. IMPLEMENTATION AND RESULT
Implementation is done by using 5 relays: 4 pieces for control, and 1 piece as a relay mode. The implementation is carried out at the author's house, to control the switching of 4 lights. Implementation produces lights that can be controlled manually with a physical switch with the condition of the system can be seen in Fig. 8. It shows the system in manual mode, with the rightmost relay mode indicator is off. In the Blynk application, the virtual mode switch is in manual state. Fig. 9 shows that the 3 virtual switches are on, but they do not affect the hardware since it in manual mode.
In automatic mode, the light output can be controlled via the Blynk app. In this state, the physical switch has no effect on the lamp condition. Fig. 10 shows the hardware in automatic condition with an indication that the relay mode is on. In the Blynk application, the virtual mode switch is  Fig. 11 shows that 3 virtual switches turn on and activate the relay to turn on the lights.  Complete experiments result can be seen in the Table 1. Based on the experiments, the lamp condition always follows the condition of the physical or virtual switch according to the relay mode condition. Also, the system has the ability to synchronize the virtual switch and the relay mode condition Chico Hermanu, Dual Mode System of Smart Home Based on Internet of Things every time the system has connection to the internet, even the connection failure, the system will attempt to reconnecting in every given interval time.

IV. CONCLUSIONS
The dual mode of smart home base on Internet of Things that was proposed can work well in real applications. The key component for the proposed system is the relay mode which can be controlled to select the mode. In manual mode, the physical switch can be used to turn on the light, while the virtual switch in the application has no effect. In automatic mode, the lights can be controlled via a virtual switch in the application and automatically with the provided timer. In automatic mode, the physical switch has no effect. The lamps condition always follow the virtual or physical switch according to the relay mode, and the system always make a synchronization every given interval time.