0% found this document useful (0 votes)
15 views18 pages

Electronics 13 00025

This study investigates the use of a Kalman filter to enhance the accuracy of measurements from low-cost air quality sensors, which are crucial for monitoring air pollution in urban areas. The research demonstrates the effectiveness of the Kalman filter in optimizing measurements of nitrogen dioxide (NO2) and ozone (O3) concentrations, while also analyzing the behavior of filter coefficients on predicted values. The findings highlight the potential for improved reliability in air quality data collected by citizens using low-cost sensors.

Uploaded by

Costas Polyezos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views18 pages

Electronics 13 00025

This study investigates the use of a Kalman filter to enhance the accuracy of measurements from low-cost air quality sensors, which are crucial for monitoring air pollution in urban areas. The research demonstrates the effectiveness of the Kalman filter in optimizing measurements of nitrogen dioxide (NO2) and ozone (O3) concentrations, while also analyzing the behavior of filter coefficients on predicted values. The findings highlight the potential for improved reliability in air quality data collected by citizens using low-cost sensors.

Uploaded by

Costas Polyezos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

electronics

Article
A Kalman Filter Scheme for the Optimization of Low-Cost Gas
Sensor Measurements
Ioannis Christakis , Odysseas Tsakiridis, Dionisis Kandris * and Ilias Stavrakas

Department of Electrical and Electronics Engineering, Faculty of Engineering, University of West Attica,
Thivon Av. 250, GR-12241 Athens, Greece; [email protected] (I.C.); [email protected] (O.T.); [email protected] (I.S.)
* Correspondence: [email protected]

Abstract: Air pollution, which is mainly caused by industrialization, intensive transportation, and
the heating of buildings, is one of the most important problems in large cities because it seriously
harms the health and the quality of life of their citizens. This is why air quality is monitored not only
by governmental organizations and official research institutions through the use of sophisticated
monitoring systems but also by citizens through the use of low-cost air quality measurement devices.
However, the reliability of the measurements derived from low-cost sensors is questionable, so the
measurement errors must be eliminated. This study experimentally investigated the impact of the use
of a Kalman filter on the accuracy of the measurements of low-cost air quality sensors. Specifically,
measurements of air pollutant gases were carried out in the field in real ambient air conditions. This
study demonstrates not only the optimization of the measurements through the application of a
Kalman filter but also the behavior of the filter coefficients and their impact on the predicted values.

Keywords: air quality prediction; Kalman filter; air quality IoT; low-cost sensing systems; O3
measurements; NO2 measurements; MAD; MSE; MAPE; RMSE

1. Introduction
Citation: Christakis, I.; Tsakiridis, O.; Air quality is a topic of global concern because it is strongly related not only to quality
Kandris, D.; Stavrakas, I. A Kalman of life but also the ecological system of the planet. The ever-increasing growth of big cities
Filter Scheme for the Optimization of is inextricably linked to the deterioration of air quality because of the air pollution caused
Low-Cost Gas Sensor Measurements. by the burning of the fossil fuels that are mainly used to provide energy for industrial
Electronics 2024, 13, 25. https:// plants, vehicles, and buildings [1–3]. Air pollution significantly harms human health, as it
doi.org/10.3390/electronics13010025 can cause various problems such as cardiovascular and cerebrovascular diseases, asthma,
Academic Editors: Juan M. Corchado, cancer, and other lung diseases [4–6]. This is why air quality monitoring is necessary. Within
Patrick Siarry and Deepak Kumar this context, along with governmental organizations and official research institutions that
Jain monitor and study atmospheric conditions, numerous measurements are recorded daily
by citizens using low-cost sensors that monitor ambient air quality [7–13]. Nevertheless,
Received: 17 November 2023
the question arises as to whether the air quality measurements from low-cost sensors are
Revised: 13 December 2023
reliable and trustworthy. In practice, two models are the most commonly used to calibrate
Accepted: 16 December 2023
low-cost sensors. The first one takes place in a laboratory environment, where both the
Published: 20 December 2023
low-cost and reference sensors are exposed to a specific amount of gas, and the reaction of
the sensors is expressed as a measurement of the gas concentration [14–17]. In the second
calibration model, both the low-cost and reference sensors are exposed to ambient air in the
Copyright: © 2023 by the authors. field, where the measurements from both sensors are collected for a time period [18–21].
Licensee MDPI, Basel, Switzerland. With both methodologies, once the measurements of the low-cost and reference sensors are
This article is an open access article correlated, correction factors are applied to the low-cost sensor measurements to formulate
distributed under the terms and a calibration model.
conditions of the Creative Commons This article proposes a model based on a Kalman filter that aims to predict actual
Attribution (CC BY) license (https:// nitrogen dioxide (NO2 ) and ozone (O3 ) concentrations using the measurements obtained
creativecommons.org/licenses/by/
4.0/).

Electronics 2024, 13, 25. https://doi.org/10.3390/electronics13010025 https://www.mdpi.com/journal/electronics


Electronics 2024, 13, 25 2 of 18

with monitoring devices that incorporate low-cost sensors as the input. Through thor-
ough experiments, the efficacy of this model was verified, while the behavior of the filter
coefficients and their impact on the predicted values were investigated.
The rest of the article is organized as follows: In Section 2, the theoretical background
of this study is established. In Section 3, related work is presented. In Section 4, both
the experimental system and procedure that were developed are described. In Section 5,
the experimental results are presented and discussed. Finally, in Section 6, conclusions
are drawn.

2. Theoretical Background
To provide a clear view of the approach adopted for data elaboration in order to
predict the actual gaseous pollutant concentrations when conducting field measurements
using low-cost sensing devices, the tools we used are described herein.

2.1. Kalman Filter


The Kalman filter was first introduced in [22] as a retrospective solution to the problem
of linear filtering of discrete data. Since then, the Kalman filter has not only has been a
challenging subject of scientific research but has also continued to contribute to numerous
applications. At its core, Kalman filter is a recursive algorithm that estimates the state of a
system based on a sequence of measurements. Its purpose is to generate optimal estimates
of a modeled process based on data that are derived from noisy process measurements.
Specifically, the Kalman filter algorithm uses a model of the system to which it is applied,
which is typically represented as a set of differential equations, in order to predict the system
state at each time step. Then, it updates the estimate of the system state based on the latest
measurements using a weighted average of the predicted state and the measured state.
For the creation of predictions, the Kalman filter algorithm generates estimates of
current state variables, along with their uncertainties. Once the result of the next measure-
ment is observed (affected by error, including accidental noise), the estimates are updated
using a weighted average. In order to produce this weighted average, estimates that have
higher certainty are considered as having a greater weighting factor. The Kalman filter al-
gorithm is retrospective. No additional prior information is required, except for the current
input measurements, along with their previously calculated state and their corresponding
uncertainty values.
Kalman filters are linear dynamic systems that are capable of space–state modeling.
They consider underlying hidden states that change over time, possibly as a function of
some external inputs that affect the system output. The basic assumptions of the Kalman
filter are the uncertainty of the state progression along with the Gaussian characteristic
of the measurements, meaning that system outputs are altered by Gaussian noise. The
dynamic model of the Kalman filter is defined by the state or transition Equation (1) and
measurement Equation (2):
xt+1 = Axt + But + wt (1)
yt = Cxt + Dut + vt (2)
The states x t ∈ Rdx are vectors that are unobservable. The output of the system
yt ∈ Rdy depends only on the current state xt and some additional noise vt . The input of
the system, in the case of a control system model, ut ∈ Rdu , is considered to be known.
The xt+1 state is independent of all other states if xt is given. A is the system matrix, B is
the input matrix, C is the output matrix, and D is the feed-forward matrix. For dynamic
systems, D is by default fixed to zero. Assuming that the noise of the vt measurements
and the progression of the states wt are white Gaussian noise with a mean value of 0 and
covariance matrix Q and R, respectively, the state transmission function of states p(w) and
measurements p(v) with Gaussian noise G (w) and G (v) are, respectively, described using
Equations (3) and (4):
p(w) = Gw (0, Q) (3)
Electronics 2024, 13, 25 3 of 18

p(v) = Gv (0, R) (4)


In the case of applying a Kalman filter as a prediction model, the simplified forms of
the previous equations are shown in Equations (5) and (6).

xt = Axt−1 + But + wt (5)

yt = Cxt + vt (6)

2.2. N4SID Algorithm


The numerical algorithm for subspace state identification (N4SID) algorithm is a
subspace-based system identification method that is used in signal processing to estimate
the state–space model of a dynamic system from input–output data. It is based on the notion
that the dynamics of a system can be represented using a lower-dimensional subspace of the
full state–space. The n4SID algorithm uses singular value decomposition (SVD) and a set of
input–output data to estimate the state–space model of the system. In practice, the N4SID
algorithm is a very useful tool in system identification due to its ability to handle noisy
data, its computational efficiency, and its ability to estimate the state–space model directly
from data without requiring a priori knowledge of the system dynamics. Dynamic model
Equations (7) and (8) describe the estimated state–space model of the N4SID algorithm.

