Development of IoT-Based Portable Power Quality Monitoring on Microgrids by Enhancing Protection Features

The need for small-scale renewable energy generation is predicted to increase. Distributed energy production, in general, can be more profitable due to the cost of distribution and use of energy storage, especially from the microgrid. However, the utility and consumers face difficulties maintaining demand imbalance, frequent load-shedding, and a drop in power quality. To address this issue, a portable power quality meter and protection based on the Internet of Things (IoT) for low-voltage distribution are proposed. The proposed prototype has several advantages. First, the procedure for implementing a portable IoT-based power meter with power quality and protection features for residential networks. Compared to other devices, this type has the advantages of power quality measurement, such as power factor, frequency, and harmonics. Second, an approach is proposed device with a parallel function in maintaining network security and quality. This increases the advantage of monitoring loads connected to the grid. Third, perform IoT power monitoring devices that provide notifications in real-time. Fourth, an experiment using a power meter on a microgrid connected to renewable energy combines a LiFePO4 battery and methanol to get the maximum benefit from green energy. The test results found that the IoT model can work reliably, where access to monitoring can be done via the website. The smart meter consists of a voltage transformer, current transformer, and microcontroller unit with an embedded communication module. The existence of more affordable monitoring and protection tools can increase the user’s opportunity to gain profitability.


