Smart Monitoring System Using Raspberry-Pi and Smartphone

Sistem monitoring adalah hal yang sangat penting dan harus dimiliki oleh setiap pemilik rumah. Sehingga diperlukan alat untuk dapat mengawasi rumah secara real-time. Perancangan sistem menggunakan Raspberry-Pi sebagai pusat komputasi dan menggunakan smartphone berbasis android untuk melakukan monitoring. Sistem ini dilengkapi dengan beberapa fitur diantaranya pergerakan kamera secara horisontal dan vertikal menggunakan motor servo, sistem recording video yang dapat dikendalikan oleh user, serta sistem deteksi gerakan yang dapat menjadi alert untuk pengguna. Pengujian sistem dilakukan dengan cara melakukan pengujian network dilihat dari parameter bandwidth dan jumlah client dalam suatu jaringan untuk mendapatkan suatu sistem monitoring yang real-time, reliable dan smart. Dalam hasil pengujian dengan maksimum 2 klien dalam 1 network, sistem dapat menangkap rata-rata 10.7 frames per second, serta memiliki respon pergerakan kamera < 1 second. Pengujian fitur perekaman dan motion detection juga berfungsi dengan baik, sehingga sistem monitoring ini menjadi sistem yang


INTRODUCTION
In this era of globalization, the development of information technology plays an important role in various sectors of human life. In information technology sector that continues to grow until now is a smartphone. Formerly the smartphone can be only used for voice communications between humans, but now the ability of smartphones has been developed significant, which formerly can only be done by computers, now can be done by smartphone. Smartphone in performing its function requires an operating system. One of the operating systems used by this smartphone is android. Android is a Linux-based operating system (OS) designed for touch-screen mobile devices. The advantages of this Android OS is open source so that everyone can use this OS and develop the features contained therein (Mahalakshmi et al., 2014).
Technological developments that are constantly advancing at all times make many devices (tools) developed for similar applications. Prior to creating projects and research using raspberry-pi and smartphones, research on Home Surveillance technology has been studied and various techniques have been studied. Among other things, in previous research, the monitoring system using Zigbee technology and processed using digital signal processing (Haleemah et al.,2014). In digital signal processing, analog signals generated from the sensor nodes are converted into digital signals, then the digital signal is again converted into an analog signal. Analog signals from various sensor nodes are transmitted to a local home monitoring server using a ZigBee. From the local server, the data has been sent to the remote view via the network interface. However, often there is a disturbance received on the analog signal which is the lack of the system. The next development of smart monitoring using Arduino is a monitoring system consisting of two major hardware components: home PC server and Arduino Uno microcontroller (Nuri et al., 2016). Data is collected using various nodes in the desired area and this data is analyzed in Arduino language, then this data is sent to the personal computer using LAN cable and then with the use of ethernet this data is sent to the remote smartphone where easily monitored. Because the Arduino has no provision for Ethernet as this type of microcontroller makes it difficult for users to remotely transmit data, as well as arduino, supports limited numbers. To overcome these shortcomings, the system has proposed a real-time wireless video surveillance system to take video and send it as soon as possible with a negligible delay and will send it to the embedded web server network via ARM9 Board using mjpg streamer Algorithm (Chaudhary et al., 2014).
A new system developed that is supervision with SMS method on the network. The video capture in this system uses a PIR sensor connected to the raspberry-pi video. Images are captured at certain periods when these sensors detect motion and then Images are taken and stored in Raspberry Pi memory. This system is a real-time raspian system. However, the results of this system research there is a latency that when streaming video (Murugan et al., 2014).
Similar developments (Harikrishnan, 2015) were investigated under the used to detect intruders in the room, which then generates notifications to users via smartphones. The system uses several cameras that are used for different rooms. Thus, with the development of this system, 24-hour surveillance is no longer required.
Development of a monitoring system is then considered necessary to have video recording capabilities to make the system better. The study used raspberry-pi for home monitoring using a PIR sensor to detect motion with video recording capability and stored in raspberry-pi (SUBA, 2014). However, the user cannot control the recording capability of the system. In order to cover the lack of the previous system, a new system with better and smart features in real-time condition has been implemented and tested. Detection of moving objects is important tasks for computer vision, particularly for visual-based surveillance systems (Santoso et al., 2018). The detected object can be captured and send to user's email in order to give an alert. User can do a video recording as one of security feature of the system. Finally, the wide area of surveillance can be monitored within 180 0 for X & Y movement. In Figure 1, the workings of this system is described as the user connects to the VPN network so that the smartphone is connected to the same network as Raspberry-Pi, then the registered user in the database, faced with login page for the purpose of security system so that not anyone can enter into this application (Nataliana et al., 2014). After entering the correct username and password, the user enters the main page where the user can choose which camera you want to monitor, then the video that is coming from the webcam displayed in realtime to android smartphone owned by the user. In addition to monitoring, users can also control the webcam position from a distance. Explanation on how the subsystems working are as follow: 1. Sub system User interface In this sub system, the User interface is in the user's smartphone that will connect to the recording system through the network so that user can monitor video from a real-time webcam on User's smartphone, camera position and video recording position. 2. Sub-system interconnection In this sub system is used as a liaison between the user with the server and provide internet network in the form of VPN to stream video in real-time from raspberry-pi to User.

Sub system hardware & monitoring
In this sub system is used to set the relationship between raspberry-pi with webcam and servo motor. In the webcam section, the frames that captured by raspberry-pi will be accessed and displayed by the user over the VPN network. On the servo, the user's settings are remotely from the smartphone, and the video storage server is on raspberry-pi.

