Development and Calibration of a Low-Cost Electrical Measurement
Instrument
1GUILHERME CIT, 1JEAN G. MONTEIRO, 2TIAGO M. QUIRINO, 2JONATAS M. QUIRINO
1Estácio de Sá University, Av. Dom Hélder Câmara, 5474 - Cachambi, Rio de Janeiro, BRAZIL
2Rio de Janeiro State University, R. São Francisco Xavier, 524 - Maracanã, Rio de Janeiro, BRAZIL
Abstract: - The most modern technological advances are accompanied by more complex and sophisticated
demands of society. Among the main social demands, energy consumption is one of the factors with the highest
growth, but technologies related to the theme have not developed at the appropriate pace to the context, especially
observing that consumers have little or no information about their consumption data. The wide variety of
electronic equipment is evident, therefore, the development of a system that allows the user to monitor the energy
consumption of the equipment by only a low-cost sensor and with high precision is an interesting advantage. To
this end, it is proposed the implementation of artificial neural networks to increase the accuracy of
microcontrolled instrument connected via Wi-Fi, to provide reliable data that can be stored in the cloud and
present consumption in real time.
Key-Words: Artificial Neural Networks, Electrical Measurement, Self-adjust.
Received: November 12, 2022. Revised: June 16, 2023. Accepted: July 19, 2023. Published: August 11, 2023.
1 Introduction
The panorama of the measurement of electricity
consumption is on the pending of considerable
changes because the measuring equipment has not
accompanied the technological advance of the
electrical charges being measured. In the production
chain and supply of electricity to consumers, this
should be the point that needs further upgrades.
Microcontrolled electronic instrumentation systems
have solved several issues, in different areas, mainly
due to the possibility of intelligent instrumentation,
which can attribute the characteristic of self-
adjustment to instruments.
The growing attention to this subject can be noticed
by works published in recent years, which develop a
market analysis of the main trends in the use of smart
products, mainly for domestic applications, through
an economic perspective of social demand. [1] The
work [2] shows how the advancement of home
automation has awakened the need for
interoperability of the various devices that make up a
domestic "ecosystem" and what are the possible paths
of this trend.
While [3] had studied how the construction of a
domestic digital ecosystem would be able to
contribute to an increase in energy efficiency, later
studies, such as that of [4] developed a complete
system for monitoring and measuring electricity
consumption aimed at residential applications.
The creation of the concept of Home Energy
Management System (HEMS) is due to [5] and since
then it has grown and spread rapidly, giving rise to
various technologies, methods and devices, as
presented by [6].
The concept of Nonintrusive load monitoring
(NILM) was proposed by [7] and was applied by
several researchers, such as [8] who made a broad
review of NILM methods, mainly targeting
residential applications. The work [9] developed an
experimental work that delivers a device capable of
measuring electrical current data for residential
equipment.
The cost of electronic meters that can transmit data
online makes the implementation unfeasible,
however we seek techniques to improve the
performance of power meters without increasing the
cost of hardware, using machine learning algorithms
to self-adjust sensors and data with accuracy
comparable to more expensive equipment.
2 Problem Formulation
Energy is defined as the amount of work that a system
Energy can be defined as the amount of work that a
system is able to perform. In mathematical terms,
energy can be defined as the integral defined in a
International Journal of Electrical Engineering and Computer Science
DOI: 10.37394/232027.2023.5.14
Guilherme Cit, Jean G. Monteiro,
Tiago M. Quirino, Jonatas M. Quirino
E-ISSN: 2769-2507
129
Volume 5, 2023
power time interval. Thus, the energy measurement
is dynamic, varies with time.
Digital electronic instruments, such as analog
electronic instruments, depend on the use of PT and
CT to adjust current and voltage levels for readings.
The Figure 1 shows ideal sine waves from PT and CT
respectively, to voltage () and current (), as seen in
Figure 1.
Figure 1 – Period, phase deviation, RMS for voltage
and current sines.
In addition to conventional power system
transformers, auxiliary transformers are also
required, which provide decoupling between circuits,
and reduce signals to 5 V and 20 mA, so that such
signals are sampled and digitized by digital analog
converters (ADC). The voltage and current samples
are processed by algorithms to provide the values of
electrical quantities of the measurements.
From the samples it is possible to calculate: Phase
Difference, Current and Peak Voltage, Frequency,
Harmonic Components, Apparent, Active and
Reactive Powers and Energy Consumption.
To ensure the necessary accuracy in the
measurements, each step must be carefully adjusted
and calibrated.
The effective value is calculated by the RMS
equation (Root Mean Square), according to equation
1, for both current ([]) and voltage ([]) from
Figure 1, digitized.

