Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

IoT power monitoring device using Wi-fi and

Arduino
Oltean Andrei Stefan Ungureanu
Department of Electric Power Systems and Management Department of Electric Power Systems and Management
Technical University of Cluj-Napoca Technical University of Cluj-Napoca
Cluj-Napoca, Romania Cluj-Napoca, Romania
andrei.oltean@student.utcluj.ro stefan.ungureanu@enm.utcluj.ro
2021 9th International Conference on Modern Power Systems (MPS) | 978-1-6654-3382-2/21/$31.00 ©2021 IEEE | DOI: 10.1109/MPS52805.2021.9492651

Anca Miron Andrei C. Cziker


Department of Electric Power Systems and Management Department of Electric Power Systems and Management
Technical University of Cluj-Napoca Technical University of Cluj-Napoca
Cluj-Napoca, Romania Cluj-Napoca, Romania
anca.miron@enm.utcluj.ro andrei.cziker@enm.utcluj.ro

Abstract— Reliable real-time power measurement data Authors are looking to build systems with higher sampling
represents a vital role in understanding energy behavior from a rates for better reading of different parameters. Moreover,
consumer standpoint. Energy efficiency is directly influenced by similar applications can be used in different frameworks, such
monitoring electric parameters. With collected live data, the as monitoring systems combined with overvoltage protecting
challenge becomes how to organize and analyze datasets of devices or automatic power factor correction units [5],[6].
information. The purpose is to design and build a low-cost However, having device sensors without connecting and
electronic monitoring device using Arduino and IoT for collecting the data in a period is profitless.
electricity monitoring. The main capabilities are to measure,
record, and transmit using wi-fi connection all the essential One efficient way to access and analyze electric data is
electric parameters in a web-based application. Monitored through IoT [7], which is a system consisting of components
electric parameters are voltage, current, power factor, phase with embedded electronic systems (meters, sensors) while
angle, power, and energy. The developed prototype is versatile having an internet connection. The significant benefit of IoT
in multiple types of low voltage installations, mainly household is its feature to combine physical components into the internet,
appliances. Measurements are transmitted remotely in an online thereby being an active user while sharing information.
database, where the data can be stored and analyzed in real-
time. The solution has permanent storage and facilitates The Arduino-based wireless single-phase power meter
consultation of past and current records. The market approach proposed is suitable for household needs, also having easy
is possible because of the low-cost of the device. A commercial access to a web interface whereby data is read. Similar
version would be suitable and could easily integrate Smart Grid approaches implemented by [8] and [9] proved the success of
applications. Using real-time energy data and monitoring the hardware platform. The goal is to offer a low-cost solution
software, consumers can measure high consumption loads, that will optimize power usage by acknowledging about
reduce base loads, evaluate peak and off-peak hours and every-month consumptions.
identify irregularities. Optimize usage scheduling and track
energy-saving targets and goals more accurately. II. METHODOLOGY
Keywords—Smart Grid, IoT, real-time, smart metering, A. Reading parameters
Arduino The diagram presented in (Fig.1) shows the Arduino and
NodeMCU - based power meter. The circuit consists of
I. INTRODUCTION current and voltage sensors and integrated circuits that
A power monitoring meter is a device used to measure the calculate the power factor, together with real and apparent
amount of electric energy consumed by an end-user. The power. Collected data is then transmitted using serial
power is delivered from power plants using large communication to the wi-fi-compatible board, which sends it
interconnected electric systems that continuously supply further to IoT cloud. Every electric parameter is saved every 5
electricity. In this process, from a small or medium-size user seconds, and a simple chart for visualization is generated in a
perspective, we are not aware of the consumed quantity of web interface hosted by adafruit IO.
electricity every month. The existing utility systems inform
consumers about a bill about electrical energy consumed in
kilowatt-hours (kWh). However, a user cannot track the power 1) Voltage measurement
usage on a more immediate basis.
For AC voltage parameter, ZMPT101B Arduino sensor
The first step is to develop an intelligent metering system was chosen. It is a single-phase transformer that can read AC
that can read electric parameters in real-time, store these voltage up to 250V rooted mean square (rms) and it is
parameters and send them through Wi-fi to visualize them in optimized for Arduino environment in terms of output analog
different timeframes. This approach is common because of its values ( between 0 and 5V). In theory, RMS value is the
usage and simplicity. Many systems were installed in average obtained by instantaneous values that can vary, taken
household areas, even in school buildings and universities over a complete cycle, resulting an effective value shown in
worldwide as presented in [1],[2]. There is also a high interest formula below:
in developing a power factor metering, as seen in [3],[4].