xt+1 = Axt + But + Ket (7)

yt = Cxt + Dut + et (8)


where A, B, C, D, and K are state–space matrices; u(t) expresses the input; y(t) symbolizes
the output; e(t) represents the disturbance; and x(t) is the vector of states.

2.3. Indicators for the Forecasting Error Evaluation


In forecasting, it is of crucial importance to evaluate the estimation error. For this
purpose, various methods have been proposed: median absolute deviation, mean square
error, mean absolute percentage error, and root mean square error are among the most
widely used methods.
Median absolute deviation (MAD) is a measure of the variability of a sample of
quantitative data. It represents the median of the differences that exist among data values
and their medians. Specifically, in forecasting, MAD is expressed as (9):

∑ | xi − x |
MAD = (9)
n
where xi represents the observed value, x represents the mean value of observed values in
the xi dataset, and n expresses the size of the observed values.
The mean square error (MSE) is used to evaluate the errors existing in statistical models
by calculating the average squared difference among observed and predicted values, as
defined in (10):
1 n
MSE = ∑ ( xi − x̂i )2 (10)
n i =1
where xi expresses the observed value, x̂i represents the predicted value from regression,
and n denotes the size of the observed values.
The mean absolute percentage error (MAPE) evaluates the average magnitude of
estimation error that is produced using a prediction model, as defined in (11):

100% n At − Ft
n ∑ t =1
MAPE = (11)
At

where At represents the actual observed value, Ft stands for the forecasted value, and n
expresses the total number of observed values.
Electronics 2024, 13, 25 4 of 18

Root mean square error (RMSE) is a widely used performance indicator of regres-
sion models, which measures the average difference among predicted values and the
corresponding actual values, as defined in (12):
v
(ŷ − yi )2
u n
RMSE = t ∑ i
u
(12)
i =1
n

where ŷi denotes the predicted values, yi , represents the observed values, and n stands for
the total number of observations.
For all the above-mentioned indicators, the lower the value of the corresponding index,
the more accurate the prediction.

3. Related Work
Many researchers have pursued air quality prediction through statistical models.
Specifically, Shang Z. et al., 2019 proposed a prediction model for hourly concentration of
atmospheric particulate matter PM2.5 [23]. It is based on a classification and regression tree
(CART) approach along with the ensemble extreme learning machine (EELM) method. N.
Djebbri and M. Rouainia 2017 proposed an artificial-neural-network-based self-regression
model using barometric conditions for the prediction of the concentration of pollutants
(CO and NOx ) with satisfactory results [24]. Mercer L.D. et al., in 2011, applied a regression
method as well as the universal Kriging method to predict NOx concentrations in the
city of Los Angeles, USA [25]. In addition to barometric conditions, spatial parameters
such as road traffic, population, and area distance were also considered in the study.
In a previous study by Christakis I. et al. in 2023, correction equations related to the
operating time of the low-cost electrochemical gas sensors incorporated in an air-quality-
measuring node were proposed in order to obtain more reliable measurements during the
lifetime of these sensors [26]. A hybrid system of genetic neural computation (GNC) was
implemented by Al-Janabi S. et al. in 2015 to analyze and understand data corresponding
to the concentration of dissolved gases in four subgroups for analysis according to the IEEE
C57.104 specification [27]. In 2004, Dueñas C. et al. conducted an annual analysis of the
ozone levels in Malaga, Spain [28]. In the study, multivariate regression was used to predict
the ozone concentration using meteorological parameters.
Likewise, many studies have been conducted using the Kalman filter for prediction
purposes. For instance, in the weather search and prediction model (WRF) described by
Hua S. et al., 2017 [29], measured values were compared with the corresponding values
that were predicted using the Kalman filter in order to reduce systematic and random
measurement errors of wind speed. Apriliani E. et al. (2010) used the square ensemble
Kalman filter in order to achieve accurate estimation of air pollution with a fast computing
process [30]. In Lai X. et al., 2019, optimal prediction accuracy was accomplished by
applying six different types of air pollutants with a Kalman filter algorithm [31]. An
estimator of air pollutant concentration that used the extended Kalman filter algorithm
was proposed by Metia S. et al. in 2013 [32]. Galani G. et al., 2006 applied a nonlinear
function to the classic Kalman filter algorithm to improve weather forecast accuracy [33].
Achar A. et al., 2020 used a Kalman filter for the prediction of bus arrival time based
on fleet data, which exploited the spatiotemporal relationships for various travel times
sensed using a GPS device [34]. The Kalman filtering technique was used by Kumar
S.V. in 2017 to accurately predict the flow of traffic with limited input data [35]. An
extended Kalman filter was applied to accurately forecast battery status by Mastali M. et al.
in 2013 [36]. Fitria R. and Arif D.K. in 2017 used a fuzzy Kalman filter for estimation
purposes in one of the most commonly applied processes in chemical manufacturing [37].
A linear dynamic Kalman filter applying an expectation maximization algorithm along
with an automatic regression algorithm was proposed by Soubdhan T. et al. in 2016
for the prediction the photovoltaic-aided energy generation according to initialization
and probability models [38]. D. K. Arif et al., 2017 applied an extended Kalman filter in
Electronics 2024, 13, 25 5 of 18

a nonlinear model to estimate the measurements of a 3D radar monitoring system [39].


Leleux D. 2002 demonstrated the effectiveness of the application of Kalman filtering for real-
time gas pollutant measurements, using diode–laser overtone spectroscopy [40]. De Ridder
K. et al., 2012 evaluated the suitability of Kalman filtering based on adaptive regression
method for the correction of deterministic forecasts of air quality in a highly polluted area
in Belgium [41]. Metia S. et al., 2021 applied the extended fractional-order Kalman filtering
(EFKF) method for data assimilation and recovery of the missing low-cost air pollutant
concentration values, which were gathered by low-cost sensors in a wireless sensor network,
based on IoT technology [42]. It becomes clear that the optimization and correction of
low-cost sensor performance remain open questions; for several years, researches have
focused on trying to improve the credibility of such systems. In this study, the Kalman filter
approach with field-collected data was evaluated. Specifically, in this IoT-based architecture,
the Kalman filter is used to predict the final air pollutant concentration values, as well as
how close the predicted values are to the corresponding reference values. Additionally,
for the value-prediction model of low-cost sensors, an analysis of the coefficients of the
Kalman filter was performed in order to detect the weight of each coefficient during the
final estimation. The accuracy of the predicted values comparatively to the reference values
was calculated by using MAD, MSE, MAPE, and RMSE indicators.

4. Experimental System and Procedure


4.1. System Overview
Wireless sensor networks (WSNs) are sets of wirelessly interconnected devices, called
sensor nodes that have the ability to sense ambient conditions and process and transmit
corresponding data. This is why WSNs, despite the severe energy limitations of their
nodes [43], are being increasingly applied [44].
The air quality measurement system we developed is a WSN that includes 3 low-cost
Electronics 2024, 13, x FOR PEER REVIEWnodes that measure the air quality in their ambient environment and peripheral devices
6 of 18
that support the overall functionality such as localization (GPS), network communication
(Wi-Fi, GPRS), and energy backup (UPS), as illustrated in Figure 1.

Figure
Figure 1. Depiction
1. Depiction ofdeveloped
of the the developed air quality
air quality monitoring
monitoring system.
system.

Both the software and hardware of the sensor nodes (Figure 2) were designed, built and
Both the software and hardware of the sensor nodes (Figure 2) were designed, built
evaluated by the authors in the Electronic Devices and Materials Laboratory (EDML) at the
and evaluated by the authors in the Electronic Devices and Materials Laboratory (EDML)
University of West Attica [45], while all the parts and platforms that were openly available.
at the University of West Attica [45], while all the parts and platforms that were openly
available. Every node is based on an STM CPU (i.e., Nucleof091RC) and incorporates low-
cost gas and particle sensors, a barometric conditions sensor, and peripherals. Specifically,
regarding they gas sensors, they includes one electrochemical sensor, produced by Alpha-
sense (Essex, UK,), i.e., NO2-B43F, which measures the concentration of nitrogen dioxide
(NO2); one electrochemical sensor, also manufactured by Alphasense (Essex, UK,), i.e.,
Figure 1. Depiction of the developed air quality monitoring system.