I. INTRODUCTION
The use of nonrenewable energy to generate electricity is carried out by most regions worldwide, causing potential negative environmental impacts. Consideration of the limited reserves of fossil fuels combined with initiatives to reduce energy emissions resulted in the emergence of the Paris Climate Agreement [1]. The old electricity network control architecture is not ideal for future needs. In recent years, The associate editor coordinating the review of this manuscript and approving it for publication was Zhigang Liu . conventional power grids have been redesigned into intelligent, efficient, and integrated systems. Electricity consumers now have the opportunity to produce and consume electricity with the current development of distributed energy resources [2]. Modern grid systems have the potential for flexibility, economic viability, environmental friendliness, higher power quality, increased reliability, and adaptability. The potential has attracted the attention of researchers in prioritizing the transformation of microgrids.
An appropriate strategy and device protection are needed for the microgrid to work reliably in islanded and grid-connected modes. The challenges faced by protection schemes in microcontroller-based microgrid networks are described in the literature. Protection must be able to work to overcome problems in the field in grid-connected and islanded operational modes [3]. The limiter-based overcurrent relay feature approach is proposed to anticipate disturbances during network operations [4]. In addition, Coordination schemes using non-standard tripping characteristics in distributed generation (DG) connected networks are developed with the help of optimization methods. The working time of all overcurrent relays is limited by a non-standard inverse time approach for all operating conditions of the power network [5]. The implementation of microgrid networks remains to be studied and developed further by considering more complex features in accordance with electricity grid standards.
Power generation will be more distributed to reduce distribution losses and costs in the future. Small-scale power plants, with the lower market price of batteries, are expected to further increase the financial benefits to consumers [6], [7], [8]. The power grid is also moving towards a new concept regarding the electricity market. Prosumers with generating capacity can produce energy and sell directly [9]. In addition, with the emergence of renewable energy storage alternatives, such as hydro pumps, which are cheap and environmentally friendly, this is a distinct advantage that could further fuel consumer interest in individually installed renewables [10], [11]. Energy of various capacities can be produced where energy consumption occurs. However, the impact of increasing renewable energy and with the inclusion of renewable power plants has changed the network architecture. In conventional networks, generators are centralized with large capacities. In the modern scheme, commercial consumers have a stake in the flexibility of the electricity network.
The behavior and quality of electricity in low-voltage networks can easily change with the increasing use of DG and power electronic devices [3], [12], [13]. Power quality refers to a wide variety of electromagnetic phenomena that influence the voltage and current at a given time [14], [15]. Poor power quality can damage and reduce equipment life and increase consumer energy costs. Although ordinary electrical household appliances can operate with small deviations outside the standard voltage range, they can be damaged by large voltage changes [16]. Other cases that can occur are short term voltage dips and current increases. Thus, power quality is one of the essential requirements for home electricity to increase the comfort and service life of devices. Some of the work that several researchers have carried out includes smart meters that are used in several countries, such as Europe, America, and the Asia-Pacific region [17], [18]. Considering the level of satisfaction and flexibility, the price of electricity can be an advantage of these devices. Research related to network reconfiguration on a radial system with DG placement has been carried out [19]. Parameters that are repaired in the network include losses, harmonics, and voltage deviation. Additionally, work related to smart-meter exploration with monitoring of power quality and protection was conducted [20]. However, some of these concepts have not been implemented in experiments on renewable microgrids.
Smart energy metering devices are popular because they feature data collection, remote monitoring, and distribution system control [21]. Currently, smart metering has capabilities similar to standard system metering. Researchers have conducted several studies related to power monitoring for residential networks. Among them is proposing low cost universal smart metering, and online condition monitoring for developing countries was presented [20], [22]. Other work is more concerned with the development and implementation of power quality features. The proposed Fast Stockwell transform can measure power quality by analyzing load harmonics. Devices can set loading and price combinations in real time [23], [24]. The device supports IoT-based power quality and demand-side management features. The development of IoT smart meter features on the consumer side, such as sending compressed data, implementing error protection, and monitoring features, has also been carried out [17], [25], [26], [27]. The challenges that have not been resolved include the features on the device for recording protection and monitoring power quality supported by IoT with renewable energy devices. Users need to know the quality of electricity used to improve the security level of their electricity network.
Devices with smart demand management features can manage schemes and schedules for daily energy use. Demand load management can reduce peak loads and greenhouse gas emissions [22], [28], [29]. Management system integration can provide opportunities for emergency power supply during power shortages and reduce load shedding. Management system integration can provide opportunities for emergency power supply during power shortages and reduce load shedding. Another approach developed is to analyze electricity measurement data to predict the load profile of electricity consumers and investigate daily and seasonal energy variations at certain periods [30]. However, an emerging challenge associated with large expense management is the inappropriateness of long-term demand management. This is due to the increasing demand for electricity and the number of residents every year.
In a modern scheme, with the inclusion of renewable energy, commercial consumers have a stake in the flexibility of the electricity network. Consumers have difficulty monitoring electricity usage in a specific area. Technological advances from previous work have facilitated the use of IoT power monitoring for identifying consumer load profiles, as well as testing demand side load management. However, little attention has been given to power quality monitoring in distribution networks of renewable energy penetration in microgrids. A device for a microgrid network with parallel   power quality and protection features that have yet to be developed from a literature review is proposed. Relay protection features are explored in depth based on ANSI/IEEE standards. The contributions of the paper can be summarized as follows: 1) Procedures for developing portable power monitoring with power quality and protection features in the distribution network. 2) Procedure parallel function for power quality and protection features in a device. 3) Making a device with feature monitoring based on IoT that can be monitored in real-time. 4) Testing device to the network connected to renewableenergy microgrid. This paper is structured as follows. Section II describes the component materials and methods used in prototyping. Section III describes the results of calibration, testing, and analysis. Finally, the conclusions of this work are given in the Section IV.

A. SYSTEM MODEL OF PROPOSED SMART METER
Parameter reading from the network to power quality and protection parameter monitoring is obtained from the integration between the functions of the hardware and software sections. The block diagram of the integration of the two functions is illustrated in Fig. 1.
The power supply provides energy to the load through the distribution line. A current sensor is used to obtain the current value through the line. The voltage signal is processed using signal conditioning to obtain an output voltage of 2 V DC to enter the analog to digital converter (ADC) and digital signal processing (DSP) devices. DSP devices are related to power quality chips, labeled ADE measurement. The detailed hardware block diagram uses a microcontroller to process the power flow of the monitored system, as shown in Fig. 2.
The DSP result parameters are then accessed by the SPI serial communication with the functions stored in the program memory section. The ADC reading result is calculated root mean square (RMS) by function. All processes are carried out in parallel. The ADC reading signal is calculated to obtain the RMS measurement result in the protection program subroutine via the general purpose input/output (GPIO) peripheral in 0 to 3.3 V DC. Next, the relay driver activates the magnetic contactor (MC). Processed power quality and protection parameters are executed in the form of notifications. The GPIO control function's processing results are displayed on the internal and external screens. A universal synchronous asynchronous receiver transmitter (USART) peripheral connects to external devices.