978-1-6654-3382-2/21/$31.00 ©2021 IEEE

Authorized licensed use limited to: Kirikkale Univ. Downloaded on December 19,2021 at 13:39:24 UTC from IEEE Xplore. Restrictions apply.
that can be read. 5V is maxim voltage reference for Arduino
analog pins.
3) Power factor measurement
For measuring power factor with Arduino
microcontrollers, Op-Amps (LM324N) and XOR (exclusive-
OR) gate (IC4030) were used.
The power factor of a system is defined as the ratio of real
power to apparent power. Real power is measured in watts and
the apparent power in volt-ampers. Apparent power can be
calculated as the vector sum of the active and reactive power.
All these happen because the voltage and current are not in
phase. Applying cosine to the phase angle, we obtain the
power factor.
Op-Amps act as zero-cross detectors to detect when a
phase shift appears between current and voltage, as mentioned
before, collecting and converting the sine wave signals from
ZMPT101B and SCT-013-050 to digital outputs toward the
logic circuit XOR inputs. There will be used one Op-Amp per
parameter.
XOR gate output will determine whether there is a phase
shift between voltage and current or not, comparing the time
Fig.1 Main components of the power monitoring device delay for each input value. If both current and voltage are
digitally active at the same time, XOR will output zero (Fig. 2
and Fig. 3).
= ∑ (1)

where is the voltage for nth sample taken and N is the total
number of samples.
Because Arduino UNO can read analog values with a
resolution of 210 bit, analog values can vary between 0 and
1023. When the module is powered up but there is no
connection from output pin to Arduino UNO, the analog
output value will result 512, or roughly 2.5 V. All the calculus
regarding voltage measurement is done using emon library
resources [10].
Fig. 2 Exclusive-OR gate [11]
2) Current measurement
Translated into electric theory, when voltage and current
are in-phase, it means that the load is resistive (Fig. 4), and the
For current measurement, a non-invasive SCT-013-050 power factor will be ideally equal to one (XOR outputs value
split core current transformer, able to read up to zero). On the other hand, if either current or voltage are not
50A, RMS value. Thus, RMS value for current can be digitally active at the same time, the XOR gate will output
calculated as : value one since phase-shift occurs (due to passive components
of the load, such as capacitors or inductors), resulting in a
= ∑ (2) power factor less than one.

is the voltage for nth sample taken and N is the total number
of samples.
Current sensor has 1000 windings in secondary, outputting
a maximum of 1V when primary reads 50A. For extending
domain to 5V peak-to-peak, the following adjustment is done:
burden resistor has 27 Ω by construction and for reaching 5V,
Ohm’s law is used, as shown below [16]:

= √
= 70Ω (3)

Where RB represents Burden’s resistance, Nw is the Fig. 3 XOR digital logic output [11]
number of windings and IRMS is the maximum current value

Authorized licensed use limited to: Kirikkale Univ. Downloaded on December 19,2021 at 13:39:24 UTC from IEEE Xplore. Restrictions apply.
Power factor derives from ON-time XOR output,
put in the formula as shown below:

! = "#$%& ∙ () ∙ 360, (4)

where ! stands for power factor, f represents the frequency


equal to 50 Hertz and dt is written as the time difference
between two phases or XOR output one, measured in seconds.

Fig. 4 Flowchart for electric parameters reading