Electronics 2024, 13, 25 Both the software and hardware of the sensor nodes (Figure 2) were designed,6 built of 18
and evaluated by the authors in the Electronic Devices and Materials Laboratory (EDML)
at the University of West Attica [45], while all the parts and platforms that were openly
Every nodeEvery
available. node
is based onis
anbased
STM CPUon an(i.e.,
STMNucleof091RC)
CPU (i.e., Nucleof091RC) and incorporates
and incorporates low-cost gas low-and
particle sensors, a barometric conditions sensor, and peripherals. Specifically,Specifically,
cost gas and particle sensors, a barometric conditions sensor, and peripherals. regarding
regarding
they they gas
gas sensors, sensors,
they they
includes includes
one one electrochemical
electrochemical sensor,
sensor, produced byproduced
Alphasense by (Essex,
Alpha-
sense i.e.,
UK,), (Essex, UK,), i.e.,
NO2-B43F, NO2-B43F,
which measureswhich
themeasures the concentration
concentration of nitrogen
of nitrogen dioxide (NOdioxide
2 ); one
(NO2); one electrochemical
electrochemical sensor, also manufactured
sensor, also manufactured by Alphasense
by Alphasense (Essex, UK,), i.e.,(Essex,
OX-B431,UK,),
whichi.e.,
OX-B431,the
measures which measures of
concentration theozone
concentration
(O3 ) [46]; of
andozone (O3) [46];
one optical andmade
sensor, one optical sensor,
by Plantower
made byChina),
(Beijing, Plantower (Beijing,
which China),
measures the which measures
concentration of the concentration
PM2.5 [47]. Every of
node PMhas
2.5 [47]. Every
a unique
node has a unique
identification identification number.
number.

Figure2.2.Low-cost
Figure Low-costair
airquality
qualitysensor
sensornode.
node.

The developed
The developed system
system was
was installed
installed in
in aa densely
densely populated
populated region
region at at the
the center
center of
of
the
thecity
cityof
ofAthens,
Athens, Greece,
Greece, at
at aa height
height of
of 6–8
6–8 m
m above
above the
the ground,
ground, and
and atat aa distance
distance ofof few
few
meters
meters away
away from
from main
main roads
roads with
with heavy
heavy traffic
traffic during
during peak
peak hours.
hours. Three
Three identical
identical low-
low-
cost
costmonitoring
monitoringnodes
nodeswere
werecollocated
collocatedin in
order
orderto ensure results
to ensure reliability
results and repeatability.
reliability and repeata-
The specific
bility. location
The specific is denoted
location as point
is denoted as A in Figure
point 3. The3.measurements
A in Figure The measurements mademadeby this
by
system represented a quantification of the variability in the concentrations of specific
pollutants in the ambient air. The values of the measurements were compared with the
corresponding reference NO2 and O3 values derived from the Ministry of Environment
and Energy of Greece (PERPA) [48]. The reference data represented the measurements of
the official pollution measuring station of PERPA, which is also located in the center area
of Athens, on the top of a building that is located next to a main street with heavy traffic.
This location is denoted in Figure 3 as point B. Both locations were close each other and
shared the same air quality conditions.

4.2. Experimental Procedure Overview


As illustrated in Figure 4, the system consists of an initialization phase and an
iteration loop.
In the initialization phase, timing signals (clock, timers), followed by the communica-
tion channels of the microprocessor with the peripherals (I2C, SPI, UART) as well as the
ports of the microprocessor (input, output, analog), are initialized. Sequentially, the values
of the parameters such as node ID, GPS data, and the measurement data (sensor electrode
voltages, etc.) are initialized. Then, the packet structure (data structure) for sending data is
created; finally, the connection to the network (Wi-Fi or GPRS) is established.
In the iteration loop, measurements are taken every 10 s. In a 5 min time cycle, the
average of the measurements from the sensors along with the data from the GPS are
structured into a transmission packet and sent to the server. Depending on the server
response, two paths are available to be followed:
- Upon positive confirmation of packet delivery, the averages of the measurements
are calculated, and a check to identify whether packets are recorded on the memory
card is conducted. In the case where no packets are recorded, the loop starts from
this system represented a quantification of the variability in the concentrations of specific
Electronics 2024, 13, x FOR PEER REVIEW 7 of 18
pollutants in the ambient air. The values of the measurements were compared with the
Electronics 2024, 13, 25 corresponding reference NO2 and O3 values derived from the Ministry of Environment
7 of 18
and Energy of Greece (PERPA) [48]. The reference data represented the measurements of
thisofficial
the systempollution
represented a quantification
measuring station ofofPERPA,
the variability
which isinalso
the located
concentrations of specific
in the center area
pollutants
of Athens, on in the
the top
ambient air. The that
of a building values of the measurements
is located next to a main werestreet compared
with heavywith the
traffic.
the beginning.
corresponding In the NO
reference case2 where
and O are packets
values recorded
derived from on
thetheMinistry
memoryofcard, with the
Environment
This last
location is denoted
in, first out (LIFO) in method,
Figure 3 aaspacket
3 point is
B. sent
Bothtolocations
the serverwere close
with eachthat
a check other and
it was
and Energy
shared the of Greece
same air (PERPA)
quality [48]. The reference data represented the measurements of
conditions.
indeed received, and so on.
the official pollution measuring station of PERPA, which is also located in the center area
- If the confirmation of receiving the package fails, the data are stored on the memory
of Athens, on the top of a building that is located next to a main street with heavy traffic.
card. Next, the averages of the measurements are calculated, and the loop starts from
This location is denoted in Figure 3 as point B. Both locations were close each other and
the beginning.
shared the same air quality conditions.

Figure 3. The map of the experimental setup (reference and low-cost sensor nodes) at the center of
Athens, Greece.

4.2. Experimental Procedure Overview


Figure 3.illustrated
The map of the experimental setup (reference andan
low-cost sensor nodes)
phaseatat the center of
FigureAs
3. The map of in
theFigure 4, the system
experimental consistsand
setup (reference of initialization
low-cost sensor nodes) and
the an itera-
center of
Athens, Greece.
tion loop.
Athens, Greece.

4.2. Experimental Procedure Overview


As illustrated in Figure 4, the system consists of an initialization phase and an itera-
tion loop.

Figure 4. Flow chart of operation of low-cost air quality measuring device.

4.3. Electrochemical Sensor Correction


Each one of the Alphasense sensors [46] used in the proposed system consists of
4 electrodes; the measurement is provided through an individual sensor board (ISB) in mV.
Electronics 2024, 13, 25 8 of 18

A two-stage process is applied to convert the mV recordings to the actual gas concentra-
tion. The first stage concerns the differential voltage level of the working and auxiliary
electrodes, calculated in combination with the environmental temperature and the sensor
sensitivity. This calculation is performed according to Equation (13) [49], which determines
the electrode voltage, the zero voltage calibration from ISB, and the temperature:

WEc = (WEu − WEe ) − n T ·[( AEu − AEe )] (13)

where WEc represents the corrected working electrode value, WEu is the working electrode
reading value, AEu symbolizes the auxiliary electrode reading value, n T expresses the
temperature coefficient, WEe represents the working electrode electronic zero value, and
AEe is the auxiliary electrode electronic zero value. The measurement of x gas concentration
is given by dividing the calibrated voltage output WEc (i.e., working electrode corrected)
by Sensor Sensitivity , as shown in (14):

WEc
GASx m = (14)
Sensor Sensitivity

where GASx m represents the corrected measurement concentration, WEc symbolizes the
calibrated value of x gas concentration given by (13), and Sensor Sensitivity is given by the
sensor’s manufacturers.
In stage two, the calculated concentrations are leveled and scaled by two factors [45]
that are estimated after the calibration period when the nodes are placed either in a
controlled environment or near official instruments. The formula that gives the final
corrected values is shown in (15):
 
( GASx m + C1)
GASxC = (15)
C2

where GASxC expresses the calibrated value of x gas sensor, GASx m represents the cor-
rected measurement concentration of x gas pollutant, C1 is the level factor, and C2 rep-
resents the scaling factor. The final step of the procedure is the conversion of ppb to
µg/m3 . The evaluation was carried out in February 2021, in the field, using the comparison
method between low-cost sensors and reference instruments. This procedure resulted in
the correction of factors C1 and C2 for each low-cost gas sensor. It must be noted that
electrochemical O3 sensors are also activated from NO2 . In order to avoid incorrect gas
measurements due to the cross-sensitivity of the OX-B431 sensor, Equation (16) was applied
to the measurements in order to obtain the O3 concentration.

O3 ppb = O3 All − NO2 ppb (16)

where O3 ppb expresses the pure O3 concentration, O3 All represents the measured value
from the O3 sensor and NO2 ppb stands for the NO2 concentration measured from the
NO2 sensor.

5. Experimental Results and Discussion


5.1. Experimental Results
The correction of the measured values was made using a Kalman filter, where the
input was the measurement value derived from Equations (15) and (16). The evaluation of
the prediction values of the Kalman filter was performed in the MATLAB environment. The
N4SID algorithm was applied before the Kalman filter in order to identify the coefficients
A and B. In addition to the above algorithm, the fit estimation data are presented as the
prediction focus and as the mean square error (MSE) of the predicted coefficients. The
filter ran as a first-degree filter (n = 1), and the size of the matrix of each coefficient was
one-dimensional. In Section 5, the experimental results are presented and discussed.
input was the measurement value derived from Equations (15) and (16). The evaluation
of the prediction values of the Kalman filter was performed in the MATLAB environment.
The N4SID algorithm was applied before the Kalman filter in order to identify the coeffi-
cients A and B. In addition to the above algorithm, the fit estimation data are presented as
Electronics 2024, 13, 25
the prediction focus and as the mean square error (MSE) of the predicted coefficients.9 of 18
The
filter ran as a first-degree filter (n = 1), and the size of the matrix of each coefficient was
one-dimensional. In Section 5, the experimental results are presented and discussed.
Table
Table 11 presents
presentsthe
thefitfitestimation
estimationdata
data and
and thethe mean
mean square
square error
error (MSE)
(MSE) ofpre-
of the the
predicted coefficients (A, B, C) for the NO2 and O3 sensors of all three nodes of the
dicted coefficients (A, B, C) for the NO2 and O3 sensors of all three nodes of the established
established WSN.
WSN.
Table 1. Fit estimation data and the mean square error (MSE) of the predicted coefficients (A, B, C).
Table 1. Fit estimation data and the mean square error (MSE) of the predicted coefficients (A, B, C).
N1 NO N2 NO N3 NO N1 O N2 O N3 O
N1 NO2 2 N2 NO2 2 N3 NO2 2 N1 O3 3 N2 O3 3 N3 O33
FitFittotoestimation
estimation data
data(%) 45.47
(%) 45.47 46.00
46.00 44.00 62.14
44.00 62.14 62.11
62.11 62.29
62.29
MSE 79.51 77.98 83.88 141.3 141.5 140.2
MSE 79.51 77.98 83.88 141.3 141.5 140.2

Regarding
Regarding Node
Node 11 (i.e.,
(i.e., N1),
N1), Figure
Figure 5a
5a illustrates
illustrates the
the time
time series
series of
of the
the corrected
corrected and
and
reference
reference measurements of NO22 concentration, while Figure 5b graphically demonstrates
measurements of NO concentration, while Figure 5b graphically demonstrates
the 2 among corrected and reference measurements of NO concentration.
the correlation
correlation (R
(R2)) among corrected and reference measurements of NO22 concentration.
Likewise, Figure 6a
Likewise, Figure 6a presents
presentsthe thetime
timeseries
seriesofofpredicted
predicted and
and reference
reference measurements
measurements of
of 2
NONO 2 concentration,
2 concentration,
while
while Figure
Figure 6b depicts
6b depicts the the correlation
correlation (R2)(R ) among
among predicted
predicted and and
ref-
reference measurements
erence measurements of of
NO NO 2 concentration.
2 concentration.

(a) (b)
Figure 5. Node 1, NO2, corrected and reference measurements: (a) Node 1, time series of corrected
Electronics 2024, 13, x FOR PEER REVIEW 10 of 18
Figure 5. Node 1, NO2 , corrected and reference measurements: (a) Node 1, time series of corrected
and reference NO2values; (b) Node 1, correlation of corrected and reference NO2values.
and reference NO2 values; (b) Node 1, correlation of corrected and reference NO2 values.

(a) (b)
Figure
Figure 6.
6. Node
Node 1,
1, NO
NO22:predicted
:predictedand
andreference
reference measurements:
measurements: (a)
(a) Node
Node 1,
1, time-
time- series
series of
of predicted
predicted
and reference NO 2values; (b) Node 1, correlation of predicted and reference NO2 values.
and reference NO2 values; (b) Node 1, correlation of predicted and reference NO2 values.

Similarly, forN1,
Similarly, for N1,Figure
Figure7a 7agraphically
graphicallyshows
showsthethe time
time series
series of corrected
of corrected andand refer-
reference
ence measurements of O
measurements of O3 concentration, while Figure 7b demonstrates the correlation (R
3 concentration, while Figure 7b demonstrates the correlation (R22))
among corrected and
among corrected and reference
referencemeasurements
measurementsofofOO 3 concentration.
3 concentration. Additionally,
Additionally, Figure
Figure 8a
8a illustrates the time series of predicted and reference measurements of O
illustrates the time series of predicted and reference measurements of 3 concentration,
3 concentration,
correlation (R22))among
while Figure 8b depicts the correlation amongpredicted
predicted and
andreference
reference measurements
measurements
of
of O33 concentration.
concentration.
Similarly, for N1, Figure 7a graphically shows the time series of corrected and refer-
ence Similarly, for N1,
measurements of OFigure 7a graphically
3 concentration, whileshows the
Figure 7btime series of corrected
demonstrates and refer-
the correlation (R2)
ence measurements
among corrected and of reference
O3 concentration, while Figure
measurements 7b demonstrates
of O3 concentration. the correlation
Additionally, (R2)
Figure
among
8a corrected
illustrates andseries
the time reference measurements
of predicted of O3 concentration.
and reference measurementsAdditionally, Figure
of O3 concentration,
Electronics 2024, 13, 25 10 of 18
8a illustrates the time series of predicted and
2 reference measurements of O3 concentration,
while Figure 8b depicts the correlation (R ) among predicted and reference measurements
while
of Figure 8b depicts the correlation (R2) among predicted and reference measurements
O3 concentration.
of O3 concentration.