User Interface
In the design of interface sub-system is using Eclipse software as a framework to create applications on Android with the help of PhoneGap for making application pages, this application named HilariusCam. The HilariusCam application user interface can be seen in Figure 2:

Inteconnection
In the design of the interconnection sub-system is using VPN with PPTP protocol and utilizes the No-IP service to change the public IP address to be accessed into a domain. The Android phone later on can access the camera remotely. Since the VPN is used, the smartphone connection and Router connection become one connection. Using this technique, we can assume that this connection becoming a LAN connection. More than that, the access to this connection is secured due to VPN system. The design of the network can be seen in Figure 3:

Monitoring
In the design of the interconnection sub-system, the system used raspberry-pi as webcam server using bits of the catch from webcam to client with the help of motion software. Software in the form of frames, resolutions, image quality and other associated with the streaming process. The role in encoding is capture image bits from the webcam and sent to the web browser using the HTTP protocol and specifying the port on which the stream will be sent. Flowchart video appearance can be seen in Figure 4: The system is designed using this flow with multiple features available to maximize the security of the system.

Hardware
In the design of the hardware sub-system, the system used USB port for web camera and pin in raspberry-pi to control vertical and horizontal movement. Flowchart motion control can be seen in Figure 5: The hardware monitoring flow is using database to keep the last position of the camera. Every time the user login and do the monitoring feature, the system will refer to last position in the database so the user can monitor the desired area.

RESULTS AND DISCUSSIONS
This research conducted some experiments, first it measure the real-time monitoring process and controlling the servo as divided the movement of the camera with 11 positions to determine the camera position. By changing each position of the servo motor from position 0 to position 10 either vertically or horizontally. This is seen from the position of webcam cameras. This movement is triggered by command of the user on the application with the smartphone to drive the servo motors. Testing of this system can be seen in Table 1: From the experiment above, the movement of the servo that results to changes of camera frame is generally same with the design model. The system performs well when the action is triggered remotely. The connection using VPN doesn't affecting the servo movements.
For the second scenario, The camera surveillance is made for a home surveillance, and the standard speed of an internet speed for a house is 15 Mbps. To see the effect of Bandwidth to the system performance, the bandwidth of the internet connection are limited into several values. For this experiment, the internet bandwidths are limited by 15.3 Mbps, 12.6 Mbps, 10.11 Mbps, 6.89 Mbps, and 2.34 Mbps to see the frame per second performed by the system and determine the proper bandwidth for the best system performance. For the details of each test can be seen in Figure 6 -10: For the details result can be seen in Figure 11: From the experiment, the system real-time performance was significantly increased with the better bandwidth. In this experiment, the system gave the good performance with 15.3 Mbps bandwidth and displayed 12.3 frames per second on average. The result is above the standard frame per second for real-time streaming in industry which is 10 fps (Honovich, 2014).
For the third scenario, 15.3 Mbps bandwidth speed is used and the testing is tested to see the real-time monitoring performance with 1 -5 clients active in the network to see the impact to the system. In this experiment, the system gave the best performance with 2 active client. More than 2 clients, the results shown that the performance is drop and will not give a best performance. Some of the active clients on the same network affecting the bandwidth. Hence, the system was not received the maximum bandwidth provided to the system. The results can be seen in Figure 12: For the fourth scenario is tested by using 15.3 Mbps bandwidth and number of client parameter to test the time response of motor servo. After some experiment, the system gave < 1 second for the motor servo to respond user's trigger in the application. The result can be seen in Table  2: The result from Table 2 shows that the number of active client in a network doesn't affecting the time response of the servo, this is happened because the servo response on a time action. So when the user call a movement, it generates a signal to the servo and the servo will response with a movement. This is different with the previous test, where the number of clients affecting the frame per second on camera. The camera operates using a real-time basis and the number of clients will affect the captured frames.
For the fifth scenario, the system is tested to perform the feature of video recording. The video is saved in .mp4 format. This format is a standard video format that can be played directly from phone or a computer. The system works perfectly with the recording that can be triggered by the user. The results can be seen in Figure 13 and 14: With the controller in the user screen, user can control the camera remotely and perform a record activity.

Figure 14. Recorded Video in HilariusCam
The result of the recorded video can directly be streamed through user smartphone.
For the sixth scenario, the system is tested to perform the feature of detection mode that can detect the movement and send alert to the user through an email. The system is configured as the camera takes a picture every seconds and based on the picture taken, the raspberry-pi will check the picture taken with the previous picture. If the elements of the picture is more than a specified limit, it will trigger the system to send a mail using SMTP protocol. The system will include the picture taken by the system as result of detected movement. The results can be seen in Figure 15  User can choose "Detection" mode to perform a real-time security assignment to the system which can detect movement in the streaming. If the motion detected by the camera during "Detection" mode, the system will automatically send an alert to the user's email. In the email that is sent by the system, it will attach the picture of movement that is detected by the system. So the user who accesses the system remotely, will recognize the alert immediately.

CONCLUSION
The system is developed for a comprehensive solution that provides a reliable and smart monitoring system. This work provides users with an easy to use mobile application for which they can remotely access and control their home appliances and security. Based on the results, the real-time feature really depends on the bandwidth of the network and the number of active clients in the network. The system will work at the best performance (real-time) at 10.7 fps with the maximum 2 clients in the network. For the camera movements, the number of clients are not affecting the time response since the movement is based on signal basis. And the camera can detect a movement and can send an alert to the user directly when it finds a movement. The video capture also works fine and will be stored in the storage of Raspberry-Pi.