IoT-Enabled Door Lock System

This paper covers the design of a prototype for IoT and GPS enabled door lock system. The aim of this research is to design a door lock system that does not need manual input from user for convenience purpose while also remaining secure. The system primarily consists STM32L100 microcontroller as its core, TIP102 transistor that controls 12 VDC solenoid, and Xbee module to communicate with the smart home’s host and receive status regarding user’s GPS position. The system is tested by measuring the user’s distance from the predetermined location using GPS coordinate captured by an Android application, which serves to test whether the system is able to operate as intended and measure the device’s power usage. The test result shows that the device is able to work based on GPS coordinate data received, using 42.3 mA and 587 mA current in idle and active modes, respectively. Keywords—Internet of Things; smart home; smart lock


I. INTRODUCTION
The Internet of Things (IoT) is a concept revolving around global information network that consists "things" such as smart devices, sensors and actuators, and even smaller networks with their own identities and ability to self-configure and make their own decisions within certain extent, whether individually or collectively [1][2]. The advent of IoT foreshadows the future where everything and everyone is connected to the Internet through all devices they possess, whether from computer, smart phone, and other consumer devices. Objects within IoT network can also communicate using various communication technologies such as WiFi, Bluetooth, near-field communication, and many more.
One of the most common applications of the IoT technology is for supporting a smart home system. Recent smart home systems make good model on how an IoT architecture behaves, as objects in a house are connected to a gateway in wireless manner to communicate whether with each other and the house"s inhabitants. As a smart home system is intended to enhance the inhabitants" living quality in terms of comfort of convenience, the IoT is utilized to at least enable easier control and monitoring over the home devices. A smart home system can be categorized into at least one type based on its functionality: health care, entertainment, energy, and/or security [3]. Among these functionalities, security becomes one of the most crucial factors behind installation of the system. Enhancing home security using smart home can be done in a number of ways, including but not limited to installation of smart, customized door lock. Several examples of smart door lock implementation have already existed, such as camera-based door security systems [4][5][6], passwords [6][7], smart card [8], and proximity or location detection [9]. Each of the aforementioned methods has its own strengths and weaknesses, such as interoperability value of devices.
In this research, a GPS-based smart door lock is designed. The ultimate aim of this research is to design a door lock system that does not need manual input from user for convenience purpose while also remaining secure. However, for this publication, the scope is limited for examining the feasibility of utilizing GPS for location-based lock to achieve the aforementioned goal. Furthermore, the scope of this paper will be mostly limited to the lock hardware side, while the server and the Android application code handling the GPS tracking will only be briefly explained. This device is part of MINDS smart home system we designed, which also include RGB lamp [10], curtain controller [11], humidity and temperature sensor [12], fan controller [13], and infrared remote [14]. The smart home is controlled using Androidbased application detailed in [15]. This paper details the design of the smart lock design and implementation, as well as the testing result. This paper is divided into following sections: Section I presents the research background. Section II discusses the methodology that cover: highlighted research limitation, specification of developed system, hardware, system workflow, design of protocol, android and server. Section III reports the research result while the research conclusion and future work are given in Section IV and Section V, respectively.

A. Research Limitation
As mentioned above, this work is more focuses on the hardware part including defined diagram block, electronic circuit and its assembly, whereas the software part including system flowchart, android apps, and server are presented briefly, and it will be elaborated in detail for other publications. The test limit on the functional test (locked and unlocked condition) and power consumption measurement using digital multimeter. Further performance metrics will be explored in future.

B. System Specification
As the designed system is part of MINDS smart home system, the overall architecture is similar to other devices designed for the aforementioned smart home. The smart door lock is one of the nodes supported by MINDS system, which is connected to a Raspberry Pi-based host that serves as a "bridge" for the nodes to receive commands from user device in the form of Android-based smart phone. As for the smart phone, it is connected to the host through either Bluetooth or the Internet (via cloud server). The architecture of the MINDS system is depicted in Fig. 1.