(a) (b)
(a) (b)
Figure 7. Node 1, O3, corrected and reference measurements: (a) Node 1, time series of corrected
Figure
Figure7.7.Node
Node1, OO3 , 3corrected and reference measurements: (a) Node 1, time series of corrected and
and reference O31,values;, corrected
(b) Nodeand reference
1, correlationmeasurements:
of corrected and(a)reference
Node 1,Otime series
3 values. of corrected
reference O values; (b) Node 1, correlation of corrected and reference
3 O3 values; (b) Node 1, correlation of corrected and reference
and reference O values.
3 O3 values.

(a) (b)
(a) (b)
Figure 8. Node 1, O3, predicted and reference measurements: (a) Node 1, time series of predicted
Figure
and 8. Node 31,values;
reference O3, predicted and reference measurements: (a) Node 1, O
time series of predicted
Figure 8. NodeO1, (b) Node
O3 , predicted 1, correlation
and of predicted and
reference measurements: (a)reference 3 values.
Node 1, time series of predicted
and reference O3 values; (b) Node 1, correlation of predicted and reference O3 values.
and reference O3 values; (b) Node 1, correlation of predicted and reference O3 values.
Regarding Node 2 (i.e., N2), Figure 9a illustrates the time series of the corrected and
Electronics 2024, 13, x FOR PEER REVIEW Regarding
reference Node22(i.e.,
measurements
Regarding Node (i.e.,
of NON2), Figure9a
9aillustrates
illustrates
2 concentration,
N2), Figure thetime
while the time
Figure series
9bseries ofthe
thecorrected
graphically
of corrected and
11 ofand
demonstrates 18
reference
the measurements
correlation
reference ofNO
(R2) among
measurements of NO2theconcentration, while
corrected while Figure
and Figure 9bgraphically
reference graphically
measurementsdemonstrates
of NO2
2 concentration, 9b demonstrates
the correlation 2 (R 2) among the corrected and reference measurements of NO2
the correlation (R ) among the corrected and reference measurements of NO2 concentration.
Likewise, Figure
concentration. 10a presents
Likewise, Figurethe time
10a series the
presents of the predicted
time series ofand
the reference
predictedmeasurements
and reference
of NO concentration, while Figure 10b depicts the correlation (R 2 ) among the predicted
measurements of NO2 concentration, while Figure 10b depicts the correlation (R2) among
2
andpredicted
the referenceand
measurements of NO2 concentration.
reference measurements of NO2 concentration.

(a) (b)
Figure
Figure 9.
9. Node
Node 2,
2, corrected
corrected and
and reference
reference NO
NO22measurements:
measurements:(a)(a)Node
Node2,2, time
time series
series of
of corrected
corrected
and reference NO2values; (b) Node 2, correlation of corrected and reference NO2 values.
and reference NO2 values; (b) Node 2, correlation of corrected and reference NO2 values.
(a) (b)
Electronics 2024, 13, 25
(a) (b)
11 of 18
Figure 9. Node 2, corrected and reference NO2measurements: (a) Node 2, time series of corrected
Figure 9. Node 2, corrected and reference NO2measurements: (a) Node 2, time series of corrected
and reference NO2values; (b) Node 2, correlation of corrected and reference NO2 values.
and reference NO2values; (b) Node 2, correlation of corrected and reference NO2 values.

(a) (b)
(a) (b)
Figure 10.
Figure10. Node 2,
Node2,
10.Node predicted
2,predicted and
predictedand reference
andreference NO measurements:
NO222measurements:
reference NO measurements:(a)(a) Node
(a)Node
Node2,2, time
2,time series
timeseries of
seriesof predicted
ofpredicted
predicted
Figure
and reference NO2 values; (b) Node 2, correlation of predicted and reference NO2 values.
and
andreference
reference NO
NO22values;
values;(b)
(b)Node
Node2,2,correlation
correlationof
ofpredicted
predictedand
andreference
referenceNONO22values.
values.