B. POWER AND HARMONIC CALCULATION
Electric power can be defined as the rate of flow of energy from the source to the load. The voltage and current waveforms represent electric power. The resulting waveform is a power signal at a given time. Resistive elements contained in the load can generate active power. Reactive elements in the load, such as inductors or capacitors, can produce a phase difference between the voltage and current, giving rise to reactive power. Reactive power is the product of the waveform, and current harmonic components of a signal are shifted in phase by 90 • . Active power can be described as watt/s, while reactive power is var/s. If an AC power network is supplied by a voltage and current that contains harmonics, then the equation can be written as, is product of v(t) and i(t) for P and i ′ (t) for Q, then the calculation of the active and reactive power can be explained as, where P active power (Watt), Q is reactive power (Var), n is time sample number, T is period of the line cycle, V k is voltage RMS in harmonic k (Volt), I k is current RMS in harmonic k (Ampere), and φ k −γ k is phase delays in harmonic k.
In AC networks, the power factor can be defined as the ratio of the total active power through the line to the apparent power. Absolute measurement can be defined as leading or lagging VOLUME 11, 2023 from current to voltage. Capacitive loads cause current toward the voltage (negative power factor), while inductive loads do the opposite (positive power factor). Nonlinear loads can cause harmonic distortion. The distortion has a periodic signal characteristic. Voltage and current signals have different magnitudes and phase angles on nonlinear loads [31]. Permitted THD are categorized in the IEEE 519-1992 standard [32]. The general form of the harmonic index, considering the waveform, is THD in percentage form with the RMS, which can be expressed as, where THDv is total harmonics distortion voltage, THDi total harmonics distortion current, v n is RMS voltage at a single frequency in harmonics n, V 1 is line-to-neutral voltage RMS, and I 1 line-to-neutral current RMS.

C. DEVICE PROTECTION SCHEME
One type of safety relay used in the power system is an overcurrent relay. The relay can function as an overload and short circuit. This relay has a working principle: overcurrent relays can be inverse, definite, and instantaneous time overcurrent relays [33], [34], [35], as shown in Fig. 3. The inverse time overcurrent relay has an operating time inversely proportional to the fault current. The greater the fault current is, the faster the relay operates. Time-current characteristic (TCC) curve is a curve on the time dial (t d ) scale. The greater the time dial value is, the longer the relay operation time. The inverse characteristics are described by the IEEE 242-2001 standard [34], [35], [36]. The standard defines several types of inverse time protection, including standard inverse, very inverse, long inverse, and extremely inverse. Inverse curves are often encountered with Inverse definite minimum time (IDMT). The inverse time relay must not operate when the line is connected to the maximum load. Current setting (ampere), I set , must be greater than the maximum I FL . The condition can be explained as In the overcurrent relay, the pickup current value is determined by selecting the tap value by calculating I set divided by the primary CT.
The overcurrent relay can be set according to the different current levels. This relay mode can cut off the fault closest to the fault, according to t delay . The current level exceeds the setpoint I pickup decided at the same time or explained with definite curve.
The instantaneous overcurrent relay works instantly if there is an overcurrent flowing beyond the permissible limit without time delay, t delay . The processing speed is 0.1 s. Generally, it can be less than 0.08 s. The relay works with consideration of short circuit faults in a short time. Table 1 shows the constant parameters used in the settings [33], [34], [35]. The following equation describes the mathematical model for inverse-time curves, where t d is operating time (s), q is time multiplier setting, I is current fault level (ampere), α, β and L are coefficient inverse. q represent KMS for IEC, and TD for IEEE. The instantaneous overcurrent relay will work if there is an overcurrent flowing beyond the permissible threshold. Before determining the parameters, performing a minimum shortcircuit analysis, I scmin , is necessary which occurs when there is a phase-to-phase short circuit with minimum generation. The parameters used are I set ≤ 0.8 × I scmin .
Coordinated overcurrent protection relays are very useful for protecting distribution networks because these relays are designed to operate when currents reach high levels during abnormal events. This high current value is used to calculate the parameters for adjusting the overcurrent relay. The specified current and time are reversed against the current protection as shown in Fig. 3. The specified current protection is applied without any intentional delay. Therefore, the coordination is based on the current. On the other hand, a particular time relay is used for time-based coordination with identical pickup currents from all relays.