C. Hardware Design
The door lock works like an on/off switch, which is controlled based on user"s proximity from the door. The lock system utilizes a battery-powered STM32L100 microcontroller as its core, which is used for controlling 12 V DC /630 mA solenoid and an Xbee module to receive signals from the central host. The solenoid is controlled using TIP 102 transistor by utilizing its cut-off and saturation modes to switch the solenoid"s state. Furthermore, the system is equipped with components such as DC power jack, microUSB port for development purpose, switch, and reset and mode buttons. The block diagram of the door lock"s hardware is depicted in Fig. 2, while the circuit diagram for the solenoid control is depicted in Fig. 3.
As the transistor is required to work in saturation and cutoff region, the value of components such as resistor must be determined in such way so they can support these operation regions. According to TIP 102"s datasheet, the base current (IB) for saturation region is 1.9 mA. As such, to achieve the current, the equation (1) is used for calculating the base resistor value.
The value of the V out is based on STM32L100"s output port voltage, which is 3.3 V DC , while the voltage between base and emitter ports of the transistor is based on the transistor"s Darlington configuration, hence 1.4 V DC (0.7 V DC +0.7 V DC ). Based on the calculation, it can be inferred that 1kΩ resistor is required to make the base current into 1.9 mA. Aside from the base current, the maximum power the transistor can handle also needs to be considered, especially when the solenoid is active. According to the datasheet, the transistor is able to handle 80 watt of power dissipation. Assuming the V CE during saturation is 2 V DC , then the solenoid power is:

D. System Workflow
This section describes two separate programs required to operate the lock: the firmware inside the microcontroller and the mobile phone (Android) software to transmit GPS coordinate of the user to the host. The flowchart for the firmware is depicted in Fig. 4, while the flowchart for the Android application is depicted in Fig. 5.

E. Protocol Design
The message protocol used to transmit GPS data to the host is based on the protocol elaborated in [16]. The specific structure of the message for door lock control is depicted in Fig. 6 (consisting the packet header, address, packet init, Data payload, and checksum).

F. Android Application and Server Design
The door lock works by having the Android application that serves as user interface of the entirety of MINDS system to periodically detect GPS coordinate of the user, then send it to the server (and host) to be compared with the house"s coordinate. If the distance is 10 meters or less, the application will send command to both the server to unlock the house, which will be relayed to the host then to the lock hardware. Likewise, if the user"s distance with the house is more than 10 meters, then the system will be locked. The system will send a warning if an unauthorized attempts to access the device within the house is made while the house is locked.

A. System Implementations
Based on the block diagram depicted in Fig. 2 earlier, the printed-circuit board for the controller is designed with the result depicted in Fig. 7. This controller design is similar to the controller from previous project [13]. The reasoning behind the similar design is to add interoperability value to the system while also enhancing its performance.
To control the solenoid lock, the 0 th pin of STM32L1000"s GPIO-B port is used as the output port. The software implementation for the port configuration is elaborated in Table I, while the control process is elaborated in Table II. As previously explained, this system works together with the host and MINDS Android application. Fig. 8 displays the comparison between the MINDS application during normal (unlocked) condition and locked condition. The application captures the user"s location every 5 minutes using GPS, then send the result to the server (and host), after which the host will send command to the lock device. If the house is supposed to be locked, then a warning will be sent if there is any unauthorized attempt to control the device. The code implementation for the GPS tracking is depicted in Table III, while the code implementation for the control and warning by host is depicted in Tables IV, V and VI.  .build(); JSONObject obj = new JSONObject(); obj.put("head", "LC"); obj.put("homeid", SensorService.home_id); obj.put("lat", Double.toString(SensorService .latcur)); obj.put("lng", Double.toString(SensorService

B. Functional Test
The testing of the system is conducted on a door miniature (Fig. 9). To test the door, user is required to stand within determined distances with the door. In this case, the threshold is set to 10 meters from the door. According to the result as in Table VII, the door lock system that has been developed can work properly as expected. It can lock and unlock wirelessly. www.ijacsa.thesai.org

Lock
The door is locked √

Unlock
The door is unlocked √

C. Power Measurement
To measure the power consumption, simply we used digital multi-meter to know the current flow during two conditions (idle and process). The result of the test is elaborated in Table VIII. The power consumption in idle condition is 507.6 mW that obtained from 12 V DC * 42.3 mA, while in process condition is 7044 mW. In this paper, a prototype of location-based smart door lock system is designed. The system utilizes the user"s GPS coordinate that is captured from a mobile application, which is then sent to a smart home system"s central host to enable or disable the door lock based on the user"s proximity to the door"s designated GPS coordinates. Based on the testing conducted, it can be concluded GPS coordinates can be used for controlling door lock. However, further study is required to improve the quality of the system, whether in terms of power efficiency, area tracking and indoor accuracy, and further increase the security.

V. FUTURE DIRECTION
For the next phase of the work, Android"s geo-fencing implementation will be studied to examine its effectiveness on improving the lock"s accuracy.