Similarly, regarding
regarding N2,
Similarly, regarding Figure
N2, Figure 11a
Figure 11a graphically
11a graphically shows
graphically shows the
shows the time
the time series
time series of
seriesof the
ofthe corrected
thecorrected
corrected
Similarly,
and
and reference
reference measurements
measurements ofofO3Oconcentration,
concentration, while Figure
while 11b 11b
Figure demonstrates
demonstratesthe cor-
the
and reference measurements of O3 concentration,
3 while Figure 11b demonstrates the cor-
relation
correlation(R 2) among
2 the corrected and reference measurements of O 3 concentration. Addi-
relation (R2)(R ) among
among the the corrected
corrected andand reference
reference measurements
measurements of O of3 O 3 concentration.
concentration. Ad-
Addi-
tionally,
ditionally, Figure
Figure 12a illustrates
12a the
illustrates thetime series
timeseries ofofthe
seriesof predicted
thepredicted and
predictedand reference
andreference measurements
referencemeasurements
measurements
tionally, Figure 12a illustrates the time the
of O
of O concentration,
O333 concentration,
concentration,whilewhile Figure
whileFigure 12b
Figure 12b depicts
12b depicts
depicts thethe correlation
the correlation (R
correlation (R(R222))) among
among the
among the predicted
the predicted
predicted
of
values
values and
and reference
reference measurements
measurements of
of O
O 3 concentration.
concentration.
values and reference measurements of O3 concentration.
3

(a) (b)
(a) (b)
Figure 11. Node 2, corrected and reference O3 measurements: (a) Node 2, time series of corrected
Figure 11. Node 2, corrected and reference O3 measurements: (a) Node 2, time series of corrected
Figure
Electronics 2024, 13, x FOR PEER REVIEW
and 11. Node
reference 2, corrected
O3 values; and 2,
(b) Node reference O3 measurements:
correlation of corrected and(a) Node 2,Otime
reference series of corrected
3 values. 12 of 18
and reference O3 values; (b) Node 2, correlation of corrected and reference O3 values.
and reference O3 values; (b) Node 2, correlation of corrected and reference O3 values.

(a) (b)
Figure 12.
Figure 12. Node
Node 2,
2,predicted
predictedand
andreference
referenceOO3 measurements:
measurements: (a)
(a) Node
Node 2,
2, time
time series
series of
ofpredicted
predicted
3
and reference O3 values; (b) Node 2, correlation of predicted and reference O3 values.
and reference O3 values; (b) Node 2, correlation of predicted and reference O3 values.

Regarding Node 3 (i.e., N3), Figure 13a illustrates the time series of the corrected and
reference measurements of NO2 concentration, while Figure 13b graphically demonstrates
the correlation (R2) among the corrected and reference measurements of NO2 concentra-
tion. Likewise, Figure 14a presents the time series of the predicted values and reference
measurements of NO2 concentration, while Figure 14b depicts the correlation (R2) among
the predicted values and reference measurements of NO2 concentration.
(a) (b)
Electronics 2024, 13, 25 (a) (b) 12 of 18
Figure 12. Node 2, predicted and reference O3 measurements: (a) Node 2, time series of predicted
Figure
and 12. Node
reference 2, predicted
O3 values; and 2,reference
(b) Node O3 measurements:
correlation of predicted and(a) Node 2,Otime
reference series of predicted
3 values.
and reference O3 values; (b) Node 2, correlation of predicted and reference O3 values.
Regarding Node
Regarding Node 33 (i.e.,
(i.e., N3),
N3), Figure
Figure 13a
13a illustrates
illustrates the
the time
time series
series of
of the
the corrected
corrected and
and
Regarding
reference
reference Node 3 (i.e.,
measurements
measurements of NO
of NON3), Figure 13a illustrates
concentration,
22concentration, whileFigure
while the time
Figure 13bseries
13b of the demonstrates
graphically
graphically corrected and
demonstrates
the correlation (R 2 ) among the corrected and reference measurements of NO concentra-
reference measurements of NO concentration, while Figure 13b graphically
the correlation (R ) among the corrected and reference measurements of NO2 concentra-
2 2 demonstrates
2
tion.
tion. Likewise, Figure
the correlation
Likewise, Figure
(R 14a presents
2) among
14a presents the time
the corrected
the time series
andseries of the
reference
of the predicted values
measurements
predicted values
of NOand
and reference
2 concentra-
reference
measurements of NO concentration, while Figure 14b depicts the correlation (R 2 ) among
measurements of NO22 concentration, while Figure 14b depicts the correlation (R2reference
tion. Likewise, Figure 14a presents the time series of the predicted values and ) among
the
the predicted values
measurements
predicted values
of NOandand reference measurements
2 concentration,
reference measurements
while Figureof of14b
NO
NO concentration.
depicts the correlation (R2) among
22 concentration.
the predicted values and reference measurements of NO2 concentration.

(a) (b)
(a) (b)
Figure 13. Node 3, corrected and reference NO2 measurements: (a) Node 3, time series of corrected
Figure 13. Node 3, corrected and reference NO2 measurements: (a) Node 3, time series of corrected
Figure
and 13. Node
reference NO3, corrected
2 values; (b) and
Nodereference NO2 measurements:
3, correlation of corrected and(a)reference
Node 3, time
NO2 series
values.of corrected
and
and reference
reference NO values; (b)
NO22 values; (b) Node
Node 3,
3, correlation
correlation of
of corrected
corrected and
and reference
reference NO values.
NO22 values.

(a) (b)
(a) (b)
Figure 14. Node 3, predicted and reference NO2 measurements: (a) Node 3, time series of predicted
Figure
and 14. Node
Node
reference 3,2 values;
NO3, predicted and
(b) and
predicted Nodereference NO2 measurements:
3, correlation
reference NO (a)reference
of predicted and Node 3, time
NO2series of predicted
values.
Figure 14. 2 measurements: (a) Node 3, time series of predicted
and reference NO2 values; (b) Node 3, correlation of predicted and reference NO2 values.
and reference NO2 values; (b) Node 3, correlation of predicted and reference NO2 values.
Similarly, for N3, Figure 15a graphically shows the time series of the corrected and
Similarly,
reference for N3,
N3, Figure
measurements
Similarly, for Figure 15a
of O3 15a graphicallywhile
concentration,
graphically showsFigure
shows the time
the time series
15bseries of the
the corrected
demonstrates
of corrected and
the correla-
and
reference
tion
reference measurements
(R ) measurements
2 of O
among the corrected 3 concentration, while
and reference
of O3 concentration, Figure 15b
measurements
while Figure demonstrates the correla-
of O3 concentration.
15b demonstrates the correlation
tion
(R (R2) among
2 ) among the corrected
the corrected and measurements
and reference reference measurements of O3 concentration.
of O3 concentration. Additionally,
Figure 16a illustrates the time series of the predicted values and reference measurements of
O3 concentration, while Figure 16b depicts the correlation (R2 ) among the predicted values
and reference measurements of O3 concentration.
The Kalman filter coefficients values (A, B, C, D) according to (5) and (6), for each of
the node’s sensors, are presented in Table 2.

Table 2. Kalman coefficients (A, B, C, D) of each gas sensor.

N1 NO2 N2 NO2 N3 NO2 N1 O3 N2 O3 N3 O3


A 0.677951 0.6812565 0.735013 0.861465 0.842696 0.83215
B −0.00058 −0.001061 0.000461 −0.00024 0.000275 −0.00026
C −516.399 −522.8114 566.6811 −503.494 473.485 −521.718
Electronics 2024, 13, x FOR PEER REVIEW 13 of 18
Electronics 2024, 13, x FOR PEER REVIEW 13 of 18

Additionally, Figure 16a illustrates the time series of the predicted values and reference
Electronics 2024, 13, 25 Additionally,
measurementsFigure
of O3 16a illustrates the timeFigure
series16b
of the predicted values and(Rreference
13 of 18
concentration, while depicts the correlation 2) among
measurements of O3 concentration,
the predicted values while Figure 16b
and reference measurements of Odepicts the correlation (R ) among
3 concentration.
2

the predicted values and reference measurements of O3 concentration.

(a) (b)
(a) (b)
Figure 15.
Figure 15. Node
Node 3,3, corrected
corrected and
andreference
referenceOO3 measurements:
measurements: (a)(a) Node
Node 3,
3, time
time series
series of
ofcorrected
corrected
Figure 15. Node
and reference O33, corrected
values; and reference
(b) Node O33 measurements:
3, correlation (a)reference
of corrected and Node 3, O time series of corrected
3 values.
and
and reference
reference O values; (b)
O33 values; (b) Node
Node 3,
3, correlation
correlation of
of corrected
corrected and
and reference
reference OO33 values.
values.