󰇟󰇠
 
󰇟󰇠

(1)
The interpretation of the effective value of the signals
is the load that can be used by the equipment to
determine the consumption signature of the loads, as
shown in this work.
The electrical frequency is obtained by calculating
the voltage period ( = 1/). It can be set to 50 or
60 frequency, but some specific loads may change
the electrical frequency of the installation. Among
the variables, proposed to determine the signature of
consumption, it is hypothesized that frequency
variations should not effectively contribute to the
classification of loads.
The phase deviation () between the voltage and
current signals is characterized by the time difference
of the crossing of each signal at level zero. Therefore,
it is possible to calculate this parameter by a zero-
crossing detection algorithm, which provides the
moments when the voltage and current assume the
zero value ( and ).
󰇛󰇜
This parameter is variable and depends on the loads
connected to the installation, so it allows to
distinguish the consumption signatures. It is
interpreted as the relationship between the total
power supplied to the load system and the active
power, actually consumed, so from the phase
deviation it is possible to calculate. The apparent
power () is provided by the equation:

Therefore, from the phase deviation it is possible to
calculate the power factor () of the consumption:
󰇛󰇜
Active electrical power is an electrical parameter
derived from others, important to characterize the
input or output of an electrical installation
consumption equipment, given by:
󰇛󰇜
Microprocessors as well as other computational
components are increasingly easily accessible in
terms of availability, variety and cost. This ease
makes the implementation of electric energy
measurement systems more viable, thus generating
International Journal of Electrical Engineering and Computer Science
DOI: 10.37394/232027.2023.5.14
Guilherme Cit, Jean G. Monteiro,
Tiago M. Quirino, Jonatas M. Quirino
E-ISSN: 2769-2507
130
Volume 5, 2023
greater interest from society, as well as students and
the scientific community.
The choice of a low-cost measurement system
reflects the instrument's lower accuracy, as several
sources deform the measurements performed.
Especially the ADC.
3 Problem Solution
A microcontrolled prototype using the ESP32 board
was elaborated, with the objective of calculating
electrical parameters for different loads, because the
DEVELOPMENT PLCA ESP32 is low cost (~$
3.00), has internal ADCs and integrated Wi-Fi, but
depends on the installation of a PT and a CT still.
On the other hand, we considered the PZEM-004T
card, which has a slightly higher cost (~$ 20.00),
which has integrated PT and CT, but still depends on
another card for Wi-Fi connection.
It was noticed that in the ADC readings of the ESP32
board there were errors. This converter, according to
the datasheet, has a nonlinear response considering
the entire reading range, being a linear part, but
presenting considerable error in relation to the
reference instrument. Methods were developed to
measure the angle of lag between the sines, in which
it is necessary to assume a reference sample of the
sine for comparison. The search for the peak of the
node was chosen, because there are several
algorithms available that propose to this, so when the
maximum value sample of each node is found it is
possible to infer the time delay between them. Time,
in turn, is converted into phase by equation 2. Where
the phase deviation given in radians; delay time
between peaks; and the period of the senoid, which
uses the same peak detection algorithm, but in which
it is measured between the peaks of the same
󰇛󰇜
Esp32 receives sensor information and processed
data must be sent to a database via an ESP32
microcontroller card that has Wi-Fi communication
embedded, as represented in the flowchart in Figure
2.
Figure 2 – Instrument system of flowchart.
The PZEM-004T-V3 sensor consists of a current
transducer and a voltage transducer, both
nonintrusive.
The sensor reading circuit, represented in Figure 3,
allows the reading of current, voltage, power factor,
active power, apparent power, energy consumed and
frequency, such as the instrument proposed using the
ESP32 board.
Figure 3 – PZEM circuit diagram.
3.1 Neural Network Improvement to Self-
Adjust
Inspired by real neurons and with a massively parallel
scope of work, artificial neurons can be employed in
both software and hardware. A neuron, itself, has
limited capacity, however, by creating a set of these
artificial neurons, it is possible to create highly
powerful resources. The set of artificial neurons is
called an artificial neural network, as illustrated in
Figure 4.
Figure 4 – ANN Multilayer Perceptron.
For training the ANN Multilayer Perceptron, the
backpropagation technique is used, which consists of
two phases:
The first phase, called feed-foward, transmits
the input signals throughout the network, and
at the output the error found is calculated,
based on the expected and known target.
International Journal of Electrical Engineering and Computer Science
DOI: 10.37394/232027.2023.5.14
Guilherme Cit, Jean G. Monteiro,
Tiago M. Quirino, Jonatas M. Quirino
E-ISSN: 2769-2507
131
Volume 5, 2023
The second phase, called backpropagation,
occurs in the opposite direction, updating the
weights and connections.
It is in the second (reverse) phase that the weights of
each neuron are updated. For this activity, the
Levenberg-Marquardt algorithm is used, which was
developed to solve non-linear functions, using the
least squares method.
This algorithm proposes a compromise solution
between the gradient descent algorithm and the
Gauss-Newton iterative method, according to
equation 5 as a weight update rule.
󰇛󰇜󰇛󰇜
(6)
Where is the matrix of weights, is the training
epoch. The Hessian matrix is approximated by
󰇛󰇜, where is the Jacobian, the
adjustment factor, and  is the mean squared error
gradient for the epoch weight matrix.
3.1.1 Self-Calibration
Self-calibration or self-adjustment consists of
enabling the equipment in question, generally applied
to sensored systems, to be constantly adjusted during
use. This opens up a new horizon, when we talk about
reducing machine downtime, for carrying out
calibration/gauging procedures, directly reflecting on
costs. It is also important to point out that a properly
calibrated instrument offers greater reliability and
safety for the user.
This type of approach is only possible by concepts of
intelligent sensors, which are provided for in IEEE
1451 (“Standard for Transducer Interface for Sensors
and Actuators”).
It is at this point that, in many cases, ANN becomes
quite interesting.
Using the ANN method, described above, it is
possible to create an algorithm to carry out the self-
adjustment through prior knowledge of the pattern of
variation of the signal, that one wants to study, thus
making it possible to carry out corrections in real
time. Values from uncalibrated sensors are presented
to the ANN as a basis for training, and then the
expected value for a calibrated sensor is compared.
For this, the ANN training must be well planned,
before doing it, because if real situations that occur
beyond the limits stipulated in the training, may not
present the expected effectiveness.
To ensure a constant analysis of the functioning of
the sensor in question, the neural network must be
connected to the sensor, as shown in the generic
diagram in Figure 5.
Figure 5 – ANN series adjust.
4 Results
Two stages of application of the artificial neural
network were performed in this work, first to correct
the ADC of the ESP32 plate and later to reduce the
deviation of measurements of different loads by the
ESP32 plate.
4.1 ADC correction
After the error in the ADC of the board, a procedure
was elaborated to provide a linear ramp ranging from
0 to 3.3V, utilizing the integrated circuit MCP4725
and an external digital converter of 12bits, generated
a ramp. This ramp, which is the desired answer, was
applied to the ADC converter of the ESP32, and from
it the direct response was obtained, as shown in
Figure 6.
Figure 6 – Response ADC comparation.
The correction provided by the artificial neural
network is also presented in Fig.5. It is also perceived
with analysis of Fig. 6, that the correction of the
network was considerable, from the order of the
average of 3% average to 0.5%.
International Journal of Electrical Engineering and Computer Science
DOI: 10.37394/232027.2023.5.14
Guilherme Cit, Jean G. Monteiro,
Tiago M. Quirino, Jonatas M. Quirino
E-ISSN: 2769-2507
132
Volume 5, 2023
4.2 Instrument Correction
Similarly, the correction performed for the ADC, the
correction for the load readings was also performed.
For this, 6 different loads were used and their
waveforms were measured by the instrument
proposed in ESP32. At the same time the data were
obtained by the PZEM-004t card, with this the active
power and apparent power are taken as a reference
for parameterization of the weights of an artificial
neural network, which must correct the measured
data of the instrument with the ESP32 card.
The neural network must provide the corrected active
power and apparent power values, from the RMS
Voltage, RMS Current, Power Calculated Active and
Calculated Apparent Power. Therefore, it is defined
that artificial neural network architecture is 4 inputs
and 2 outputs, missing only the definition of the
amount of neurons in the hidden layer, in this sense,
the exhaustive search was made, testing the
performance of the neural network for the amount of
1 to 10 neurons and the result of 5 neurons was
reached, according to Figure 7.
Figure 7 – RMSE to project the architecture of the
ANN2.
Figure 8 represents the architecture of the projected
artificial neural network. This diagram provides a
comprehensive overview of the intricate layers,
connections, and flow of information within the
network. By examining Figure 8, readers can gain a
clearer understanding of how the neural network
processes and analyzes the input data.
Figure 8 – ANN1 Architecture.
The artificial neural network was used to provide the
corrected active power and apparent power values of
the 6 different electrical charges (EL), with data not
previously presented to the neural network.
Tables 1 and 2 show the results obtained without
neural network correction and correction, table 1
shows the apparent power values, while table 2
shows the active power values. It is noticed that in
both tables the neural network decreases the standard
deviation of the results, which is the advantage
expected by the application of this method, by
increasing the accuracy, without improving the
hardware.
Table 1 – Apparent Power Results
Uncorrected
ESP32
Acquisition
ANN1
Correction
Uncorrected
PZEM
Acquisition
ANN1+ANN2
Correction
EL1
56.0 ± 1.17
39.3 ± 0.70
36.9 ± 0.98
39.9 ± 0.50
EL2
53.1 ± 0.25
44.3 ± 0.23
44.4 ± 0.24
44.3 ± 0.17
EL3
40.8 ± 0.21
9.2 ± 0.22
9.7 ± 0.20
9.9 ± 0.06
EL4
81.8 ± 3.50
74.9 ± 3.24
74.7 ± 2.92
74.7 ± 2.94
EL5
83.7 ± 1.32
75.6 ± 1.05
66.2 ± 1.73
74.4 ± 0.92
EL6
84.3 ± 0.78
54.5 ± 0.55
57.3 ± 0.61
53.8 ± 0.29
International Journal of Electrical Engineering and Computer Science
DOI: 10.37394/232027.2023.5.14
Guilherme Cit, Jean G. Monteiro,
Tiago M. Quirino, Jonatas M. Quirino
E-ISSN: 2769-2507
133
Volume 5, 2023
Table 2 – True Power Results
Uncorrected
ESP32
Acquisition
ANN1
Correction
Uncorrected
PZEM
Acquisition
ANN1+ANN2
Correction
EL1
49.8 ± 1.01
39.3 ± 0.50
36.9 ± 0.97
39.5 ± 0.37
EL2
44.4 ± 0.24
44.3 ± 0.18
44.8 ± 0.20
44.9 ± 0.16
EL3
20.4 ± 0.25
8.7 ± 0.05
9.1 ± 0.19
9.3 ± 0.02
EL4
79.0 ± 2.68
73.5 ± 3.08
73.4 ± 2.66
73.0 ± 2.84
EL5
70.4 ± 1.15
48.4 ± 0.66
53.2 ± 1.04
48.4 ± 0.54
EL6
51.8 ± 0.92
11.1 ± 0.26
11.7 ± 0.20
11.5 ± 0.13
5 Conclusion
It was possible to improve the measurements of a
low-cost electricity meter by implementing artificial
neural networks, which may facilitate the
implementation of low-cost sensors in applications of
this type by continuing this study.
References:
[1] DAWID, Herbert et al. Management science in
the era of smart consumer products: challenges
and research perspectives. Central European
Journal of Operations Research, v. 25, no. 1, p.
203-230, 2017.
[2] KHEDEKAR, Darshan Chandrashekhar et al.
Home automation—a fastexpanding market.
Thunderbird International Business Review, v.
59, no. 1, p. 79-91, 2017.
[3] DE SILVA, Liyanage C.; MORIKAWA,
Chamin; PETRA, Iskandar M. State of the art of
smart homes. Engineering Applications of
Artificial Intelligence, v. 25, no. 7, p. 1313-
1321, 2012.
[4] HOSSEINI, Sayed Saeed et al. Non-intrusive
load monitoring through home energy
management systems: A comprehensive review.
Renewable and Sustainable Energy Reviews, v.
79, p. 1266-1274, 2017.
[5] MOEN, Roger L. Solar energy management
system. In: 1979 18th IEEE Conference on
Decision and Control including the Symposium
on Adaptive Processes. IEEE, 1979. p. 917-919.
[6] MAHAPATRA, Bandana; NAYYAR, Anand.
Home energy management system (HEMS):
Concept, architecture, infrastructure, challenges
and energy management schemes. Energy
Systems, v. 13, no. 3, p. 643-669, 2022.
[7] HART, George William. Nonintrusive
appliance load monitoring. Proceedings of the
IEEE, v. 80, n. 12, p. 1870-1891, 1992.
[8] RUANO, Antonio et al. NILM techniques for
intelligent home energy management and
ambient assisted living: A review. Energies, v.
12, n. 11, p. 2203, 2019.
[9] VISHWAKARMA, Satyendra K. et al. Smart
energy efficient home automation system using
IoT. In: 2019 4th international conference on
internet of things: Smart innovation and usages
(IoT-SIU). IEEE, 2019. p. 1-4.
Contribution of Individual Authors to the
Creation of a Scientific Article (Ghostwriting
Policy)
Guilherme Cit developed the prototype used to
survey the ADC response curve of the Esp32, as well
as the code in C embedded in Esp32 responsible for
generating the samples in .csv, that compares the
power readings between the ADC of Esp32 and the
PZEM module.
Jean Monteiro realized a Artificial Neural Network
research, focused on perceptron multi-layer type,
Self-calibration concept explanation and a
description, based on positive and negative results
observed.
Jonatas Quirino was responsible to the
bibliographical research on the topic's state of the art,
methodological adequacy, formatting review and
person responsible for the submission, review and
publication process.
Tiago Quirino implemented the Artificial Neural
Networks to correct the data.
Creative Commons Attribution License 4.0
(Attribution 4.0 International, CC BY 4.0)
This article is published under the terms of the
Creative Commons Attribution License 4.0
https://creativecommons.org/licenses/by/4.0/deed.en
_US
Sources of Funding for Research Presented in a
Scientific Article or Scientific Article Itself
No funding was received for conducting this study.
Conflict of Interest
The authors have no conflicts of interest to declare
that are relevant to the content of this article.
International Journal of Electrical Engineering and Computer Science
DOI: 10.37394/232027.2023.5.14
Guilherme Cit, Jean G. Monteiro,
Tiago M. Quirino, Jonatas M. Quirino
E-ISSN: 2769-2507
134
Volume 5, 2023