D. FEATURES OF THE PROPOSED SMART METER
The principle of parallel work in the software and microcontroller can regulate the process of reading the load current on each line phase in parallel. The purpose of parallel work is apart from measuring the power quality of the device on the network. At the same time, the device also operates as electrical protection. Fig. 4 describes the power quality monitoring algorithm and the protection function in detail.
The protection function requires a faster access time specification than the power quality function. Quickly reading the waveform on every change in measurement parameters using a high-resolution and high-speed ADC is necessary. The power quality measurement uses the digital signal processor ADE 7880 [37]. The microcontroller manages the load current reading process in parallel through the ADC changer chip and the reading of power quality parameters through the ADE chip. Current readings are carried out using a waveform model to read changes within 0.5 cycles with RMS results.
The process runs when the 'run' button is pressed after going through the sensor checking and calibration conditions. The user is in the initial 'home' display before and after carrying out the setting and device activation processes. Device activation conditions or 'run device' can be explained as follows:

1) An internet connection and an real time clock (RTC)
connection support device communication. Measurements are made every second. Then, the process of sending and storing data is performed. The reset process can be performed by resetting the device. The connection between the device and the server is made using the HTTP scheme. After the connection appears between the datalogger and the server, the process of sending data follows. The process of sending data is carried out according to user needs. This type of data storage uses dedicated server platforms and clouds. Using the platform gives users high accessibility and cost-effectiveness because they can observe parameters monitored online without considering data storage and maintenance facilities. There is SD Card support as an external storage backup. 2) The power quality parameters are read with the ADE chip with input current and voltage at each phase using signal conditioning. The results of processing current and voltage signals into power quality parameters are fully carried out by the ADE chip and grouped and processed for notification according to user settings. Users can view voltage RMS, current RMS, power factor, and frequency measurements, with a data send interval of 30 s to 60 s. In addition, each phase has a function for reading Watt, VA, VAR, THDv, and THDi.
3) Device setting conditions or 'device settings' can be described as power quality monitoring settings. There is a selection of the phase being measured and a selection of Current transformer (CT) and Voltage transformer (VT) sizes. The user can select the processing time of the short circuit current waveform, from 1/4 to 1 cycle. Furthermore, in the digital protection settings, there is a selection of settings for 50 and 51 protection. Relay settings, such as i, i set , and q, refer to the ANSI/IEEE and IEC standards for overcurrent relays listed in Table 1. The last part is the selection of the communication module that will be used by the user using the GSM or RS485 network options to support the process of synchronizing the work of the device with the internet network.

E. CONFIGURATION OF ENERGY STORAGE AND METHANOL BATTERY USAGE
The methanol battery uses Efoy 2400 fuel cell products. The voltage capacity used is 24 V integrated with the controller [38]. The integrated controller monitors the battery charge level and automatically recharges when needed. The battery will turn off again when the battery is full. This means that the user will always be able to save energy and protect the battery from damage due to continuous charging. Efoy is a fuel cell based on the direct methanol fuel cell (DMFC). The device converts chemical energy into electrical energy without compromising stages and efficiency. The methanol cartridge is filled with oxygen from the air and used to generate electrical energy. The resulting output is hot air and water with a small amount of carbon dioxide. An inverter is needed to operate with general electronic equipment. The power-generating cores are stacked. This device consists of individual cells consisting of a cathode and a membrane. The membrane, which acts as the electrolyte, separates the anode and cathode sections. Positive electrical particles are known as protons. These particles can diffuse across the membrane.
The anode side includes water and methanol, while the cathode includes oxygen from the surrounding water. The anode undergoes a reaction to produce free electrons, H+ ions, and the reaction product CO 2 . Electrons move from the anode to the cathode, thereby producing electricity. At the cathode, H+ ions, oxygen from the air, and electrons are converted to water vapor.
The battery weighs 6 to 8 kg, with dimensions of 448 × 198 × 275 mm. The methanol cartridge contains 10 liters of methanol with a power capacity of 11.1 kWh. The use of methanol is quiet and environmentally friendly because it produces small amounts of carbon dioxide and water. In addition, it has low vibration and quiet operation without generating high heat. Unlike batteries, methanol battery placement does not require special conditions, so it is more flexible. Fig. 5 shows IoT configuration and implementation for mini-house from photovoltaic (PV) and battery to load. Electronic devices calculate and transmit data from radiation, while data are sent based on the IoT. An internet connection  can provide access to mobile monitoring. A CT [39] connects the device to the line grid for measurement. Four solar panels are used on the generation side, each with a capacity of 240 Wp and a voltage of 12 V. Then, there is a solar charge controller based on Epever MPPT with specifications of 40 A and 24 V [40]. The electricity from the controller then goes into a 1000 watt inverter with a voltage of 24 V [41]. The circuit configuration is arranged in parallel with the LiFePO4 and methanol batteries. Both devices serve as green energy alternatives. The LiFePO4 battery is 100 Ah, with a voltage of 25.6 V. The methanol battery is 350 Ah with a voltage of 24 V.