(a) (b)
(a) (b)
Figure 16. Node 3, predicted and reference O3 measurements: (a) Node3, time series of predicted
Figure
and 16. Node
reference O33, predicted
values; and reference
(b) Node O3 measurements:
3, correlation (a)reference
of predicted and Node3, time series of predicted
O3 values.
Figure 16. Node 3, predicted and reference O3 measurements: (a) Node3, time series of predicted
and reference O3 values; (b) Node 3, correlation of predicted and reference O3 values.
and reference O3 values; (b) Node 3, correlation of predicted and reference O3 values.
The Kalman filter coefficients values (A, B, C, D) according to (5) and (6), for each of
Electronics 2024, 13, x FOR PEER REVIEWThe Kalman
Figures
the node’s filter
17a and
sensors, coefficients
are17b, values
respectively,
presented in (A,
2. B, C, D)
Tableillustrate theaccording to (5) and
value variations in (6), for each
Kalman 14 of of
18
filter
the node’s sensors,
coefficients A, B, and areC presented
for the NOin Table 2.
2 and O3 low-cost sensors in the sensor nodes.
Table 2. Kalman coefficients (A, B, C, D) of each gas sensor.
Table 2. Kalman coefficients (A, B, C, D) of each gas sensor.
N1 NO2 N2 NO2 N3 NO2 N1 O3 N2 O3 N3 O3
N1 NO2 N2 NO2 N3 NO2 N1 O3 N2 O3 N3 O3
A 0.677951 0.6812565 0.735013 0.861465 0.842696 0.83215
AB 0.677951
−0.00058 0.6812565
−0.001061 0.735013
0.000461 0.861465
−0.00024 0.842696
0.000275 0.83215
−0.00026
BC −0.00058
−516.399 −0.001061
−522.8114 0.000461
566.6811 −0.00024
−503.494 0.000275
473.485 −0.00026
−521.718
C −516.399 −522.8114 566.6811 −503.494 473.485 −521.718
Figure 17a and Figure 17b, respectively, illustrate the value variations in Kalman filter
Figure 17a
coefficients and
A, B, Figure
and C for17b,
the respectively, illustratesensors
NO2 and O3 low-cost the value
in variations
the sensor in Kalman filter
nodes.
coefficients A, B, and C for the NO2 and O3 low-cost sensors in the sensor nodes.

(a) (b)
Figure 17. Variation in Kalman filter coefficients A, B, C of the low-cost sensors; (a) variation in
Figure 17. Variation in Kalman filter coefficients A, B, C of the low-cost sensors; (a) variation in
Kalman filter coefficients for NO2; (b) variation in Kalman filter coefficients for O3.
Kalman filter coefficients for NO2 ; (b) variation in Kalman filter coefficients for O3 .

Next,
Next, the
the indicators
indicatorsmentioned
mentionedininSection
Section 2 for forecasting
2 for error
forecasting evaluation
error were
evaluation ap-
were
plied. The corresponding results are synoptically resented in Table 3 for Mean
applied. The corresponding results are synoptically resented in Table 3 for Mean AbsoluteAbsolute
Deviation, in Table
Deviation, in Table 44 for
forMean
MeanSquare
SquareError,
Error,ininTable
Table5 5for
forMean
Mean Absolute
Absolute Percentage
Percentage Er-
Error,
ror, and in Table 6 for Root Mean Square
and in Table 6 for Root Mean Square Error. Error.

Table 3. MAD of corrected reference values and predicted reference values of each low-cost sensor.

N1 NO2 N2 NO2 N3 NO2 N1 O3 N2 O3 N3 O3


Corrected-Ref 14.8 15.5 13.3 20.0 24.0 21.8
Predicted-Ref 12.8 13.2 12.9 21.1 22.7 23.0
Electronics 2024, 13, 25 14 of 18

Table 3. MAD of corrected reference values and predicted reference values of each low-cost sensor.

N1 NO2 N2 NO2 N3 NO2 N1 O3 N2 O3 N3 O3


Corrected-Ref 14.8 15.5 13.3 20.0 24.0 21.8
Predicted-Ref 12.8 13.2 12.9 21.1 22.7 23.0

Table 4. MSE of corrected–reference values and predicted–reference values of each low-cost sensor.

N1 NO2 N2 NO2 N3 NO2 N1 O3 N2 O3 N3 O3


Corrected-Ref 0.69 0.74 0.62 1.36 1.68 2.25
Predicted-Ref 0.55 0.66 0.55 2.26 2.42 2.33

Table 5. MAPE of corrected–reference values and predicted–reference values of each low-cost sensor.

N1 NO2 N2 NO2 N3 NO2 N1 O3 N2 O3 N3 O3


Corrected-Ref 0.21 0.23 0.20 0.27 0.24 0.33
Predicted-Ref 0.19 0.22 0.19 0.46 0.45 0.46

Table 6. RMSE of corrected–reference values and predicted–reference values of each low-cost sensor.

N1 NO2 N2 NO2 N3 NO2 N1 O3 N2 O3 N3 O3


Corrected-Ref 1.58 1.60 1.60 0.11 0.07 0.15
Predicted-Ref 1.67 1.79 1.80 1.40 1.38 1.39

Receiving the input data using (5) and (6), the Kalman filter is then used to approx-
imate the output results. Specifically, by using the new measurements along with the
current output state, the Kalman filter approximates the next output state and through its
repeatability, it quickly converges to resolve the output.

5.2. Discussion
In this study, the behavior of a Kalman filter was examined with respect to the correc-
tion of the values measured at three nodes using low-cost sensors. Analyzing the data of
the coefficients of the Kalman filter in Table 1, it was observed that among the NO2 gas and
O3 sensors, the B state coefficient relating to the output of the Kalman filter measurements
shows very close values to the actual values. Likewise, it was observed that the A state and
C measurement coefficients, in relation to the vector state of the filter’s output, were similar
regarding A and different regarding C. The coefficient C contributes to the output measure-
ment by varying the last vector state. The value of coefficient C is expected to be different
for each sensor as it contributes to the input value, which is measured using sensors, for
the calculation of the next vector state and finally the prediction of the output value.
The evaluation of the error using MAD, MSE, MAPE, and RMSE gave satisfactory
results. Specifically, applying MAD to the predicted values indicated a small improvement
regarding the NO2 values, while there was no difference regarding the O3 values. Regarding
the MSE, the predicted NO2 values showed improvement, while O3 showed variation.
Similar behavior of the predicted values in relation to the corrected values was also found
with the application of MAPE. In terms of RMSE, it was observed that there was a decrease
in the predicted values in relation to the corrected values. The reduction in RMSE was
very small for the NO2 sensor values, while it was much greater for the O3 sensors. This
variation was directly related to the type of gas recognized by each sensor, and specifically
for the O3 sensor, which exhibited this behavior when acting as a measure of NO2 . As
mentioned previously, the procedure of subtracting NO2 from O3 to correct the O3 value
introduce an error that is corrected by the application of the Kalman filter and appears
when applying RMSE.
Electronics 2024, 13, 25 15 of 18

So, this article contributes to the optimization of measurements from low-cost gaseous
pollutant sensors with the application of the Kalman filter approach as a model for predict-
ing atmospheric pollutant concentration values. The predicted values are within satisfactory
limits, and the proposed method gives more realistic values of the measurements in relation
to the reference values, which makes the values predicted using the Kalman filter more
reliable and trustworthy in the prediction model.
Of course, there many other than Kalman filter methods such as the high-dimensional
model representation technique [50], the machine learning (random forest regression (RFR))
technique [51], and other methods that are used for forecasting applications (e.g., weather
forecasting) such as bias monitoring [52] and statistical model output units (MOS) [53],
which have achieved remarkable results. The main advantage of the application of the
Kalman filter in applications where parameter prediction is needed is that it can be easily
implemented in IoT devices because it has a comparatively low demand for processing
power. Additionally, as shown in Table 7, the application of the Kalman filter to the
measurements from low-cost air quality sensors, in comparison to other methods, not only
achieves a very good correction but also a high correlation degree, which makes it reliable
for the optimization of measurements from low-cost sensors.

Table 7. Comparison of the performance of air quality measurement optimization methods.

Gas Optimization Method R2 Improvement Rate (%)


Cross et al. [50] 0.39 325
Zimmerman et al. [51] 0.92 159
O3
Our work 0.82 137
Cross et al. [50] 0.69 575
Zimmerman et al. [51] 0.75 277
NO2
Our work 0.80 200

