Monitoring and controlling electricity consumption using Wemos D1 Mini and smartphone

The purpose of this study is utilizing the system that can monitor and control electricity consumption using a smartphone remotely. Finding in this study related monitoring and controlling electricity consumption using wemos D1 Mini and blynk app on a smartphone is quite effective. The electricity consumption information is displayed on LCD of wemos D1 mini and blynk app on a smartphone in the form of voltage, ampere, watt, and frequency. This device has two control function namely local mode and remote mode. Using local mode will generate output load turned on by switch and using remote mode will generate output load activated via blynk app on a smartphone.


Introduction
The electricity provider in Indonesia that is held by an Indonesian state-owned electricity company (PLN) applies the pre-paid payment system for using electrical energy. People are required to top up the credit with a certain amount so the electrical energy can be used [1]. Excessive electricity consumption is caused by unmonitored electricity consumption leading to electrical energy waste. Besides, the uncontrolled use of electrical equipment has a big risk of fire due to excessive current load [2]. One of the ways to solve these problems is by utilizing a system that can monitor and control electricity consumption [3].
In the previous researches, Yun J. et.al. had presented a way of monitoring and controlling energy consumption of electronics and devices using smart sockets and smartphones with a Java-based program. They developed wireless smart power sockets which can measure power consumption of electrical devices, and transmit the collected data set to a gateway connected to a host server.
This study aims to develop a system that can monitor and control electricity consumption using a smartphone remotely. The design of this device uses a common power socket in Indonesia with the purpose that the installation of this device is effortless. The information provided on displays are voltage, ampere, watt, and frequency. Besides, users can also control electricity consumption using a smartphone. The system of monitoring and controlling electricity has a big impact on society for economizing electricity consumption by turning off the unnecessary electrical device using a smartphone. Mini is this device can stand alone processing each code that comes in without using arduino as its microcontroller since wemos D1 mini has a Wi-Fi bundling module. There are digital pin and analog pin inside wemos D1 mini. Digital pin can be configured as input or output. Analog pin has a 10-bit resolution at 3.2-volt maximum [4]. 2. PZEM 004-T PZEM 004-T module is a multifunction sensor module that is used to measure watt, voltage, ampere, energy, and frequency of the electric current. This module has been equipped with an integrated voltage sensor and a current sensor (CT). This device is designed for indoor usage with the load installed not more than 80-260 VAC and 100A [5].

.3. Relay
Relay is a switch that operated by electricity and electrochemical component that consists of 2 main parts such as electromagnet (Coil) and mechanical (Switch). Relay uses the electromagnetic principle to move the switch so it can deliver high voltage at low power. For example, 5V and 50 mA of an electromagnetic relay can move armature relay to deliver electricity at 220V 2A [6].  Display) is one of the displays made from liquid crystal which its operation uses a dot matrix system. LCD mostly used for electronic devices display such as calculator, digital multitester, digital clock, etc. LCD is easily connected to Arduino. The LCD is 2x16 with 2 rows and 16 columns wide display. This LCD has been equipped with its controller so that it is easy to use and adjust the data pin of its LCD with a microcontroller [7].

Blynk
Blynk is a server service that is utilized to provide internet of things project (IoT). This server service has mobile users both android or iOS. Blynk is a digital dashboard with graphic user interface facilities in the making of its projects. Adding components at Blynk app with drag and drop simplifies the adding of input/output components without programming ability.
Blynk was created for controlling and monitoring remotely using the internet or intranet (LAN network). The ability to store data and display data visually using the number, color or graphics facilitates creating projects in the field of the Internet of Things (IoT) [8].