III. RESULTS AND ANALYSIS A. PROTOTYPE CALIBRATION AND TESTING
The research began by making a prototype of the device and the proposed algorithm. Fig. 6 shows the layout of the components installed in the device. The microcontroller used is STM32F407VGT6 32 bit, which works as a central processing unit. The power meter processor is ADE7880 so that the reading voltage does not exceed the input voltage of the analog-to-digital signal converter in signal conditioning. There is an ATMEGA2560 to help the STM32 microcontroller communicate with other peripherals, including SIM800L. The voltage consumption is 85-264 VAC, with a maximum power consumption of 15 Watts. Frequency 40-70 Hz. The current per phase is measured in the range of 0 to 5 A for direct measurement when using CT. The fundamental frequency is 45-55 Hz. THDi and THDv measure harmonics 1 and 2, with a 0-100% value. The GSM communication used works in the 800/1900 MHz range, with the GSM Sim 800 L type. There is an ethernet option using RJ45. USART serial communication is also used on the device. The internal screen uses a 16 × 4 LCD and eight buttons for the user interface, while the external screen can be accessed using the internet network for each computer or gadget. Storage media on the device is a MicroSD card of up to 8 GB. There is a battery holder for an RTC to store the date and time of power quality measurement results. Overall, the device dimensions are 299 mm long, 1.54 mm wide, and 28 mm high. With portable dimensions, the size of a hand, it can be carried, or the user can put it on a panel or wall. Fig. 7 represents Power Quality Monitoring and Protection Device Components during the calibration process. The device is calibrated within the normal operating range. The level of accuracy and features of the device are tested with variations in voltage and current. The device used in the calibration process is the Fluke 5500 [42]. Fig. 8 describes the measurement of the prototype compared with the standard calibration meter in (a) Voltage, (b) Current. The measured voltage is in the 150 V to 240 V range, and the current is in the 1 A to 11 A range. The voltage and current calibration errors are lower than 0.36 V and 0.19 A, respectively.

