Title | Smart Meter Development for Cloud-Based Home Electricity Monitor System |
---|---|
Author | Sandino Berutu |
Pages | 13 |
File Size | 4.6 MB |
File Type | |
Total Downloads | 65 |
Total Views | 142 |
378 JOURNAL OF ELECTRONIC SCIENCE AND TECHNOLOGY, VOL. 18, NO. 4, DECEMBER 2020 Digital Object Identifier: 10.11989/JEST.1674-862X.90616103 Article Number: 90616103 Smart Meter Development for Cloud-Based Home Electricity Monitor System Yeong-Chin Chen* | Sunneng Sandino Berutu | Yue-Hsien Wang ...
378
JOURNAL OF ELECTRONIC SCIENCE AND TECHNOLOGY, VOL. 18, NO. 4, DECEMBER 2020
Digital Object Identifier: 10.11989/JEST.1674-862X.90616103 Article Number: 90616103
Smart Meter Development for Cloud-Based Home Electricity Monitor System Yeong-Chin Chen* | Sunneng Sandino Berutu | Yue-Hsien Wang Abstract—Α cloud-based home electricity data-monitoring system, which is based on an Arduino Mega controller, is proposed for monitoring the electricity consumption (electrical power) and power quality (PQ) in home. This system is also capable of monitoring the fundamental frequency and supply-voltage transients to ensure that the appliances operate in a safe operation range. The measured data (voltage and current) are transmitted through a WiFi device between the Arduino controller and server. The transmission control protocol (TCP) server is set up to acquire the high-data transmission rate. The server system immediately displays the calculated parameters and the waveform of the acquired signal. A comparison with a standard measurement device shows that the proposed system, which can be built at a low cost, exhibits the same functions as a factory product. Index Terms—Arduino controller, cloud, electrical power, power monitoring, transmission control protocol (TCP) server, WiFi.
1. Introduction According to the statistics of Taipower, 24000 high-voltage consumers, who currently account for 60% of the total electricity consumption in Taiwan, have installed smart meters. However, general-public users are not willing to install these meters due to the high cost and need to send an application to Taipower before the installation. The procedures are complicated and involve many communications problems. The government expected an installation[1] of 200000 smart meters by September 2018. However, only 150000 were completed. In recent years, the power deficit has become enormous during summer. This problem results in power-supply units surging, electricity charge rate issues, power waste issues, and even worse, the endless argument on the non-nuclear power-supply issue. However, since the power output cannot be increased immediately, the electrical power management for the efficient use of electricity has become an extremely important issue. The Internet of things (IoT)[2] is a revolutionary technology capable of achieving sensing integration as well as communications capabilities between common devices. IoT has enabled various devices to be used for monitoring *Corresponding author Manuscript received 2019-02-26; revised 2020-11-23. This work was supported by MOST under Grant No. 106-2221-E-468 -011-MY2. Y.-C. Chen and S. S. Berutu are with the Department of Computer Science and Information Engineering, Asia University, Taichung 41354 (e-mail: [email protected]; [email protected]). Y.-H. Wang is with the Department of Computer Science and Engineening, National Chung Hsing Unversity, Taichung 32001 (e-mail: [email protected]). Color versions of one or more of the figures in this paper are available online at http://www.journal.uestc.edu.cn. Publishing editor: Yu-Lian He
CHEN et al.: Smart Meter Development for Cloud-Based Home Electricity Monitor System
379
important electrical, physical, and environmental parameters. This information is then used to analyze, identify, and solve various problems related to everyday life[2]. IoT has enabled power-monitoring devices to assist in solving this problem by providing valuable information on electricity consumption and power quality (PQ)[3], which includes the measurements of the fundamental frequency, the root mean square (RMS) of voltage, and the power factor (PF). In this way, the purpose of power savings and power safety can be achieved. Using the IoT smart power meters, the power consumption of various electrical appliances can be automatically measured, logged, and analyzed. This will also help in identifying major power consumers and promoting energy awareness in society. In this research, a power-monitoring system is proposed, which is based on a low-cost Arduino controller[4] and some electricity sensors with embedded IEEE 802.11 (WiFi) wireless communications. The instantaneous power signal (voltage and current) is wirelessly transmitted to a remote server for storage and analysis. A hypertext preprocessor (PHP) web program, which is developed to analyze the power signal data, simultaneously displays the analysis results, electrical power energy, electrical PF, and fundamental frequency[5] on the browser’s window. The user can retrieve statistically analyzed data stored on the server, using a computer or a smartphone over the Internet. An early warning system is also provided. This system sends a warning alarm to remind the user of a problem with the equipment when the electrical performance is out of the specified range. As an advanced future application, the server could also provide a big-data query and convert the queried degree into a form, with which the users can analyze the electricity consumption, thus improving the power-usage strategy of users. The rest of the paper is organized as follows. The research methods and materials are described in Section 2. The results and conclusion are presented in Sections 3 and 4, respectively.
2. Methods and Materials 2.1. Methods In this paper, the proposed system is schematically illustrated in Fig. 1. Initially, the alternating-current (AC) voltage is connected to ZMPT101B[6] and transmitted to the ACS712[7]
ADC
ZMPT101B
Smart plug
Arduino Mega ACS712 UART NodeMCU
Appliances
WiFi
Internet
GO server
Platform
JSON
socket to measure the current. Then, the signal is processed by an analog-to-digital converter (ADC)—Arduino[8]. By employing the universal asynchronous receiver/transmitter (UART) transmission, the signal is transmitted to a node micro-controller unit (NodeMCU)[9] device based on ESP 8266 WiFi. This device transfers data, using a transmission control protocol (TCP)[10] connection, to a server which is built with an open source programming language from Google (GO)[11]. Finally, the power consumption performance is monitored by a multiple-platform display. In this work, the signal’s frequency is detected and calculated by using the zero-crossing algorithm[5]. Then, the Fourier series algorithm[5] is applied to filter out the noise and high harmonics. RMS[12] is the effective value, which determines the electricity variation. PF is determined by the phase between the measured voltage and current signals. The power consumption is also calculated by using the
Server and database
Fig. 1. Proposed system architecture.
Platform
380
JOURNAL OF ELECTRONIC SCIENCE AND TECHNOLOGY, VOL. 18, NO. 4, DECEMBER 2020
RMS values of the voltage and current. The monitoring system flowchart is shown in Fig. 2. Finally, the results produced are compared with those obtained by a power measurement standard device (HIOKI PW3360)[13].
System start
System start
Transmission Alarm system
Arduino catches 400 signals data
Device side
System side
UART transmits NodeMCU receives data WiFi TCP transmits GO server receives data
Server side
JSON format Database stores data
PHP and JavaScript start data algorithm, statistics calculation, and catch data continuously
Analyze all exceptions
Start charting
Display data
Database stores time, site, and factor values at that time
Display web alarm system
Normal factor value calculation
No
Normal?
Database stores data
Start charting
Yes
Fig. 2. Flowchart of the proposed home electricity monitoring system.
2.2. ZMPT101B Voltage Sensor This sensor converts the AC voltage of 110 V to 220 V into an acceptable value range for the Arduino controller. In Fig. 3, the variable resistor (r) adjusts the AC-input voltage. In this way, a user can manually vary this voltage. The output voltage can be adjusted to an amplitude range of 0 to 5 V, which is acceptable by the Arduino controller. The rated operating current of ZMPT101B is between 1 mA and 2 mA. When the equivalent voltage is ≤ 100 V, the current is I = 2 mA,
R C R′ U1=0 to 1000 V ZMPT101B
− 0P07 +
r
U2
Fig. 3. Schematic diagram of the ZMPT101B sensor voltage.
whereas when the voltage is ≥ 220 V, the current is usually 1 mA ≤ I ≤ 2 mA to reduce the power consumed by the resistor. Based on the application guide of ZMPT101B[14], the variable resistor ratio should be adjusted according to ′ the experimental requirements. In this work, the current limiting resistor (R ) is set to 60 kΩ (110 V/2 mA) to make the input current less than 2 mA. If the maximum output voltage is set to 3.5 V, the sampling resistor R can be obtained from R=
Voutput,max ′ 3.5 R = √ × 60000 = 1.35 kΩ. Viutput,max 110 × 2
(1)
CHEN et al.: Smart Meter Development for Cloud-Based Home Electricity Monitor System
2.3. ACS712 Current Sensor
4.5
The Arduino controller receives only the output voltage. ACS712[7] converts the input current into voltage using a formula to obtain the real current value of a home appliance[8]. The output voltage (Vout) of ACS712 as a linear function of the actual current (Ip) is shown in Fig. 4. According to Fig. 4, the output voltage can be written as follows: Vout
381
4.0 3.5 Vout (V)
3.0 2.5 2.0 1.5 1.0 0.5
1 = Ip + 2.5 (V) 15
(2)
0 −30
−20
where −30 A ≤ Ip ≤ 30 A . The Arduino ADC resolves 1 bit to 10 bits (0 to 1023), and the Hall-current
−10
0 Ip (A)
10
20
30
Fig. 4. Graph of the output voltage vs. input current.
sensing module can be used to measure the current. As the Arduino acquires a value v, which is the output voltage of the current sensor, the sensing current can be obtained as follows: Ip = [(
v × 5) − 2.5] × 15 (A). 1023
(3)
When there is no current input, i.e. Ip = 0, the component itself will produce an output voltage of 2.5 V to the Arduino controller. 2.4. Sampling Frequency Determination The Arduino data-acquisition approach uses the analogRead(0) instruction to convert analog information into digital information (ADC module). The chip used in the Arduino is the ATMega chip[15]. Its oscillation frequency is 16 MHz, and its internal ADC prescaler select (ADPS) bit setting is shown in Table 1[16]. Table 1: Prescaler setting for the Arduino ADC Prescale
ADPS2 ADPS1 ADPS0
Clock frequency (MHz)
Sampling rate (kHz)
2 4 8 16 32 64 128
0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1
8.000 4.000 2.000 1.000 0.500 0.250 0.125
615.0 317.0 153.0 76.8 38.4 19.2 9.6
For the 16-MHz Arduino, if the default prescaler is set to 128 (16 MHz/128 = 125 kHz ) and the implementation of an ADC function requires 13 cycles, then the sampling rate in the Arduino ADC module could be theoretically up to approximately 9.62 kHz (125 kHz/13 = 9.615 kHz ). If the sampling accuracy is taken into account, the sampling frequency needs to be maintained more than ten times the frequency of the measured signal. Because the fundamental frequency of power signals is 60 Hz, and when multiplied by 25, the frequency of the harmonic wave is only 1.5 kHz. Thus the Arduino ADC module can sufficiently meet the requirement of this study. The estimation accuracy of the following zero-crossing algorithm can be maintained by tuning the Arduino ADC sampling frequency at 3 kHz. This can be achieved by inserting a time-delay instruction code to modulate the sampling rate according to the specifications. If the sampling rate is set to 3 kHz, the time slot between two adjacent samples will be 333 μm. Since the signal from the voltage and current sensors is received sequentially for each ADC loop, it will spend 104 μm between the adjacent voltage and current
382
JOURNAL OF ELECTRONIC SCIENCE AND TECHNOLOGY, VOL. 18, NO. 4, DECEMBER 2020
acquired data with the ADC sampling rate of 9.6 kHz. In our experiment, the voltage and current signals are assumed to be acquired at the same time that the prescaler’s setting is switched to 16 to make the ADC sampling rate equal to 76.8 kHz. This means that the ADC time delay reduces to 15 μs, whereas the voltage and current phase error of the power signal is reduced from (60 Hz/9.6 kHz) × 360 = 2.25 degrees to (60 Hz/76.8 kHz) × 360 = 0.28 degrees. The sampling frequency was evaluated by using a standard sinusoidal wave of frequency 1 kHz in the Arduino ADC module, and the delay times in the ADC loop were set to 150 μs, 200 μs, 250 μs, 300 μs, and 350 μs, respectively. The corresponding sampling points per period obtained with the zero-crossing algorithm were 5.085 points, 4.013 points, 3.315 points, 2.823 points, 450 and 2.459 points, respectively. Since a frequency of 400 1 kHz was used in the Arduino ADC module, the Y=c+aX sampling frequencies were 5.085 kHz, 4.013 kHz, 350 3.315 kHz, 2.823 kHz, and 2.459 kHz, respectively. 300 Using the linear regression theorem[17], the relationship between the programmed delay time (X) and sampling 250 period (Y) was obtained as follows: Sampling period Y
Y = c + aX
200
(4)
where c = 39.12601 and a = 1.050209. In this work, the sampling frequency was set to 3 kHz according to the relationship between the delay time (X) and sampling period (Y) in Fig. 5. The Arduino
150 150
200
250 Delay time X
300
350
Fig. 5. Relationship between the delay time (X) and sampling period (Y) in the Arduino ADC module.
ADC delay time should be set to 280 μs. 2.5. RMS Current Calculation RMS[12] is a mathematical method used to define the effective direct current (DC) value of a time-varying sinusoidal waveform (AC power), which produces the same heating effect as the equivalent DC power. For a sinusoidal waveform, which has m equal portions per cycle, its RMS value can be calculated as follows: m √ Vrms = ∑ Vi 2 /m (5) i=1 m √ Irms = ∑ Ii 2 /m
(6)
i=1
200 Voltage (V)
where Vi is the amplitude of the voltage at point i, Ii is the amplitude of the current at point i, and m is the sampled points per cycle. In our experiments, the 4-cycle voltage signal (200 points) with 50 equal portions per cycle, which is acquired by the Arduino ADC, is shown in Fig. 6, and the variation of RMS values (Vrms,slide (i)) of this signal is also shown in Fig. 6. In addition, RMS can be utilized to measure the PQ disturbances related to the voltage
100 0
0
50
100
150
200
250
−100 −200
Point number i
Fig. 6. Voltage signal and its RMS value obtained using the window-sliding method.
magnitude variations, such as the voltage drop, voltage sag, voltage swell, under-voltage, over-voltage, and interruption.
CHEN et al.: Smart Meter Development for Cloud-Based Home Electricity Monitor System
383
Table 2: RMS values of voltage and current
The variation of this signal’s RMS values is calculated using the window-sliding method. In this
Hair dryer state
Vrms (V)
Irms (A)
method, each RMS value is calculated from the
Off On
120.79 116.35
0 6.98
values in the window, and the window frame is
200
(50 points) is less than the sampling points per cycle.
150
The window-sliding RMS method for the voltage and
100
current variations can be expressed as follows: n−m+1 i+m−1
Vrms,slide (i) = ∑ ∑
Vj /m 2
(7)
j=i
−50 −100
n−m+1 i+m−1
√
Irms,slide (i) = ∑ ∑ Ij 2 /m i=1
0
−150
(8)
−200
j=i
Number of points Voltage with hair dryer Voltage without hair dryer Vrms without hair dryer Vrms with hair dryer
where i = 1, 2, ⋯, n − m + 1; j = i, i + 1, ⋯, i + m − 1; n = 200 is the number of total points of the acquired signal, and m = 50 is the total number of sampled points per cycle. Assuming a hair dryer with the specified power consumption of 8 W as a load, the voltage and current RMS values when the hair dryer is turned on and off are listed in Table 2. By implementing the formula in (2), (3), (7), and (8), the voltage and current signals and the variations of their RMS values are shown in Figs. 7 and 8, respectively. The experimental results show a current value close to zero as the hair dryer is turned off. The Irms value increases to 6.98 A, when the hair dryer is turned on. However, the voltage signal exhibits a small deviation when the hair dryer is turned on.
Fig. 7. Voltage waveform and variation of its RMS value when the hair dryer is turned on and off.
15
10
Current (A)
5
0
1 12 23 34 45 56 67 78 89 100 111 122 133 144 155 166 177 188 199
i=1
√
50 1 11 21 31 41 51 61 71 81 91 101 111 121 131 141 151 161 171
Voltage (V)
sequentially slide by 1 point until the number of points
−5 −10 −15
Number of points Current without hair dryer Current with hair dryer Irms without hair dryer Irms with hair dryer
2.6. Fourier Series Algorithm The voltage and current signals include noise. The harmonic signal involved will distort them from a pure sinusoidal wave. As a result, the accuracy of the
Fig. 8. Current waveform and variation of its RMS value when the hair dryer is turned on and off.
fundamental frequency and phase angle determination might be affected. The acquired power signal generally can be presented by a discrete Fourier series (DFS)[5],[16], expressed as follows: i+m−1
i+m−1
n=i
n=i
ωa Ta ωa Ta 2 V (i) ≅ m [ ∑ vn cos ( m n) − j ∑ vn sin ( m n)] = A(i) + jB(i) .
And A(i) and B(i) can be expressed as follows: i+m−1
2 A(i) = m ∑ vn cos (ψn) n=i
(9)
384
JOURNAL OF ELECTRONIC SCIENCE AND TECHNOLOGY, VOL. 18, NO. 4, DECEMBER 2020 i+m−1