Sie sind auf Seite 1von 6

19th International Symposium POWER ELECTRONICS Ee2017, October 19-21, 2017, Novi Sad, Serbia



Vladimir Mitroviü, Milan Mijalkoviü

The School of Electrical and Computer Engineering of Applied Studies
Belgrade, Serbia

Abstract— This paper describes originally designed mono- frequencies lower than the fundamental) or inter-harmonics
phase power quality data logger (PQL), a successor of mono- (components at non-integer multiple of the fundamental
phase power quality analyzer (PQA) presented earlier. The frequency) [2], [3]. A lot of professional power quality
primary purpose of the analyzer was to illustrate the capabilities analyzers do not measure sub or inter-harmonics content [7].
of the used development board to the students of Microprocessor
software and to help the students of Power networks to visualize Harmonic content in current signal is also of interest when
disturbances generated by different electronic devices. Power observing the influence of different loads on the power
Quality Data Logger adds time as another variable and enables network. Some electronic devices can introduce a lot of
students to visualize and measure power quality or distortions “pollution” in power network. Harmonic current distortion
over time. If PQA is compared to a still photo camera, then PQL presents the quantitative measure of that influence.
can be compared to a movie camera. The main idea was to extend
the functionality of the predecessor in the way that data could be Recording power quality data for a longer period (days or
recorded or streamed in real time, allowing the user to analyze months) can be useful for several reasons. One is to establish
them on-site or off-site, in real time or later. An independent the reason of the power network disturbance if it occurs
network module has been added to the device, making it capable suddenly and unexpectedly. Another reason can be simply to
to stream data over the LAN or the Internet. track the power consumption of the device.
Keywords—Power Electronics; Quality Analizer; Data Logger; II. DESCRIPTION OF THE DEVICE
DSP; Microcontroller; IoT; MQTT; Blynk
This paper displays the original design of a mono-phase
I. INTRODUCTION power quality data logger (PQL). It is a successor of mono-
phase power quality analyzer (PQA) presented earlier [4], a
Voltage (its amplitude and shape) and frequency are the compact device based on Mikroelektronika’s Mikromedia Plus
two basic parameters that characterize operation of a power [8] STM32 board. SPI (Serial Peripheral Interface) is used for
system and the quality of the power supplied to consumers. interconnection with ESP8266 [5] utilized for Internet and Wi-
These parameters should be as close to the nominal values as Fi communication. The main idea was to extend the
possible. However, for practical and economic reasons, some functionality of the predecessor in the way that data could be
deviation must be accepted and tolerated [1]. recorded or streamed in real time allowing users to analyze
The deviation from the desired voltage shape can be them on-site or off-site in real time or off-line. An independent
described by harmonic distortion. Voltage spectrum can network module is added to the device, enabling it to stream
contain harmonics (components at integer multiple of the data over the LAN or the Internet without a significant impact
fundamental frequency), sub-harmonics (components at on the MCU performance.
The same as the predecessor, this device is placed between
the power network and the load (Figure 1) thus enabling users
to obtain an instant image of the principal characteristics of the
load, as well as information about how it affects the system
over time.
The new software version implements some additional
functionality compared to its predecessor:
• Measurement, storage, streaming and visual representation
of voltage and current of three sub-harmonics and first 128
harmonics with their three inter-harmonics. In other words,
it measures spectrum in 12.5Hz steps. Harmonics, sub-
Fig. 1. Illustration of the device placement harmonics, and inter-harmonics are presented by a ratio of
the harmonic amplitude and the amplitude of fundamental.

9781538635025/17/$31.00 ©2017 IEEE 1

19th International Symposium POWER ELECTRONICS Ee2017, October 19-21, 2017, Novi Sad, Serbia

• Measuring frequency has been changed according to frequency. The refresh rate of the screen is 12.5 fps (frames per
standard [11], which means that it is measured as moving second).
average in the 15 second time frame.
Power log shows all three power types over time. The user
• All measured and calculated values can be stored on the SD can detect the changes in power instantly.
card or sent over the USB or Wi-Fi as a real-time data The VCF log (Figure 3) shows voltage, current and
stream. It enables the user to monitor, record and measure frequency changes, simultaneously, over time. In this case,
transitions. power consumer is a two-speed hair dryer.
• Implementation of MQTT protocol [6] in ESP8266
transforms PQL to an IoT (Internet of Things) solution. IV. HARDWARE DESIGN
The hardware (Figure 4) is almost the same as its
• Improved calculation of all power types. predecessor’s [4]. It means that the signal conditioner is the
same, based on LEM LA25-NP transducer for measuring
current, and LEM LV-25P transducer for measuring voltage
[10]. Also, MCU stage, which performs AD conversion, data
storage, processing, visualization and streaming, is the same.
The ESP8266 module has been added and connected to the
SPI port of the MCU. The ESP8266 [5] module is a self-
contained SOC with an integrated low power 32-bit CPU and
TCP/IP protocol stack that provides any MCU with access to
Wi-Fi network. The ESP8266 is capable of either hosting an
application or offloading all Wi-Fi networking functions from
another application processor. In this case, it is used for
offloading networking functions. This module has been chosen
because of its ever-growing users’ and developers’ community.
Fig. 2. Photo of the scope screen
The software included with the device can be divided into
The user interface has been slightly changed. The main three parts: firmware, data viewer, web service.
screen resembles a user menu in which the user can choose:
data presentation style and medium for data storage or A. Firmware
streaming. The prime spot of the device is its embedded software
(firmware), which can also be roughly divided into three parts.
Some basic measured and calculated values are shown on Those parts are: Data acquisition, Data processing and Data
the main screen. The device presents the results after four full presentation
periods (80ms) have been read.
The data acquisition part is used for data sampling. The
The data can be presented as: Scope, Power log and VCF CPU samples 12-bit data from two channels at the sampling
log. rate of 25.6 kHz. It allows capturing of up to 128 harmonics of
The scope screen (Figure 2) is similar to the main screen of current and voltage signals, their corresponding three inter-
the predecessor. The waveforms of two and a half periods of harmonics, and three sub-harmonics.
current and voltage signal are shown in the upper half of the PQL captures 2048 values of voltage and current
screen. The bottom half of the display presents the harmonic
content of both signals. Also, RMS and THD values of current

Fig. 3. Photo of the display of voltage, current and freq. over time
and voltage are shown, as well as the value of measured Fig. 4. Illustration of the device

19th International Symposium POWER ELECTRONICS Ee2017, October 19-21, 2017, Novi Sad, Serbia

simultaneously and stores them in the temporary buffer. This PC.

roughly presents four periods of the signal. During capturing,
the data is processed from the previously stored buffer. After B. Web service
data processing, buffers are switched. The new data becomes New trends and fast development of IoT (Internet of
available for processing and the free buffer available for the Things) have raised the idea of connecting PQL to the internet.
new data. Figure 5 shows structure of the PQL Web Service. On the
Zero crossings are used to measure frequency in a way that left side of the figure are devices that use the service and on the
frequency is measured as time elapsed between two successive right side is the service itself.
zero crossings of the same sign. The average values are The service consists of six microservices. Microservices are
measured over the 15 second period and the last obtained data realized as Docker containers and grouped on the virtual
is displayed. server. This architecture allows easy maintenance and
All sampled and calculated data streams are saved on an SD scalability of the service.
card. Data streams are also sent over USB and SPI interfaces. Communication with PQA is implemented over SPI via
The MCU can produce 2MHz clock as an SPI master device. proprietary error detection protocol. ESP receives averaged
This speed is sufficient for real-time data streaming over the data from 125 measurements every 10 seconds, packs it and
high-speed network such as LAN. sends it to the MQTT broker over the internet using MQTT
The ESP8266 is on the other side of SPI line. It has its own protocol. It is so-called publisher that publishes messages on
firmware which collects raw data from SPI and packs and six topics:
sends them as MQTT packets [6]. MQTT (Message Queue
• pql – general data (time, measurement number …),
Telemetry Transport) is an ISO standard (ISO/IEC PRF 20922)
[6] publish-subscribe-based "lightweight" messaging protocol • pql/voltage – RMS, amplitude, THD …,
for use on top of the TCP/IP protocol. It is designed for • pql/voltage/fft – first 25 harmonics of voltage,
connections to remote locations where a "small code footprint" • pql/current – RMS, amplitude, THD …,
is required, or the network bandwidth is limited. The publish- • pql/current/fft – first 25 harmonics of current, and
subscribe messaging pattern requires a message broker/server. • pql/power – active, reactive, apparent, cos(f).
The broker is responsible for distributing messages to
interested clients based on the topic of a message. Service is hosted at Digital Ocean [12]. OS used for this
purpose is Linux with installed Docker [13], the world’s
The ESP8266 sends data asynchronously. It waits for the leading open source software container platform. Every
new data from the MCU and sends it over the network. element of the system is mounted on a separate container.
Because the duration of the sending cannot be predicted and These elements are microservices and there are six of them:
could take more time than data acquisition, it is possible that RabbitMQ, NodeRed, Blynk, PostgreSQL [18], Metabase [19]
ESP might fail to send some samples over the slow network.
and NGINX [20]; all open source.
However, sending data over the fast and widely spread
interface such as SPI, allows the MCU to be connected to more There are a few benefits of this type of architecture and
versatile devices such as Beagle Bone, Raspberry Pi and even they are generalized for almost all Docker containers.

Fig. 5. Illustration of the service

19th International Symposium POWER ELECTRONICS Ee2017, October 19-21, 2017, Novi Sad, Serbia

First, the entire daemon, as well as all dependencies, live in to control IoT devices. Also, it is a digital dashboard for
the Docker image. This means that it will function correctly on building a graphic user interface for any IoT project by just
all Linux distributions. Everything for the Docker container is dragging and dropping widgets. It is successfully funded on the
contained in one or two images. There are some security Kickstarter [17]. It is not tied to some specific hardware. Blynk
benefits. The main is that compromising the container may platform consists of Blynk server and Blynk mobile
prevent additional compromise of the server. And finally, application.
scalability is easily achieved with Docker containers. In this
Even though Blynk server can be used as a message broker,
case, lack of resources can be easily compensated, only by
distributing containers over different virtual machines. The
technology called "Swarm" allows easy management of a
cluster of Docker Engines.
RabbitMQ [14] is used as the message broker. It is open
source message broker software that implements message
queue protocols such as AMQP and MQTT. The RabbitMQ
server is written in the Erlang programming language and is
built on the Open Telecom Platform framework for clustering
and failover. Client libraries interfacing with the broker are
available for all major programming languages.
The broker's primary task is to manage messages between
publishers and subscribers. PQL publishes messages to the
broker. The broker has at least one subscriber, which is another
microservice, made using NodeRed. Also, because MQTT
protocol is exposed outside the service, there can be other
subscribers. An example is an Android application called
Fig. 7. , Blynk Dashboard (right) and MQTT Dashboard (left)
“MQTT Dash” which is one of the applications used for data
monitoring (Figure 7). RabbitMQ is used instead. This decision has led to a significant
Node-RED [15] is a programming tool for wiring together improvement of performance. The beautiful design of the
hardware devices, APIs and online services in new and exciting mobile application and some useful features made Blynk a part
ways. It provides a browser-based editor that makes it easy to of the service (Figure 7). It has been used for serving data to
wire together flows using the wide range of nodes in the palette the mobile application, storing data to the PostgreSQL database
that can be deployed in a single-click. and as a web API.
PQL uses Node-RED as a bridge between RabbitMQ and API outsources measured data and enables a user to
Blynk server. It also presents real-time data over the web in the develop other, remote, off-site applications which will handle
form of a dashboard. Received message, from MQTT node, that data measured in real-time differently.
travels, as payload, to JSON parser. From the JSON parser, it
goes as an object to the function node, which sends it further to
gauge, text, graph and Blynk nodes. Gauge, text and graph Experimental results presented here are from a remote
nodes are used to present real-time data at the dashboard location over the three-day period. It is well-known that the
(Figure 6), and Blynk node is used for connection with Blynk chosen location has some issues with power quality. PQL has
server over a web socket. been set to send averaged data from 125 measurements every
10 seconds. Voltage frequency, amplitude and harmonics of
Blynk [16] is a Platform with iOS and Android applications one phase are measured. The given data is compared with the
standard (SRPS EN 50160:2012) [11] for voltage
characteristics of electricity supplied by the public distribution
network and with the measurements from another location.
The remote location is placed in the unpopulated rural area.
There is no nearby industry. Measurement point is about 2.5km
away from the power transformer station. The other location is
placed in the metropolitan area. Measurements from this
location are used for the purpose of comparison.

Fig. 6. Example of PQL’s dashbord (a part of the screen)

19th International Symposium POWER ELECTRONICS Ee2017, October 19-21, 2017, Novi Sad, Serbia

Fig. 7. Measured voltage over time (upper – remote location, bottom – local measurement)

both graphs, we can infer that harmonics with significant

A. Voltage measurement values are second, third, fifth and seventh, which is expected
Figure 7 shows the measurement results. The upper graph behavior.
presents values measured at the remote location and the bottom
graph shows values measured locally. The dashed line is the The largest THD value measured at the remote location was
195V threshold (minimal value according to standard [11]). 4.63% which is slightly higher than locally measured 3.07%
The bottom figure shows almost straight line at about 230V but, both values are within the range. Average THD values are
and the upper line varies a lot. Voltage drops on the top graph 2.57% for remote and 2.79% for local.
are far below the minimum voltage and last much more than C. Frequency measurement
the standard allows.
There was no deviation in frequency. Figure 9 shows that
The number of values, measured at the remote location, that measured frequencies are from 49.9Hz to the 50.1Hz. The blue
are below the threshold of 195V are almost the quarter of all bars represent frequency from the remote location and green
measured values. bars, from the local measurements.
B. Voltage harmonics analyisis
Figure 8 shows values of first 25 harmonics. The left graph
presents data from the remote location and the right presents
locally measured data. The blue bars are maximum values over
the measured period, the green present averaged data and the
purple ones are according to the standard [11].
As it is shown, in both cases, all harmonics are within the
range. In the left graph, the maximum of the third harmonic is
very high, but because average value is small we can conclude
that it is a peak value. It is the same with 15th harmonic. From

Fig. 9. Frequency distribution

D. Power measurement
Current and power consumption over time, total harmonic
distortion and harmonic analysis of current and all three types
of power were monitored.
Figure 10 shows all three types of power (active (blue),
reactive (purple) and apparent (green)) averaged over a minute
in the 24-hour period. The consumer in the example is a
refrigerator with 300W compressor.
Fig. 8. Harmonics values of voltage

19th International Symposium POWER ELECTRONICS Ee2017, October 19-21, 2017, Novi Sad, Serbia

allows better security, easy maintenance and scalability of the

[1] Roger C. Dugan, Mark F. McGranaghan, Surya San-toso, H. Wayne
Beaty, „Electrical power systems quality”, Second Edition, the
McGraw-Hill, 2004.
[2] Miloje M. Kostiü, ”Poveüanje energetske efikasnosti elektromotora u
pogonima”, Elektrotehniþki institut Nikola Tesla, Beograd, 2010.
[3] Ž. Janda, „Pregled standarda i preporuka za kontrolu viših harmonika u
elektriþnim mrežama“, Elektro-tehniþki institut Nikola Tesla, Beograd,
[4] V. Mitroviü, M. Mijalkoviü, “Monophase power quality analyzer”,
EE2015, Novi Sad, 2015.
Fig. 10. Types of power over time [5] ESP8266EX Datasheet,
Calculated power consumption of the refrigerator was esp8266ex_datasheet_en.pdf, Jun 2017.
~0.42kWh on the day when measurements were performed. [6] MQTT,, Jun 2017.
[7] Chauvin Arnoux C.A 8335, http://www.chauvin-
The original mono-phase power quality data logger has [8] Mikromedia Plus for STM32,, Jun 2017.
been designed and built at The School of Electrical and
Computer Engineering of Applied Studies, Belgrade. Hardware [9] STM32F407xx Datasheet,
and firmware have been designed as a tool which will enable a 0037051.pdf, Jun 2017.
user to effortlessly implement any data-processing for electrical [10] H. D. Huber, P. V. Iseghem, “Industry voltage & current transducers”,
power measurements, including the power quality LEM Corporation Geneva, 2012.
measurement. Additional PC software and Web service are [11] Standard SRPS EN 50160:2012,
examples of different implementation of the device for various, Jun 2017.
purposes. It has become a more versatile device than its [12] Digital Ocean,, Jun 2017.
predecessor. The Internet of Things movement is opening up [13] Docker,, Jun 2017.
entirely new economic possibilities for remote monitoring of [14] RabbitMQ,, Jun 2017.
the condition of connected assets to optimize operational [15] Node-Red,, Jun 2017.
efficiency, prevent downtime, and drive incremental [16] Blynk,, Jun 2017.
aftermarket service and support revenue. All presented [17] Blynk Kickstarter,
measurements are done remotely.
for-your-arduino-project-in-5-m, Jun 2017.
With organization of service like this, the goal to view,
[18] PostgreSQL,, Jun 2017.
store and review measured data online is fully achieved.
[19] Metabase,, Jun 2017.
Container structure allows seamless usage of small existing
parts as construction units for one big system. This architecture [20] NGINX,, Jun 2017.