6. Conclusions
Air quality monitoring is needed not only in industrial regions but also in most urban
areas. It can be accurately performed by official state organizations and institutions that
use advanced measuring equipment. Yet, low-cost sensors that are able to monitor the
concentration of pollutant gases in ambient air enables citizens to measure air pollution too.
However, the accuracy of such measurements is questionable. This study examined how
the prediction of values attained from low-cost sensors using a Kalman filter can contribute
to the correction of measurement errors. Specifically, treating a sensor as a black box, after
the application of a Kalman filter, filter coefficients can be obtained. These coefficients
are applied to the sensor values in order to optimize the sensor values in relation to the
reference values. Each low-cost measuring device has its own set of coefficient values.
Three low-cost air quality measuring devices were used in this study, and the behavior
of three nitrogen dioxide sensors and three ozone sensors were examined. It is important
to mention that the degree of correlation (R2 ) of the corrected values before the application
of the Kalman filter for the nitrogen dioxide sensors ranged from 0.50 to 0.68, while that
for the ozone sensors ranged from 0.63 to 0.68. After the application of the Kalman filter,
the predicted values had a correlation to the corresponding reference values that ranged
from 0.89 to 0.92 for NO2 sensors and from 0.77 to 0.81 for O3 sensors. Also, all MAD, MSE,
MAPE, and RMSE indicators, when applied to the values before and after the application
of the Kalman filter, were small, thus indicating that the predicted values were close to
the reference values. In addition, by studying the values of the coefficients of the Kalman
filter, it was observed that the state coefficients A and B were very similar, while a greater
degree of variation appeared in the measurement coefficient C, which contributed to the
measurements (measured by the sensor) by changing the next output state of the filter, i.e.,
the optimized output value of the Kalman filter.
Electronics 2024, 13, 25 16 of 18

This study confirms that the accuracy of low-cost sensors may be considerably im-
proved by applying corrective procedures such as those presented in this article.

Author Contributions: Conceptualization, I.S. and I.C.; methodology, I.S., O.T., D.K. and I.C.;
software, I.C.; validation, I.S., O.T., D.K. and I.C.; formal analysis, D.K. and I.C.; investigation, I.C.;
resources, D.K. and I.C.; data curation, O.T. and I.C.; writing—original draft preparation, I.C. and D.K.;
writing—review and editing, O.T., D.K. and I.S.; visualization, I.C.; supervision, D.K. and I.S.; project
administration, I.S. All authors have read and agreed to the published version of the manuscript.
Funding: This research received no external funding.
Data Availability Statement: All of the data created in this study are presented in this article.
Conflicts of Interest: The authors declare no conflict of interest.

References
1. Ma, X.; Zhang, T.; Ji, C.; Zhai, Y.; Shen, X.; Hong, J. Threats to Human Health and Ecosystem: Looking for Air-Pollution Related
Damage since 1990. Renew. Sustain. Energy Rev. 2021, 145, 111146. [CrossRef]
2. Li, W.-W. Air Pollution, Air Quality, Vehicle Emissions, and Environmental Regulations. In Traffic-Related Air Pollution; Elsevier:
Amsterdam, The Netherlands, 2020; pp. 23–49. [CrossRef]
3. Miller, L.; Xu, X. Ambient PM2.5 Human Health Effects—Findings in China and Research Directions. Atmosphere 2018, 9, 424.
[CrossRef]
4. Dastoorpoor, M.; Riahi, A.; Yazdaninejhad, H.; Borsi, S.H.; Khanjani, N.; Khodadadi, N.; Mohammadi, M.J.; Aghababaeian, H.
Exposure to Particulate Matter and Carbon Monoxide and Cause-Specific Cardiovascular-Respiratory Disease Mortality in Ahvaz.
Toxin Rev. 2020, 40, 1362–1372. [CrossRef]
5. Manisalidis, I.; Stavropoulou, E.; Stavropoulos, A.; Bezirtzoglou, E. Environmental and Health Impacts of Air Pollution: A Review.
Front. Public Health 2020, 8, 14. [CrossRef]
6. Sun, Z.; Zhu, D. Exposure to Outdoor Air Pollution and Its Human Health Outcomes: A Scoping Review. PLoS ONE 2019,
14, e0216550. [CrossRef]
7. Christakis, I.; Moutzouris, K.; Tsakiridis, O.; Stavrakas, I. Barometric Pressure as a correction factor for low-cost particulate matter
sensors. In IOP Conference Series: Earth and Environmental Science; IOP Publishing: Athens, Greece, 2022; Volume 1123.
8. Han, P.; Mei, H.; Liu, D.; Zeng, N.; Tang, X.; Wang, Y.; Pan, Y. Calibrations of Low-Cost Air Pollution Monitoring Sensors for CO,
NO2 , O3 , and SO2 . Sensors 2021, 21, 256. [CrossRef]
9. Migos, T.; Christakis, I.; Moutzouris, K.; Stavrakas, I. On the Evaluation of Low-cost PM Sensors for Air Quality Estimation. In
Proceedings of the 8th International Conference on Modern Circuits and Systems Technologies (MOCAST), Thessaloniki, Greece,
13–15 May 2019. [CrossRef]
10. Bauerová, P.; Šindelářová, A.; Rychlík, Š.; Novák, Z.; Keder, J. Low-Cost Air Quality Sensors: One-Year Field Comparative
Measurement of Different Gas Sensors and Particle Counters with Reference Monitors at Tušimice Observatory. Atmosphere 2020,
11, 492. [CrossRef]
11. Liu, X.; Jayaratne, R.; Thai, P.; Kuhn, T.; Zing, I.; Christensen, B.; Lamont, R.; Dunbabin, M.; Zhu, S.; Gao, J.; et al. Low-Cost
Sensors as an Alternative for Long-Term Air Quality Monitoring. Environ. Res. 2020, 185, 109438. [CrossRef]
12. Kang, Y.; Aye, L.; Ngo, T.D.; Zhou, J. Performance Evaluation of Low-Cost Air Quality Sensors: A Review. Sci. Total Environ. 2021,
818, 151769. [CrossRef]
13. Christakis, I.; Hloupis, G.; Tsakiridis, O.; Stavrakas, I. Integrated open source air quality monitoring platform. In Proceedings of
the 11th International Conference on Modern Circuits and Systems Technologies (MOCAST), Bremen, Germany, 8–10 June 2022.
[CrossRef]
14. Riddick, S.N.; Mauzerall, D.L.; Celia, M.; Allen, G.; Pitt, J.; Kang, M.; Riddick, J.C. The Calibration and Deployment of a Low-Cost
Methane Sensor. Atmos. Environ. 2020, 230, 117440. [CrossRef]
15. Piedrahita, R.; Xiang, Y.; Masson, N.; Ortega, J.; Collier, A.; Jiang, Y.; Li, K.; Dick, R.P.; Lv, Q.; Hannigan, M.; et al. The
next Generation of Low-Cost Personal Air Quality Sensors for Quantitative Exposure Monitoring. Atmos. Meas. Tech. 2014,
7, 3325–3336. [CrossRef]
16. Wang, Y.; Li, J.; Jing, H.; Zhang, Q.; Jiang, J.; Biswas, P. Laboratory Evaluation and Calibration of Three Low-Cost Particle Sensors
for Particulate Matter Measurement. Aerosol Sci. Technol. 2015, 49, 1063–1077. [CrossRef]
17. Gamboa, V.S.; Kinast, É.J.; Pires, M. System for Performance Evaluation and Calibration of Low-Cost Gas Sensors Applied to Air
Quality Monitoring. Atmos. Pollut. Res. 2023, 14, 101645. [CrossRef]
18. Margaritis, D.; Keramydas, C.; Papachristos, I.; Lambropoulou, D. Calibration of Low-Cost Gas Sensors for Air Quality Monitoring.
Aerosol Air Qual. Res. 2021, 21, 210073. [CrossRef]
19. Casey, J.G.; Hannigan, M.P. Testing the Performance of Field Calibration Techniques for Low-Cost Gas Sensors in New Deployment
Locations: Across a County Line and across Colorado. Atmos. Meas. Tech. 2018, 11, 6351–6378. [CrossRef]
Electronics 2024, 13, 25 17 of 18