B. EXPERIMENTAL RESULTS IN MICROGRID
Experimental devices are divided into microchip-based boards, energy storage, and solar energy harvesting. Overall, Table 2 discusses materials in power quality and protection of devices connected to microgrids. Electrical devices that can be installed on the network include Incandescent Lamps, Fluorescent Lamps, Laptops, and Fans with a default voltage of 220 V AC. Table 3 compares the results obtained from prototypes and standard meters, which are almost equivalent. The measured voltage and current range of 228 V to 222 V, and 0.52 A to 0.22 A, respectively. There is a power factor (PF) measurement, where the smallest value is the Fluorescent Lamp load of 0.86, followed by the Fan, 0.92, and the Laptop, 0.93. While measuring power, it was found that laptops had the highest power consumption. The largest error is 1.72% on fluorescent lamps, while the smallest is 0.28% on laptops. The average error of several tests in the mini-house is 1.06%. With the range of measurement errors in household devices, the power meter can still operate similarly to the standard measurement. The prototype was installed in mini-houses connected to a renewable energy network, which represents a microgrid. This test was carried out by considering the electrical loading and energy generated from solar panels, batteries, and methanol. Fig. 9. (a) is the placement of prototype devices, converters, inverters, and energy storage, as well as testing on the building's rooftop during operation (b) during the day and (c) at night. From the test results on the proposed parallel concept, the logger can monitor and send data at certain periods according to user needs. The experiment, was carried out every 3 minutes. In addition, the protection configuration can still operate.
The PV module, controller, and energy storage were installed in one location, as shown in Fig. 9. A lighting load was installed by a lighting network and a mini-house representing the houses in the distribution network. Devices can be monitored in real-time on a website. Most loading occurs at night. The loads tested on the network include incandescent lamps, fluorescent lamps, laptops, and fans.
The results of the protection test were also carried out to test the device notification in overload current and short circuit fault conditions, as shown in Fig. 10. In testing, the ID of the device is TEST0001. The appearance of the main settings of the relay shows (a) the main settings for digital protection and (b) the main menu settings for digital protection. Then, the user can set modes 50 and 51 protection. In the experiment, (c) an instantaneous setting of 7 A was performed. For part (d) inverse B, TMS/TD or q was set to 0.5 s, and (e) pickup current, i set , was 4 A. Arrangements can also be made through the website. When an interruption occurs, the relay can work and bring up notifications on the device and website from the relay. The test results suggest that power quality and protection functions can work in parallel.
During the experiment, IoT data loggers and monitoring transmitted data accurately according to predetermined user time settings. The device provided analysis to the user. Parameters were displayed on the internal screen on the device and the external screen on the web. The device sent a notification on the web and device layers to the user with a notification of line disconnection. In the mini-house network experiments, several faults arose when access to the server failed due to server connection factors. The error resulted in the loss of measurement data for several hours. However, the system worked after the server problem was resolved. Data was sent and stored again. Then, to increase device reliability, users prefer to use internet transmission using 3G/4G cellular communication network transmission rather than cable internet access. Fig. 11 shows the work response of the device in terms of (a) voltage, (b) current, (c) harmonics, (d) power factor, and (e) frequency in the network. A solar controller with the maximum power point tracking (MPPT) technique is used in the test period. The system can run well from July 2022 to February 2023, with various local temperatures and irradiance. Samples were taken on January 11 and 12, 2023. IoT data loggers and monitoring transmitted data accurately according to predetermined user time settings.
The proposed device is used to protect the device side of renewable energy sources and energy storage from short circuit faults and overcurrent electric loads, particularly in specific current characteristics. Along with protection, power quality features on the device can be an alternative to complement monitoring parameters in microgrid networks.

IV. CONCLUSION
The purpose of this study was to develop an IoT-based microgrid intelligent power meter connected to a data logger for remote monitoring. The study established that the features and reliability of the proposed device have advantages over other power meters. Compared to other devices, this type has the advantages of power quality measurement, such as power factor, frequency, harmonics, and power protection. This feature can increase the advantage of monitoring loads connected to the network, so users can make parallel decisions in maintaining network security and quality. Testing was carried out with a standard calibration measuring instrument. The voltage and current calibration errors are lower than 0.36 V and 0.19 A, respectively. The average error obtained from the power meter from several experiments with devices installed in the mini-house is lower than 1.06%. It also provides additional features, namely, control, and monitoring of IoT power, which can be monitored on the internal screen of the device directly or externally through the website. This improves the benefit of monitoring the load connected to the network, so users can make parallel decisions in maintaining network security and quality. For the reliability test, device testing used an electricity meter on a network connected to renewable energy in real-time. The test network was connected to solar cells incorporating LiFePO4 and methanol batteries. The device can work for a span of half a year. The design is expected to be considered for installing IoT and renewable energy storage in solar systems globally on distribution electricity networks.
In the future, this study may be extended to reduce energy consumption by power monitoring and develop solutions for the connection quality of internet services in developing countries and remote areas. Work that can be done includes reducing coding, bandwidth management, implementing load demand management, and utilizing LoRA to achieve power consumption savings. In addition, it is possible to implement new schemes for network short-circuit protection and prevention of electricity theft in distribution networks using multiple monitoring devices.