Methods
The designing, manufacturing, and testing of this device need to be organized into a complete and clear design scheme. The design process involves the selecting components process, making frame design, designing the physical device form, and creating an interface of blynk application. Several steps are made to make this system well functioned and facilitated in making this device, it is shown as the flow chart in figure 6. This research was started by collecting information associated with this study. The next step is designing and making a device that can measure the electric load. If the test shows good results so the working process will be continued to design and manufacturing graphic user interface in Blynk app. When those processes have been over so the development of wemos D1 mini code program will be carried out based on monitoring and controlling devices. If the test does not show good result so it needs repair and evaluation to code the program that has been made.
Wemos D1 mini is the main component in this study as a processor for the whole system and connector to the internet, PZEM-004T as voltage, ampere, watt, frequency (Hz) sensor and relay module as an electric switch that controls the electric load. Data processing in the cloud server is using Blynk platform as one of the IoT services that have complete tools in a smartphone. The whole system design of the monitoring device is shown in figure 7.  Figure 7. Diagram block of monitoring and controlling electricity consumption system.

Result and Discussion
The results of assembling monitoring devices and electric power control are shown in Figure 8. The detail explanation of each part of the assembling result as shown in Figure 8 is explained in the following table:  Figure 8 and Table 1 explain that the AC 220VAC voltage input transmits a fuse of 5Ampere, then the power supply voltage stand by the power switch. When the switching power is turned on, the voltage to the power supply is reduced until 5VDC / 2Ampere. The 5VDC voltage is used to switch on the system in this series of devices such as Wemos D1 Mini, 5Vdc Relay Module, and 20x4 Character LCD. Meanwhile, when the Local Switch and Output load are turned on then the voltage is supplied to the 220VAC socket for distribution to the load. However, when the switch is in the remote position then the voltage output at the 220VAC socket is controlled via the blynk application on the smartphone.
Power Supply test uses a 5Vdc power supply because wemos D1 mini requires 5 Vdc power supply. Conducting a power supply test in advance ensures the amount of voltage issued following the required voltage.  After conducting a test with the result shown in table 2, it can be concluded that the power supply is functioning normally even though the input voltage rises or falls but the result at the output voltage of the power supply remains constant at 5Vdc.
The result of the PZEM sensor reading test is measuring voltage value, ampere, effective watt, and frequency. The measured data by the PZEM sensor will be displayed into LCD then it is compared to the measured score in Avometer. Data result of PZEM Sensor Measurement Accuracy Testing is displayed in table 3.   Relative error percentage is counted in each sensor measurement results data. The calculation data of relative error percentage of PZEM sensor measurement results are presented in Table 4, using the following formula. The calculation results of the average relative error percentage value for each measurement are shown in Table 5. Blynk application is provided monitoring load data in the form of voltage, ampere, watt, and frequency. The testing result of the load monitoring function as shown in table 6.  Table 6 above shows the testing result of the load monitoring function with a Smartphone that the average delay time is 325.3 mS. With the longest delay time of 365 mS and the fastest delay of 300 mS then the response of the monitoring function is quite good.
The load control function in Blynk application is on the menu tab containing widgets that can be utilized to control the output load. Load output control is a tool to stream (On) or cut (Off) the ampere from source to load. Data Testing Results of the Load control function are displayed in table 7.

Conclusion
Based on design, manufacturing, and testing process that can be resumed as below: 1. Monitoring and electric power control can be made from Wemos D1 Mini and blynk platform. LCD as a monitoring function and Blynk application provides voltage, ampere, watt, and frequency. 325,3 mS is the average time that is required by the system to update data in blynk application and the fastest time is 300 mS and the longest delay time is 365 mS. 2. Load control function has been created with 2 types of function control, local control and remote-control function that can be managed by Blynk application. The average time required by the system is 845 mS, the fastest process is 745 mS and the longest delay time is 945 mS when it is using to control the load from Blynk application. 3. Measurement accuracy testing by the sensor has a relative error percentage in 0,004 % to measure voltage, 0,014 % to measure ampere and calculate the power is 0,018%. Finally, to accomplish monitoring and electric power control better there are several things to be concerned in designing and operation including (1) a good internet connection network is required to communication from wemos D1 Mini to Blynk platform is not being hampered and (2) using Avometer True RMS for better measurement accuracy.