Professional Documents
Culture Documents
Smart Meter Development For Cloud Based
Smart Meter Development For Cloud Based
OF ELECTRONIC SCIENCE AND TECHNOLOGY, VOL. 18, NO. 4, DECEMBER 2020
Digital Object Identifier: 10.11989/JEST.1674-862X.90616103
Article Number: 90616103
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: ycchenster@gmail.com; sandinoberutu@gmail.com).
Y.-H. Wang is with the Department of Computer Science and Engineening, National Chung Hsing Unversity, Taichung 32001
(e-mail: qwerbakecool80001@gmail.com).
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.
ADC
processed by an analog-to-digital converter ZMPT- Smart plug
101B
(ADC)—Arduino[8]. By employing the universal Arduino Mega
asynchronous receiver/transmitter (UART) transmission, ACS712
UART
the signal is transmitted to a node micro-controller unit
(NodeMCU)[9] device based on ESP 8266 WiFi. This
NodeMCU Appliances
device transfers data, using a transmission control
protocol (TCP)[10] connection, to a server which is built
WiFi
applied to filter out the noise and high harmonics. Platform Platform
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
Analyze
Start charting Display data
all exceptions
No Yes
Normal?
Fig. 2. Flowchart of the proposed home electricity monitoring system.
R
220 V into an acceptable value range for the Arduino
C r
controller. In Fig. 3, the variable resistor (r) adjusts the R′
AC-input voltage. In this way, a user can manually vary U1=0 to 1000 V −
this voltage. The output voltage can be adjusted to an ZMPT101B
+
0P07
U2
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 Fig. 3. Schematic diagram of the ZMPT101B sensor
equivalent voltage is ≤ 100 V, the current is I = 2 mA, 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
Voutput,max ′ 3.5
R= R = √ × 60000 = 1.35 kΩ. (1)
Viutput,max 110 × 2
CHEN et al.: Smart Meter Development for Cloud-Based Home Electricity Monitor System 381
voltage using a formula to obtain the real current value 3.5
Vout (V)
ACS712 as a linear function of the actual current (Ip) is 2.5
shown in Fig. 4. 2.0
According to Fig. 4, the output voltage can be 1.5
written as follows: 1.0
0.5
1
Vout = Ip + 2.5 (V) (2) 0
15 −30 −20 −10 0 10 20 30
Ip (A)
where −30 A ≤ Ip ≤ 30 A . The Arduino ADC resolves
1 bit to 10 bits (0 to 1023), and the Hall-current 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). (3)
1023
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.
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
1 kHz was used in the Arduino ADC module, the 400
Sampling period Y
Y=c+aX
350
3.315 kHz, 2.823 kHz, and 2.459 kHz, respectively.
Using the linear regression theorem[17], the relationship 300
between the programmed delay time (X) and sampling
250
period (Y) was obtained as follows:
200
Y = c + aX (4)
where c = 39.12601 and a = 1.050209. 150
150 200 250 300 350
In this work, the sampling frequency was set to Delay time X
3 kHz according to the relationship between the delay Fig. 5. Relationship between the delay time (X) and
time (X) and sampling period (Y) in Fig. 5. The Arduino sampling period (Y) in the Arduino ADC module.
ADC delay time should be set to 280 μs.
Vrms = ∑ Vi 2 /m (5)
i=1
m √
Irms = ∑ Ii 2 /m (6)
i=1
200
the amplitude of the current at point i, and m is the
100
Voltage (V)
sampled points per cycle.
In our experiments, the 4-cycle voltage signal 0
0 50 100 150 200 250
(200 points) with 50 equal portions per cycle, which is −100
acquired by the Arduino ADC, is shown in Fig. 6, and −200
the variation of RMS values (Vrms,slide (i)) of this signal is
Point number i
also shown in Fig. 6. In addition, RMS can be utilized to Fig. 6. Voltage signal and its RMS value obtained using
measure the PQ disturbances related to the voltage 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
200
(50 points) is less than the sampling points per cycle. 150
current variations can be expressed as follows:
Voltage (V)
50
n−m+1 i+m−1 √ 0
Vrms,slide (i) = ∑ ∑ Vj /m
101
111
121
131
141
151
161
171
11
21
31
41
51
61
71
81
91
1
2
(7) −50
i=1 j=i
−100
√
n−m+1 i+m−1
Irms,slide (i) = ∑ ∑ Ij 2 /m
−150
(8)
i=1 j=i −200
Number of points
where i = 1, 2, ⋯, n − m + 1; j = i, i + 1, ⋯, i + m − 1; Voltage without hair dryer Voltage with hair dryer
Vrms without hair dryer Vrms with hair dryer
n = 200 is the number of total points of the acquired
signal, and m = 50 is the total number of sampled Fig. 7. Voltage waveform and variation of its RMS value
points per cycle. when the hair dryer is turned on and off.
Assuming a hair dryer with the specified power
15
consumption of 8 W as a load, the voltage and current
RMS values when the hair dryer is turned on and off 10
are listed in Table 2.
By implementing the formula in (2), (3), (7), and (8), 5
Current (A)
And A(i) and B(i) can be expressed as follows:
i+m−1
i+m−1
where vi is the ith sample value of the signal, m is the number of samples obtained by a fundamental
frequency period, and ψ = (ωa Ta )/m = 2π/m with ωa being the angular frequency of the fundamental
frequency and Ta being the sampling period.
Practically, the cosine and sine signals in (7) can be represented as a vector with the length of m:
The vector of signal samples is expressed as follows:
SAMs = [v1 , v2 , v3 , v4 , v5 , ⋯, vn ] .
T
(12)
200 15
10
2.7. Zero-Cross Algorithm 100
Current (A)
5
Voltage (V)
important indicator of the reliability, safety, and −200 Number of points −15
economy of the power line system. In this paper, the Voltage (before filter) Voltage (filtered)
zero-cross algorithm[17] is applied to evaluate the Current (before filter) Current (filtered)
200
This number is divided by the constant sampling time 150 i point
100 i+m point
slot (Ts) of the Arduino ADC, and then the frequency is
Voltage (V)
between the zero points of a cycle that cannot be counted and are included in the points measured. As shown in
Fig. 11, the segment δ 2 is in the right portion of the point i−1 to point i and δ 3 in the left portion of the point i+m to
point i+m+1, which is not an integer point. For the accurate measurement, the cycle time of this sampled signal
must be expressed as follows:
T = mTs + δ 2 + δ 3 = (
δ2 + δ3
+ m) Ts = mA Ts (15)
Ts
where T is the period of the sampled signal, mA is the accurate number of sampling points between the zero
points of one cycle, and Ts is the sampling time slot of the Arduino ADC.
Trigonometric yi+m+1
yi+1 yi+k−1
yi+k
……
yi
Voltage (V)
θi−1 θi+k−1
0 Ti+(T/2) θi+m Ti+1 θi+m+1
Ti θi θi+1 θi+k θi+m−1
δ2 δ4
yi+m−1 yi+m
Δθ
yi−1
δ1 δ3
Point number i
Fig. 11. Schematic diagram for the zero-cross algorithm.
Using a similar triangle principle, mA can be expressed as
∣yi ∣ ∣yi+m−1 ∣
∣yi ∣ + ∣yi−1 ∣ ∣yi+m−1 ∣ + ∣yi+m ∣
mA = m + + (16)
where yi−1, yi , yi+m−1, and yi+m are the magnitudes of the (i − 1)th, i th, (i + m − 1)th, and (i + m)th points,
respectively. The accurate frequency of the signal can be estimated as
1
f= . (17)
mA Ts
2.8. PF Calculation
The PF algorithm calculates the amplitude of the phase difference between two waveforms[18]. In electrical
engineering, PF of an AC electrical power system is defined as the ratio of the real power absorbed by the load to
the apparent power flowing in the circuit, and it is a dimensionless number in the closed interval of [−1, 1]. This
study aims at notifying users of the existence of a low-PF problem as well as understanding the performance of
electrical appliances, so as to consider whether it is necessary to replace or maintain the equipment. When PF is
too low, the current required to generate the same output power increases. As the current increases, the energy
loss in the circuitry increases, and the damage or the probability of the wires and associated electrical equipment
getting burned increases.
386 JOURNAL OF ELECTRONIC SCIENCE AND TECHNOLOGY, VOL. 18, NO. 4, DECEMBER 2020
1
8
15
22
29
36
43
50
57
64
71
78
85
92
99
106
113
120
127
134
141
148
exists. This is because the sample point is not exactly
located in the valley of both the voltage and current
waveforms, as shown in Fig. 12.
Since the number of sampling points per cycle is Fig. 12. Schematic for phase determining.
close to 50, one point error of the points counted
The GO language server is set up to process the Transmit signals by UART
Arduino NodeMCU
data transmitted by NodeMCU and stores the data in a
Start
example, the number 713 is represented by binary
digits as 0010 1100 1001. The high-bit part is 0010 Data
and the low-bit part is 1100 1001. The low-bit part is Convert data to binary
extracted using the AND logical operator by
comparing 0xFF values. Finally, the data are stored High-bit (8 bits) Low-bit (8 bits)
in an array and then transmitted to the GO server.
Low-bit=(Low-bit AND 0xFF)
Using this method, the size of the 713 integer
type—4 bytes can be reduced to 2 bytes. This
Store high-bit and
increases the WiFi transmission speed and reduces low-bit into array
the burden. According to the example, the high-bit
Receive data array by GO server
decimal value is 2, whereas the low-bit decimal value and store data as JSON format
is 201. The high-bit and low-bit parts are stored in
Using this formula to obtain original value
the server. The original value in the client side can by computing (256×the high-bit+the low-bit)
be obtained by calculating (256 × the high-bit +
the low-bit ). Based on this example, the result is 713. End
A hardware device (shown in Fig. 18) and software
were built and implemented to monitor home
appliances.
The measurement results obtained from the
proposed monitoring device are displayed through a
web page. This page contains information, such as the
real frequency, RMS voltage, RMS current, PF, degree
per second, degree per hour, alarm (an early warning
system based on PF), and charts (RMS voltage, RMS
current, phase difference, and PF). The web page
display is shown in Fig. 19. Fig. 18. Hardware of the monitoring device.
Fig. 19. Measurement and calculation displayed on a web page for a hair dryer.
Table 4: Comparison between HIOKI and the proposed system
4. Conclusion
In this paper, a household electricity-measurement system based on IoT was developed to monitor the voltage,
CHEN et al.: Smart Meter Development for Cloud-Based Home Electricity Monitor System 389
current, and PQ factor. The limitation of the Arduino related to data transfer was handled by NodeMCU (TCP
communications technology). An approach in the NodeMCU coding was used to decrease data loading by
implementing binary conversion and then dividing the data into high-bit and low-bit parts. Furthermore, the filtering
model was adopted to filter the noise and achieve the filtering effect. After filtering, the real frequency calculation
was performed, and the zero-cross algorithm was applied to calculate the total period of one cycle, which was
divided by the sampling frequency to obtain the real frequency value. PF used three variables to find the trough in
one cycle, applied the formula to calculate the phase, and then determined the phase difference. PF was
calculated using the cos (Φ) formula. Finally, by comparing the proposed system and HIOKI, an IoT system at a
low cost, which has the same function as the HIOKI measurement device, can be established.
Acknowledgment
The authors gratefully acknowledge the helpful comments and suggestions of the reviewers for improving the presentation.
Disclosures
The authors declare no conflicts of interest.
References
[1] United News Network. (January 2018). [Online]. Available: https://unitednewsnetwork.com.
[2] A. Čolaković and M. Hadžialić, “Internet of things (IoT): A review of enabling technologies, challenges, and open
research issues,” Computer Networks, vol. 144, pp. 17-39, Oct. 2018.
[3] L. Morales-Velazquez, R. de J. Romero-Troncoso, G. Herrera-Ruiz, D. Morinigo-Sotelo, and R. A. Osornio-Rios,
“Smart sensor network for power quality monitoring in electrical installations,” Measurement, vol. 103, pp. 133-142,
Jun. 2017.
[4] Y.-C. Chen, H.-Y. Shen, H.-Y. Chen, and C.-H. Hsu, “Low cost Arduino DAQ development and implementation on an
Android app for power frequency measurement,” in Proc. of Intl. Symposium on Computer, Consumer and Control,
Xi’an, 2016, pp. 99-102.
[5] Y.-C. Chen and J.-K. Lan, “Implementation of power measurement system with Fourier series and zero-crossing
algorithm,” in Proc. of Intl. Symposium on Computer, Consumer and Control, Taichung, 2014, pp. 601-604.
[6] I. Abubakar, S. N. Khalid, M. W. Mustafa, H. Shareef, and M. Mustapha, “Calibration of ZMPT101B voltage sensor
module using polynomial regression for accurate load monitoring,” ARPN Journal of Engineering and Applied
Sciences, vol. 12, no. 4, pp. 1076-1084, Feb. 2017.
[7] L. Li, Y.-Z. Chen, H.-P. Zhou, H.-X. Ma, and J.-P. Liu, “The application of hall sensors ACS712 in the protection
circuit of controller for humanoid robots,” in Proc. of Intl. Conf. on Computer Application and System Modeling,
Taiyuan, 2010, pp. V12:101-103.
[8] M. Margolis, Arduino Cookbook, Farnham: O’Reilly Media, 2011, pp. 133-135.
[9] M. Kashyap, V. Sharma, and N. Gupta, “Taking MQTT and NodeMCU to IoT: Communication in Internet of things,”
Procedia Computer Science, vol. 132, pp. 1611-1618, 2018, DOI: 10.1016/j.procs.2018.05.126.
[10] Y. Qin, W.-H. Yang, Y.-B. Ye, and Y. Shi, “Analysis for TCP in data center networks: Outcast and Incast,” Journal of
Network and Computer Applications, vol. 68, pp. 140-150, Jun. 2016.
[11] Golang. (December 2017). The GO programming language. [Online]. Available: http://www.golang.org.
390 JOURNAL OF ELECTRONIC SCIENCE AND TECHNOLOGY, VOL. 18, NO. 4, DECEMBER 2020
[12] S. H. Cho, C. H. Park, J. Han, and G. Jang, “A waveform distortion evaluation method based on a simple half-cycle
RMS calculation,” IEEE Trans. on Power Delivery, vol. 27, no. 3, pp. 1461-1467, Jul. 2012.
[13] Hioki. (January 2018). Clamp on power logger PW3360. [Online]. Available: https://www.hioki.com/en/products/detail/
?product_key=5589.
[14] Datasheetspdf. (December 2017). ZMPT101B datasheet. [Online]. Available: https://datasheetspdf.com/pdf/1031464/
ETC/ZMPT101B/1.
[15] Google. (January 2018). Arduino: The Arduino DAQ chronicles. [Online]. Available: https://sites.google.com/
site/measuringstuff/the-arduino.
[16] Yet Arduino Blog. (November 2017). [Online]. Available: http://yaab-arduino.blogspot.com/2015/02/fast-sampling-
from-analog-input.html.
[17] H.-Y. Shen, Y.-C. Chen, and C.-H. Hsu, “A power frequency sensing device using an Arduino device and zero-
crossing algorithm and its implementation on Android app,” Sensors and Materials, vol. 29, no. 6, pp. 741-756,
Jun. 2017.
[18] L. Sarıbulut, “A simple power factor calculation for electrical power systems,” Intl. Journal of Electrical Power &
Energy Systems, vol. 62, pp. 66-71, Nov. 2014.
[19] National Instruments. (October 2017). [Online]. Available: http://www.ni.com/examples/.
Yeong-Chin Chen received the M.S. and Ph.D. degrees in electrical engineering from National
Cheng Kung University, Tainan City in 1989 and 1998, respectively. He worked with the Underwater
Technology Department, National Chung Shan Institute of Science and Technology, Taoyuan from
1989 to 2000, as a senior researcher. He is currently a professor in computer science and
information engineering with Asia University, Taichung. His research interests include acoustical
transducer engineering, power signal measurement & analysis, automatic measurement, and
software engineering. In recent years, his research has also been focused on smart power meters
implemented on the Internet of things (IoT) platforms for big-data power saving management
applications.
Sunneng Sandino Berutu was born in Salak in 1977. He received the B.S. degree in computer
science from University of Christian Immanuel, Yogyakarta in 2000 and the M.S. degree in
information system from University of Diponegoro, Semarang in 2013. He is currently pursuing the
Ph.D. degree with the Department of Computer Science and Information Engineering, Asia
University. His research interests mainly focus on IoT and power quality.
Yue-Hsien Wang was born in Taichung in 1996. He obtained his B.S. degree in engineering of
information science from Asia University in 2018. He worked as a software engineer and developed
an IoT website for handling electricity data. Now, he is pursuing his M.S. degree with the
Department Computer Science and Engineering, National Chung Hsing University, Taichung. His
research interest focuses on loT smart meters.