Integrated Smart Plug Design

Smart plug technology currently for user providing one plug module that is able to monitor and control the state of electrical appliance. The addition of plug number gives some deficiencies such as from cost point of view. By looking at the disadvantage made the tool which is able to monitor and control electrical appliance so that smart plug more than one integrated plug module. The manufacture of plug modules includes system design, sensor type selection in module, data delivery process, comparison of measurement module with measuring instrument and system test. From the results of the design is known that the module can perform data transmission, display the monitoring page and do the control and obtained percent accuracy of current readings obtained between 91.50% to 99.61% and the percent accuracy of the voltage readings obtained are ranged between 98.95% to 99.90%.


Introduction
Smart Plug is a multifunctional and easy-to-use device that allows users to monitor and control their electronic devices from anywhere and anytime at this moment [1].Smart Plug is available in the number of units for every single electronic to be connected.The addition of Plug numbers provides some deficiencies such as from a cost point of view.Monitoring function in Smart Plug to see the condition of voltage and current.Sometimes.power supply voltage become unstable on the power source is also important thing to know as a security to electrical equipment.
Fig. 1 is one of Smart Plug example in the market serves as monitoring and control of every single appliance of electrical appliance.In this study designed Smart Plug tool that is able to monitor and control the use of webbased electrical equipment which is amounts to more than one integrated plug module.This previous research became one of the reference authors in conducting the research so that the writer could elaborate the theory used in reviewing research conduction.Some of the previous research literature has been associated with this study.In a study conducted by L. Nikola et al [2], they describe the Smart Plug using Bluetooth Low Energy (BLE) as a communication and capable to process automatic such as controlling and reading the power consumption based on Wireless Sensor Network (WSN).In the study data still requires additional things such as no timer or Real Time Clock (RTC) and does not support the cloud system.
In other studies, the author explains that Smart Plug is able to detect the type of connected electronic devices based on the power consumption measurement data processing [3].
The Smart Plug uses Zigbee communication.In the design, added Home Energy Management System (HEMS) which serves to detect the type of connected equipment and provides control and monitoring of electronic devices.
There is also research uses the Wi-Fi module as a Smart Plug communication access via WebApp [4].The author uses more than one Plug module.On Smart Plug uses Wi-Fi microcontroller ESP-WROOM02 as accesspoint and as a processing of energymeter device.The power consumption measurement result is smaller than 0.5% error when compared with PSR 1.3 reference meter.
In this work we designed Smart Plug iusing Arduino as a control system to set on and off conditions as well as monitoring the voltage, current and power connected with the bluetooth module as a communication system between Arduino and Raspberry Pi which serves as webserver and data communication center.Arduino is an open-source electronics platform based on easy-to-use hardware and software.It's intended for anyone making interactive projects [5], [6].Arduino and Raspberry Pi.The Raspberry Pi is a credit-card size computer developed in 2012 at the University of Cambridge's Computer Laboratory, The Pi costs only $35, runs Linux in a graphical environment, and provide GPIO (general purpose I/O) connectors for sensors and motors [7].The system is low-cost and highly scalable both in terms of the type of sensors and the number of sensor nodes, which makes it well suited for a wide variety of applications related to environmental monitoring [8].

System overview
Smart Plug design integrated with Raspberry Pi 3 with access bluetooth communication through the web with stages as follows: 1. Creating a system model so that the description of the system needs to be designed, both hardware and software.2. Selection of device that suitable with the needs of the designed Smart Plug system.3. Integrate the hardware used in the design.4. Designing software program against hardware designed.
Designing an integrated electrical monitoring and control device with Raspberry Pi as a webserver via Bluetooth and accessed via smartphone through the web.Fig. 2 shows the block diagram of the designed system.

Electric Current
Sensor Arduino The device measures current and voltage obtains output data in the form of power.On the device there is also a relay module as a control of on and off.At the time system starts, the current sensor and voltage sensor will transmit data current and voltage through Bluetooth processed by Arduino when getting control relay command.The reading process is done continuously.The data will be sent every one minute to the Raspberry Pi database through communication between Bluetooth.Data will be displayed on the web page.Raspberry Pi performed data processing to the web with the help of tools.

Hardware design
Smart Plug design using hardware such as Arduino Nano, Bluetooth module, Relay module, ACS712 current sensor and ZMPT101B voltage sensor.Figure 3 shows the whole hardware schematic circuit.

Arduino program design
In designing Arduino program, the software used is Arduino IDE.The software is used to program the Arduino board, so that it could give commands to Arduino.The flow chart of the program can be seen in Fig. 4.