Figure 4. Sine-wave form when load is resistive [11]
Gathered data is displayed on Arduino compatible LCD,
B. Software and further goes in adafruit IO server for visualization of data
Software is written using a simplified C Arduino IDE in a custom-made interface. Effective voltage, current, power
environment. Fig. 4 shows the proposed flowchart for reading factor, and real power are displayed in real-time (every
electric parameters and power factor. Thanks to the open parameter is sent every 5 seconds) [13]
energy monitor and energy monitor library, the readings can
be simplified in terms of code number lines [10]. Collected
data from sensors goes further to ADC as input for Op-Amps, Diagram from Fig. 4 related to the power factor is better
voltage, and current. XOR comparator detects different phase explained in Fig. 5.
crossings. The goal is to measure the parameters every second
and send data packs once in 5 seconds. Thanks to integrated
software solutions as adafruit IO, electric parameters can be
displayed and analyzed. [15]
Software serial library was used for simplicity of sending
JSON data packs from Arduino UNO to NodeMCU board
[12]. NodeMCU uses the MQTT protocol over Wi-Fi to
transfer the data packs. In adafruit interface were created
Feeds as data inputs, and every feed is unique for its
parameter. Wi-Fi client for Adafuit IO is previously defined
(username, unique key, server, and server port), also ought to
be the Wi-Fi parameters (WLAN SSID and password).

Fig.5 Proposed method for power factor

Authorized licensed use limited to: Kirikkale Univ. Downloaded on December 19,2021 at 13:39:24 UTC from IEEE Xplore. Restrictions apply.
Pin 13 is set as output from the XOR gate towards Arduino
input. First, parameters were set zero by default. The phase
angle is calculated in degrees from differentiated time pulse.
The cosine function uses radians, not degrees; therefore,
conversion is obtained by dividing angle over 57.2958 (1
radian equals approximately 58.2958 degrees). Afterward, if
the angle is higher than 360 degrees or equal to 0, the power
factor tends to one, and the phase angle is set to 0. All the code
happens inside of a loop void function.
III. IMPLEMENTATION
A. Schemes
Based on the flowchart regarding electric values, the Figure 6. Schematic for parameters [11]
scheme from below will explain the circuitry used for
mentioned parameters, and Fig. 7 the actual montage. Filtering capacitors in this circuit were important due to
power supply noise that can occur, as good as for insulating
logic gates.

Fig. 7 Voltage, current and power factor circuitry [13].

Both resistors for current readings have the same value of


100 kΩ as the reference for threshold, serving as mid-point,
presented in Fig. 8. The voltage drop across the burden resistor
will have a sine form. Because of the adjustment made in
section 2), Arduino will read and output analog values. Also,
diodes were used as we need rectified units into integrated
circuits.

Figure 8. Explanatory for current reading [11]

Authorized licensed use limited to: Kirikkale Univ. Downloaded on December 19,2021 at 13:39:24 UTC from IEEE Xplore. Restrictions apply.
Also, Fig. 11 brings up results from a variable transformer
used for testing. RMS voltage measured by the ZMPT sensor
B. Testing matches with the value read by the multimeter.

For testing voltage readings, we need to make sure the


sensor is plotting a sine wave first. One easy method to Table 1. Devices used for testing and obtained
calibrate it is to simply plot the analog values and adjust the parameters
potentiometer (Fig10). Afterward, to verify the voltage values,
List of devices used for testing
we have used a variable transformer, slowly varying the
cursor, increasing voltage that way. Fig. 11 excellently points NO Voltage Current
S
Plate PF
to the actual voltage read by Digital Multimeter and obtained Element [V] [A] P [P/S]
[VA]
[W]
voltage using voltage sensor. The multimeter has a 0.1V 229 3.65 0.96
1 Heater step 1 835 800
resolution for the scales of 200V and an accuracy of 0.8% ± 2.
2 Heater step 2 225.5 5.32 1215 1200 0.987
[14].
3 Heater step 3 222.21 9 2030 2000 0.985
3 Hairdryer step 1 231.03 1.08 250.2 200 0.799

Figure 10. Analogic sinewave form of ZMPT voltage


module

Figure 12. Measured electric parameters of a hair-dryer


step one

Figure 11. Matching the voltage read by sensor and


multimeter

Related to current and power factor readings, Table 1 below


shows the obtained values form different devices.

C. Results
Fig.13 Voltage values in Adafruit IO [15]
Table 1 highlights few devices that were measured and
managed to analyze their power usage. A resistive load has a
power factor of one, but in the case of the hairdryer using just Fig.13 underlines the voltage recorded in different
the heat resulted from step one, the power factor was roughly timeframes. Adafruit allows a data transfer rate every 5
0.8, which can be explained based on the inductive seconds due to congestion reasons.
components of the motor. (Fig. 12)