20. Topalovic, D.; Davidović, M.; Jovanović, M.; Bartonova, A.; Ristovski, Z.; Jovasevic-Stojanovic, M. In Search of an Optimal In-Field
Calibration Method of Low-Cost Gas Sensors for Ambient Air Pollutants: Comparison of Linear, Multilinear and Artificial Neural
Network Approaches. Atmos. Environ. 2019, 213, 640–658. [CrossRef]
21. Gonzalez, A.; Boies, A.; Swason, J.; Kittelson, D. Field Calibration of Low-Cost Air Pollution Sensors. Atmos. Meas. Tech. Discuss.
2019, 1–17. [CrossRef]
22. Kalman, R.E. A New Approach to Linear Filtering and Prediction Problems. J. Basic Eng. 1960, 82, 35. [CrossRef]
23. Shang, Z.; Deng, T.; He, J.; Duan, X. A Novel Model for Hourly PM2.5 Concentration Prediction Based on CART and EELM. Sci.
Total Environ. 2019, 651, 3043–3052. [CrossRef]
24. Djebbri, N.; Rouainia, M. Artificial neural networks based air pollution monitoring in industrial sites. In Proceedings of the 2017
International Conference on Engineering and Technology (ICET), Antalya, Turkey, 21–23 August 2017; pp. 1–5. [CrossRef]
25. Mercer, L.D.; Szpiro, A.A.; Sheppard, L.; Lindström, J.; Adar, S.D.; Allen, R.W.; Avol, E.L.; Oron, A.P.; Larson, T.; Liu, L.-J.; et al.
Comparing Universal Kriging and Land-Use Regression for Predicting Concentrations of Gaseous Oxides of Nitrogen (NOx) for
the Multi-Ethnic Study of Atherosclerosis and Air Pollution (MESA Air). Atmos. Environ. 2011, 45, 4412–4420. [CrossRef]
26. Christakis, I.; Tsakiridis, O.; Kandris, D.; Stavrakas, I. Air Pollution Monitoring via Wireless Sensor Networks: The Investigation
and Correction of the Aging Behavior of Electrochemical Gaseous Pollutant Sensors. Electronics 2023, 12, 1842. [CrossRef]
27. Al-Janabi, S.; Rawat, S.; Patel, A.; Al-Shourbaji, I. Design and Evaluation of a Hybrid System for Detection and Prediction of
Faults in Electrical Transformers. Int. J. Electr. Power Energy Syst. 2015, 67, 324–335. [CrossRef]
28. Dueñas, C.; Fernández, M.C.; Cañete, S.; Carretero, J.; Liger, E. Analyses of Ozone in Urban and Rural Sites in Málaga (Spain).
Chemosphere 2004, 56, 631–639. [CrossRef]
29. Hua, S.; Wang, S.; Jin, S.; Feng, S.; Wang, B. Wind Speed Optimisation Method of Numerical Prediction for Wind Farm Based on
Kalman Filter Method. J. Eng. 2017, 2017, 1146–1149. [CrossRef]
30. Apriliani, E.; Arif, D.K.; Sanjoyo, B.A. The square root ensemble Kalman filter to estimate the concentration of air pollution. In
Proceedings of the 2010 IEEE, International Conference on Mathematical Application in Engineering (ICMAE’10), Kuala Lumpur,
Malaysia, 3–5 August 2010.
31. Lai, X.; Yang, T.; Wang, Z.; Chen, P. IoT Implementation of Kalman Filter to Improve Accuracy of Air Quality Monitoring and
Prediction. Appl. Sci. 2019, 9, 1831. [CrossRef]
32. Metia, S.; Oduro, S.D.; Ha, Q.P.; Duc, H.; Azzi, M. Environmental Time Series Analysis and Estimation with Extended Kalman
Filtering. In Proceedings of the 2013 1st International Conference on Artificial Intelligence, Modelling and Simulation, Kota
Kinabalu, Malaysia, 3–5 December 2013. [CrossRef]
33. Galanis, G.; Louka, P.; Katsafados, P.; Pytharoulis, I.; Kallos, G. Applications of Kalman Filters Based on Non-Linear Functions to
Numerical Weather Predictions. Ann. Geophys. 2006, 24, 2451–2460. [CrossRef]
34. Achar, A.; Bharathi, D.; Kumar, B.A.; Vanajakshi, L. Bus Arrival Time Prediction: A Spatial Kalman Filter Approach. IEEE Trans.
Intell. Transp. Syst. 2020, 21, 1298–1307. [CrossRef]
35. Kumar, S.V. Traffic Flow Prediction Using Kalman Filtering Technique. Procedia Eng. 2017, 187, 582–587. [CrossRef]
36. Mastali, M.; Vazquez-Arenas, J.; Fraser, R.; Fowler, M.; Afshar, S.; Stevens, M. Battery State of the Charge Estimation Using
Kalman Filtering. J. Power Sources 2013, 239, 294–307. [CrossRef]
37. Fitria, R.; Arif, D.K. State Variable Estimation of Nonisothermal Continuous Stirred Tank Reactor Using Fuzzy Kalman Filter. Int.
J. Comput. Sci. Appl. Math. 2017, 3, 16. [CrossRef]
38. Soubdhan, T.; Ndong, J.; Ould-Baba, H.; Do, M.-T. A Robust Forecasting Framework Based on the Kalman Filtering Approach
with a Twofold Parameter Tuning Procedure: Application to Solar and Photovoltaic Prediction. Sol. Energy 2016, 131, 246–259.
[CrossRef]
39. Arif, D.K.; Adzkiya, D.; Aditya, P.; Winata, F.; Agustin, D.; Habibi, M.R.; Ririsati, A.; Prasyanto, R. Modeling of Three-Dimensional
Radar Tracking System and Its Estimation Using Extended Kalman Filter. In Proceedings of the 2017 5th International Conference
on Instrumentation, Control, and Automation (ICA), Yogyakarta, Indonesia, 9–11 August 2017. [CrossRef]
40. Leleux, D.; Claps, R.; Chen, W.; Tittel, F.K.; Harman, T.L. Applications of Kalman Filtering to Real-Time Trace Gas Concentration
Measurements. Appl. Phys. B 2002, 74, 85–93. [CrossRef] [PubMed]
41. De Ridder, K.; Kumar, U.; Lauwaet, D.; Blyth, L.; Lefebvre, W. Kalman Filter-Based Air Quality Forecast Adjustment. Atmos.
Environ. 2012, 50, 381–384. [CrossRef]
42. Metia, S.; Nguyen, H.A.D.; Ha, Q.P. IoT-Enabled Wireless Sensor Networks for Air Pollution Monitoring with Extended
Fractional-Order Kalman Filtering. Sensors 2021, 21, 5313. [CrossRef] [PubMed]
43. Kandris, D.; Nakas, C.; Vomvas, D.; Koulouras, G. Applications of Wireless Sensor Networks: An Up-To-Date Survey. Appl. Syst.
Innov. 2020, 3, 14. [CrossRef]
44. Evangelakos, E.A.; Kandris, D.; Rountos, D.; Tselikis, G.; Anastasiadis, E. Energy Sustainability in Wireless Sensor Networks: An
Analytical Survey. J. Low Power Electron. Appl. 2022, 12, 65. [CrossRef]
45. Christakis, I.; Hloupis, G.; Stavrakas, I.; Tsakiridis, O. Low-cost sensor implementation and evaluation for measuring NO2 and
O3 pollutants. In Proceedings of the 2020 9th International Conference on Modern Circuits and Systems Technologies (MOCAST),
Bremen, Germany, 7–9 September 2020. [CrossRef]
46. Alphasense UK-Browse Gas Sensors & Air Quality Monitors. Alphasense. Available online: http://www.alphasense.com
(accessed on 14 June 2023).
Electronics 2024, 13, 25 18 of 18

47. PMS5003---Laser PM2.5 Sensor-Plantower Technology. Available online: https://www.plantower.com/en/products_33/74.html


(accessed on 14 June 2023).
48. Air Pollution Measurement Data. Ministry of Environment & Energy, Greece. Available online: https://ypen.gov.gr/perivallon/
poiotita-tis-atmosfairas/dedomena-metriseon-atmosfairikis-rypansis/ (accessed on 14 June 2023).
49. Alphasense Application Note AAN 803-01 Correcting for Background Currents in Four Electrode Toxic Gas Sensors. 2014.
Available online: https://zueriluft.ch/makezurich/AAN803.pdf (accessed on 5 December 2023).
50. Cross, E.S.; Williams, L.R.; Lewis, D.K.; Magoon, G.R.; Onasch, T.B.; Kaminsky, M.L.; Worsnop, D.R.; Jayne, J.T. Use of
Electrochemical Sensors for Measurement of Air Pollution: Correcting Interference Response and Validating Measurements.
Atmos. Meas. Tech. 2017, 10, 3575–3588. [CrossRef]
51. Zimmerman, N.; Presto, A.A.; Kumar, S.P.N.; Gu, J.; Hauryliuk, A.; Robinson, E.S.; Robinson, A.L. A Machine Learning Calibration
Model Using Random Forests to Improve Sensor Performance for Lower-Cost Air Quality Monitoring. Atmos. Meas. Tech. 2018,
11, 291–313. [CrossRef]
52. Zhang, H.; Huang, F.; Hong, X.; Wang, P. A Sensor Bias Correction Method for Reducing the Uncertainty in the Spatiotemporal
Fusion of Remote Sensing Images. Remote Sens. 2022, 14, 3274. [CrossRef]
53. Petetin, H.; Bowdalo, D.; Bretonnière, P.A.; Guevara, M.; Jorba, O.; Mateu Armengol, J.; Samso Cabre, M.; Serradell, K.; Soret, A.;
Pérez Garcia-Pando, C. Model Output Statistics (MOS) Applied to Copernicus Atmospheric Monitoring Service (CAMS) O3
Forecasts: Trade-Offs between Continuous and Categorical Skill Scores. Atmos. Chem. Phys. 2022, 22, 11603–11630. [CrossRef]

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual
author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to
people or property resulting from any ideas, methods, instructions or products referred to in the content.

You might also like