Server-side design
In the server-side design section, web page design is discussed to display the data sent by Arduino and save the data to the database in Raspberry Pi 3, the monitoring page of each parameter that can be accessed by the user to view the data sent in real-time.The block diagram of the server design can be seen in Fig. 5.

Node-Red
MySql Databases Server Page monitoring and control The web page is specifically designed to receive data that has been sent by Arduino via Bluetooth to Raspberry Pi and then stored into the database.Web pages created by using the Internet of Things (IoT) Node-RED programming.The sequence of processes undertaken by Node-RED is first, obtaining data from the raspberry serial port pi then gaining access to the database that has been created by giving the database name, database address, database password, and table name accessed.Once connected to the database, then the data received from Raspberry Pi will be broken down in accordance with the name of the variable and its value, then will be entered into the database.
MYSQL database is used to store data that has been sent so that it can be used and processed.The designed database has one table.Below is a list of table and column names of the designed database.The log sensor table serves as a database data storage table to plug.There are three columns, columns for date and time with date time variable, value column contains the value of power obtained and condition column is relay status.
The monitoring page is used by the user to view the data that has been stored into the database.This webpage can be accessed through the smartphone web browser.The web page was saved on a server.The monitoring page consists of reading the power and time values.Monitoring and Control Page can be seen in Fig. 6.Data on the monitoring page was taken from the database.Database table taken is a Log sensor table for each plug.Monitoring and control pages are created with the help of the Node-RED dashboard user interface tool.Control page displays the controls of each plug.Each control page has buttons to on or off.

Result and Discussion
The result of the designed prototype design can be seen in Fig. 7 and 8.The next step is testing of the prototype.

Testing and current sensor analysis
The tests were performed using Arduino Nano, ACS712 current sensor, and Arduino IDE software.The results of the test can be seen in Fig. 9.It shows the serial monitor displays of current reading result is 0.09 A.

Testing and analysis of voltage sensor
The tests were performed using Arduino Nano, ZMPT101B voltage sensor, and Arduino IDE software.Fig. 10 shows that the voltage values change too quickly and tends to be unstable.In the monitor serial voltage values were displayed voltage data every one second.

Testing control
The test was performed using Arduino Nano, Relay 1 Channel 5V Module and Arduino IDE software.Figure 11 shows the relay in HIGH state and the relay image 12 is LOW.

Two plug modules connection testing
Testing connections to Raspberry Pi requires 2 modules Smart Plug and Raspberry Pi 3 devices.The test is done pairing to each Bluetooth and then connect with serial port.Connection results can be displayed in the terminal or Bluetooth devices.Data transmission by connecting Bluetooth HC-05 with Bluetooth in Raspberry with RFCOMM is serial wireless port.Each Bluetooth is connected to each RFCOMM starting with pairing process and subsequent serial port connection process via Bluetooth setup device menu in Raspberry Pi 3.

Testing data submissions to the web
Testing data submissions to the web requires all the hardware components of the system being designed.From the test result, obtains that data delivery to web successfully saved to the database.The data sent on image sending process of Fig. 13

Comparative analysis of current in module designed with current on multimeter
In the test data obtained from the current reading, then calculated the percent accuracy of the tool designed.Determination of accuracy percentage using the following formula:  1 shows that accuracy percentage of current reading ranges between 91.50% to 99.61% and the absolute uncertainty of measurement in the module is 0.5 mA.

Comparative analysis of voltage on modules designed with voltage on multimeter
In the test data obtained from the reading of voltage, then calculated the percent value of accuracy of the tool designed.Determination of percent value accuracy using the following formula: From Table 2 shows that accuracy percentage of voltage readings ranges between 98.95% to 99.90% and the absolute uncertainty of measurement on the module is 0.5 millivolt.

Conclusion
In testing and implementation that has been done obtained the conclusion that the data sent be received and stored in the database, the monitoring page display data readout and control the flame and die electrical equipment.From the results of the design is known that the module can perform data transmission, display the monitoring page and do the control and obtained percent accuracy of current readings obtained between 91.50% to 99.61% and the percent accuracy of the voltage readings obtained are ranged between 98.95% to 99.90%.
In further development is done data processing from power consumption to detect device type and data of voltage could be processed to automation process of electronic device security.

Figure 4 .
Figure 4. Flow Chart of arduino program design.

Figure 6 .
Figure 6.Monitoring and control page.

Figure 9 .
Figure 9. ACS712 current sensor test result on serial monitor.

Table 2 .
Measurement results and voltage accuracy percentage