Authorized licensed use limited to: Kirikkale Univ. Downloaded on December 19,2021 at 13:39:24 UTC from IEEE Xplore. Restrictions apply.
[2] L. Pocero, D. Amaxilatis, G. Mylonas, and I. Chatzigiannakis, "Open
source IoT meter devices for smart and energy-efficient school
buildings," HardwareX, vol. 1, pp. 54-67, 2017.
[3] P. P. Machado, T. P. Abud, M. Z. Fortes, B. S. M. C. Borba, Power
factor metering system using arduino, in: 2017 IEEE Workshop on
Power Electronics and Power Quality Applications (PEPQA), 2017,
pp. 1–6. doi:10.1109/PEPQA.2017.7981633.
[4] T. S. Gunawan, M. H. Anuar, M. Kartiwi, Z. Janin, Development of
power factor meter using arduino, in: 2018 IEEE 5th International
Conference on Smart Instrumentation, Measurement and Application
(ICSIMA), 2018, pp. 1–4. doi:10.1109/ICSIMA.2018.8688750.
[5] D. D. Tung, N. M. Khoa, An Arduino-Based System for Monitoring
and Protecting Overvoltage and Undervoltage, Vol. 9, No. 3, 2019,
4255-4260 https://doi.org/10.48084/etasr.2832
[6] M. B. Khan and M. Owais, "Automatic power factor correction unit,"
2016 International Conference on Computing, Electronic and Electrical
Engineering (ICE Cube), 2016, pp. 283-288, doi:
Fig.14 Current values in Adafruit IO [15] 10.1109/ICECUBE.2016.7495239.
[7] G. Bedi, G. K. Venayagamoorthy, R. Singh, R. R. Brooks, K. Wang,
Review of internet of things (iot) in electric power and energy systems,
In Fig. 14, several devices were also used to test if current IEEE Internet of Things Journal 5 (2) (2018) 847–870.
values are plotted correctly. Zero values can be explained as a doi:10.1109/JIOT.2018.2802704.
no-load measurement (the measuring device was turned off). [8] P. P. Machado, T. P. Abud, M. Z. Fortes, B. S. M. C. Borba, Power
factor metering system using arduino, in: 2017 IEEE Workshop on
Power Electronics and Power Quality Applications (PEPQA), 2017,
pp. 1–6. doi:10.1109/PEPQA.2017.7981633.
IV. CONCLUSIONS AND DIRECTIONS [9] T. S. Gunawan, M. H. Anuar, M. Kartiwi, Z. Janin, Development of
power factor meter using arduino, in: 2018 IEEE 5th International
This paper presents a monitoring device regarding electric Conference on Smart Instrumentation, Measurement and Application
parameters that can be read using Arduino kit and collect the (ICSIMA), 2018, pp. 1–4. doi:10.1109/ICSIMA.2018.8688750.
data in adafruit IO using build-in simplified software. The [10] Open Energy Monitor https://openenergymonitor.org/
system was tested and prove a reliable and cheap solution for [11] Simple Projects, Power factor measurement using Ardunio
energy digitalization. Further directions are to combine https://mousa-simple-projects.blogspot.com/2017/12/power-factor-
Arduino kit with their IoT Cloud services and create a simple measurment-using-arduino_18.html last accesed June, 2021
application for different use, such as estimating energy bills [12] Code for Arduino UNO and NodeMCU
https://drive.google.com/drive/folders/1FN9q3EecseGrclmwCiVHIN
based on everyday consumptions or fault detection. QVK3MWWh9R?usp=sharingT
REFERENCES [13] ThinkderCAD https://www.tinkercad.com/
[14] Digitam Multimeter datasheet https://datasheetspdf.com/pdf-
file/756480/ETC/DT9205A/1
[1] D. Alahakoon and X. Yu, "Advanced analytics for harnessing the [15] Adafruit IO https://learn.adafruit.com/category/adafruit-io
power of smart meter big data," in Intelligent Energy Systems (IWIES),
2013 IEEE International Workshop on, pp. 40-45, 2013. [16] Current transformer datasheet
https://datasheetspdf.com/pdf/1328320/YHDC/SCT-013-050/1

Authorized licensed use limited to: Kirikkale Univ. Downloaded on December 19,2021 at 13:39:24 UTC from IEEE Xplore. Restrictions apply.

You might also like