0% found this document useful (0 votes)
35 views14 pages

Fine Time Measurement For The Internet of Things A Practical Approach Using ESP32

The document discusses the implementation and performance of the Fine Time Measurement (FTM) protocol in the ESP32-XX series of chips for improving localization in the Internet of Things (IoT). It highlights the challenges of sensor localization in various environments and presents a machine learning-based approach for accurate distance estimation. The findings indicate that the ESP32-S2 model supports FTM, offering a promising solution for location-based services in IoT applications.

Uploaded by

sr.crs.117
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)
35 views14 pages

Fine Time Measurement For The Internet of Things A Practical Approach Using ESP32

The document discusses the implementation and performance of the Fine Time Measurement (FTM) protocol in the ESP32-XX series of chips for improving localization in the Internet of Things (IoT). It highlights the challenges of sensor localization in various environments and presents a machine learning-based approach for accurate distance estimation. The findings indicate that the ESP32-S2 model supports FTM, offering a promising solution for location-based services in IoT applications.

Uploaded by

sr.crs.117
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/ 14

IEEE INTERNET OF THINGS JOURNAL, VOL. 9, NO.

19, 1 OCTOBER 2022 18305

Fine Time Measurement for the Internet of Things:


A Practical Approach Using ESP32
Valentín Barral Vales , Omar Campos Fernández , Tomás Domínguez-Bolaño ,
Carlos J. Escudero , Senior Member, IEEE, and José A. García-Naya , Senior Member, IEEE

Abstract—In the world of Internet of Things (IoT), obtain- and better location-based services (LBS). Recently, the global
ing the physical location of devices has always been a task of pandemic of COVID-19 demonstrated the important need not
great interest for developing increasingly complex location-based only to know all kinds of data, such as CO2 rates or occu-
services (LBS). That is why in recent years wireless communi-
cation standards have been incorporating new additions focused pancy levels but also to know the physical location of the
on providing localization mechanisms to technologies widely used sensors that produce them [2]. The location of sensors within
in the IoT world, such as Wi-Fi or Bluetooth. In particular, the the aforementioned scenarios often becomes challenging due
IEEE 802.11-2016 Wi-Fi standard introduced ranging estimation to the following reasons [3].
between two devices through the so-called fine time measurement 1) In many occasions, global navigation satellite system
(FTM) protocol, defined by the IEEE 802.11mc. FTM is not yet
widespread in the IoT field, but commercial modules capable of (GNSSs) are not an option because the sensors are
offering this functionality at a reasonable price are starting to located in scenarios (inside buildings, urban canyons,
appear. In early 2021, the most widespread system on a chip etc.) where the performance of such systems is very
(SOC) family among IoT devices, the ESP32-XX series, added poor or they simply do not work. And even in open areas
support for this Wi-Fi standard, enabling, for the first time, the where these systems could work, the cost of adding such
use of a standard designed for location-based systems. This arti-
cle analyzes the performance of this FTM implementation by capabilities to the sensors would be too high to be viable
carrying out and studying several measurement campaigns in for large-scale deployments.
different indoor and outdoor scenarios. Additionally, this work 2) The complexity of the scenarios in which IoT sensors are
proposes an alternative real-time implementation for distance placed often makes their localization very difficult. This
estimation inside the ESP32 using an approach based on machine is especially true when radio frequency (RF) technolo-
learning. Such an implementation is successfully validated in a
scenario totally different than those considered for the train- gies are employed. Phenomena such as interference or
ing and test sets. Finally, both the measurement sets and the non-line of sight (NLOS) propagation yield significant
developed software are available to the scientific community. errors in position estimates.
Index Terms—Location management, low-cost sensors and 3) Typical deployments in the IoT world require the instal-
devices, other sensors and devices, other services and applications lation of many sensors, which means that the individual
topics. cost of each unit must also be very low in order not to
exceed the project budget. Therefore, in certain cases,
some localization technologies are excluded in advance
I. I NTRODUCTION for budget reasons, even if they perform satisfactorily.
CCURATE location of sensors in the Internet of Things There are, therefore, numerous technological alternatives to
A (IoT) world is important in multiple areas of interest,
such as smart cities and buildings, healthcare environments,
achieve position estimation within the IoT world, each with
its own particular characteristics in terms of accuracy level,
industry, or agriculture [1]. All of them demand location tech- deployment and maintenance costs, reliability, or operational
nologies capable of positioning the sensors to deliver more requirements.
Among the various localization systems available [4]–[6],
Manuscript received 29 September 2021; revised 20 December 2021 those based on RF are some of the most popular. Their
and 9 February 2022; accepted 26 February 2022. Date of publication basic operation consists of emitting and receiving some type
11 March 2022; date of current version 23 September 2022. This work
was supported in part by the Galician Innovation Agency (GAIN) and the of waveform with certain characteristics and extracting from
Regional Ministry of Economy, Employment, and Industry, Xunta de Galicia this transmission some physical parameters that allow for
through ERDF under Grant COV20/00604; in part by the Xunta de Galicia estimating the position of the emitter or receiver.
under Grant ED431C 2020/15 and Grant ED431G 2019/01 to support the
Centro de Investigación de Galicia “CITIC”; in part by the Agencia Estatal de Based on these RF-based technologies, there are numer-
Investigación of Spain under Grant RED2018-102668-T and Grant PID2019- ous implementations, including radio frequency identification
104958RB-C42; and in part by the European Regional Development Fund (RFID) [7], Wi-Fi (IEEE 802.11) [8], Bluetooth/Bluetooth
(ERDF) Funds of the EU (FEDER Galicia 2014–2020 and AEI/FEDER
Programs, UE). (Corresponding author: Valentín Barral Vales.) low energy (BLE) [9], ZigBee [10], and ultra wideband
The authors are with the CITIC Research Center, Department of (UWB) [11].
Computer Engineering, University of A Coruña, 15071 A Coruña, Spain However, when applications require very accurate and
(e-mail: [email protected]; [email protected]; [email protected];
[email protected]; [email protected]). precise localization, the range of technologies that can be con-
Digital Object Identifier 10.1109/JIOT.2022.3158701 sidered is restricted [4]. Traditional technologies exclusively
This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/
18306 IEEE INTERNET OF THINGS JOURNAL, VOL. 9, NO. 19, 1 OCTOBER 2022

provide received signal strength (RSS) estimates, which can be from U.S. $471 millions in 2020 to U.S. $1656 millions
heavily affected by the signal propagation conditions, and thus in 2025 with a compound annual growth rate (CAGR) of
they may be highly variable and unpredictable, especially in 28.6% [26].
indoor environments. Therefore, in recent years, newer tech- In addition, we should keep in mind that the consumer
nologies providing parameters, such as time of arrival (TOA), device industry and communities are focused on the devel-
time difference of arrival (TDOA), angle of arrival (AOA), or opment of devices based on the ESP32-XX family for
angle of departure (AOD), are considered since they exhibit multiple reasons: low cost (around U.S. $5 each), low
a much better accuracy and precision than those based on energy consumption, compatibility with popular development
RSS. Many of the latest versions of RF-based wireless com- environments (Arduino, MicroPython, etc.), and the avail-
munication standards offer these new alternatives since they ability of high-quality documentation. Thus, a wide variety
are evolving with the aim of providing reliable references of applications have emerged in various fields (industry,
for application in location systems. In particular, Wi-Fi (with home automation, monitoring, security, wearables, surveil-
amendments IEEE 802.11az/bd/mc) [12]–[14] and 5G [15], lance, location, traceability, etc.). Another example of its
[16] provide TOA and TDOA, whereas Bluetooth 5.1 with success is that there is a wide variety of firmware versions
direction finding [17] provides AOA and AOD. that allow these SOCs to be integrated in various automation
Wi-Fi networks are one of the widely used mechanisms projects, for example, ESPHome [27], Tasmota [28], or ESP
for communication between IoT nodes (e.g., in home automa- easy [29].
tion). In previous years, the Task Group mc (TGmc) of the This article focuses on assessing whether the existing FTM
IEEE 802.11 Working Group (IEEE 802.11mc), incorporated implementation in a module, such as the ESP32-S2, is mature
several amendments into the IEEE 802.11 standards, result- enough in terms of accuracy and robustness to build large-scale
ing in the publication of the IEEE 801.11-2016 standard in LBS in the IoT world. For this purpose, several measurement
2016. This standard incorporates a new protocol for esti- campaigns were carried out in realistic and heterogeneous
mating the propagation time between devices, the so-called environments, including indoors and outdoors, recording the
fine time measurement (FTM) protocol. The advantage of distance values estimated by the chip and comparing them
this standard is that it has been introduced in recent years with the actual values. The data set of such measurements is
into consumer devices and, for example, is supported by publicly available in [30].
the Android operating system since version 9.0 (Android Pie During this performance study, a large difference in the
with API level 28) [18]. In fact, some tests with commer- distance estimation from the raw time values was observed
cial smartphones using this standard are already available depending on the measuring scenario: indoors or outdoors.
in [19]–[21]. Therefore, taking advantage of the ease of programming
The same is not true for the implementation of this tech- the ESP32, this article presents another contribution: the
nology in devices employed in the IoT world. In this case, proposal of an alternative method to estimate the distance
there are very few choices offering Wi-Fi FTM off-the-shelf. from the raw time values returned by the Wi-Fi module.
One of the main reasons is that most Wi-Fi modules on the Such a proposal is based on the use of machine learning
market are not yet compatible with the 802.11-2016 standard, (ML) algorithms trained with part of the acquired data dur-
and only a few recent models, such as the 88W8987 family ing the measurements. The performance of this alternative
from NXP [22], offer this functionality. It is important to men- is tested not only with offline measurements but also with
tion that these modules do not offer an autonomous solution a real-time implementation running on the ESP32-S2 chip.
since they need an external microcontroller to act as a host and Moreover, such a real-time implementation is validated in
communicate with them. However, there is another alternative, a scenario totally different than those considered for the
which are the system on a chip (SOC) devices that already training and test sets. Finally, the code of such an implemen-
incorporate a microcontroller (typically a low-power model), tation was also publicly released under an open-source license
and a series of additional communication modules such as (see [31]–[34]).
Wi-Fi or Bluetooth. Several chips of this type are available The remainder of this article is organized as follows.
off-the-shelf, such as the 88MW32X from NXP [23], or the Section II includes an analysis of the state of the art related to
CYW43907, CYW43903, and CYW54907 from Cypress [24]. Wi-Fi FTM measurements. Section III describes the ESP32-S2
In all these models, however, the Wi-Fi module built into the and the measurement scenarios. The obtained results are ana-
SOC does not support the 802.11-2016 standard. Currently, to lyzed in Section IV, whereas Section V presents an approach
the best of our knowledge, the only option available on the based on ML to obtain distance estimates considering both
market with FTM support is the well-known ESP32-XX fam- round trip time (RTT) and received signal strength indi-
ily of chips from the Chinese manufacturer Espressif Systems. cator (RSSI). A description of a new testing scenario to
Specifically, its ESP32-S2 model released in late 2019 was the check the robustness of the estimation using ML is included
first to support FTM, with the release in February 2021 of its in Section VI together with the results obtained after the
firmware version 4.3-Beta1 [25]. experiments. Section VII details the implementation of the
It is more than likely that this will lead to an explo- estimator built within the ESP32-S2, as well as an analysis
sion of LBS in the IoT world due to the high popularity of the current consumption when performing FTM opera-
and market penetration of these SOC models. It is impor- tions. Finally, Section VIII is devoted to the conclusions and
tant to know that the SOC market is projected to grow future work.
BARRAL VALES et al.: FINE TIME MEASUREMENT FOR INTERNET OF THINGS 18307

II. R ELATED W ORK III. E XPERIMENTAL S ETUP


Since the definition of the FTM protocol in the IEEE A. Fine Time Measurements and the ESP32
802.11-2016, several works have focused on analyzing its The ESP32-S2 [37] is an evolution of the famous ESP8266,
performance in distance and location estimation tasks. massively used in automation projects, which introduces
In [21], a study is presented on the performance of several new Bluetooth and Wi-Fi capabilities. Both ESP32-S2 and
FTM-capable Wi-Fi chips in different indoor and outdoor sce- ESP8266 SOCs are part of a family of low-cost SOC micro-
narios, with and without Line-of-Sight (LoS) propagation. The controllers from Espressif Systems, a Chinese company from
study considered 20 and 40 MHz bandwidths at the 2.4-GHz Shanghai.
frequency band, and a bandwidth of 80 MHz at the 5-GHz In particular, the ESP32-S2 and the ESP32-C3 series have
frequency band. The results showed an accuracy about 1 m recently added support for the IEEE 802.11-2016 standard,
in open space (after correction for a constant offset), and which introduces the FTM protocol to provide ranging esti-
about 5 m in indoors. This work also showed little differ- mates using Wi-Fi links. Basically, this protocol measures
ence between using 20 or 40 MHz bandwidths at the 2.4-GHz the RTT between two devices and, based on this time, esti-
band. However, there was a clear improvement when using the mates the distance between them. These devices can be of
80-MHz bandwidth in the 5-GHz band. any type (access points (APs), mobile terminals, SOCs, etc.),
Dvorecki et al. [35] considered ML to train an artificial provided that they have a Wi-Fi chipset compatible with the
neural network (ANN) capable of predicting the TOA of the 802.11-2016 standard and a firmware that supports FTM. Due
first path in a Wi-Fi signal with the FTM protocol. In this to its enormous market penetration, this work focuses on
case, channel impulse response (CIR) samples are employed, the ESP32-S2, although the results should be similar for the
achieving an estimator that yielded an error below 4 m for ESP32-C3.
90% of the samples analyzed. The ESP32-S2 [37] has integrated support for the IEEE
In [36], different neural networks (NNs) were applied to 802.11 b/g/n and a variety of peripherals. It has 43 general-
perform position estimation using RSS and FTM on different purpose input/output (GPIO) pins, a 240-MHz Xtensa 32-bit
smartphones. Considering the 5-GHz band and a bandwidth LX7 single-core processor with 320 kB of static random-
of 40 MHz, measurements in an indoor environment showed access memory (SRAM), and 128 kB of read-only memory
that only 20% of the samples were below 4 m of error. These (ROM). Compared to its predecessor, the ESP32-S2 SOC
values increased to almost 90% of the samples below 4 m comes with enhanced encryption capabilities and improved
of error when an ANN-based correction factor was applied radio performance. There are also versions of the SOC in
to the raw samples. A comparison between position accuracy the form of modules, such as the ESP32-S2-WROOM and
using RSSI or FTM was performed in [19]. The measurements the ESP32-S2-WROVER; and development kits such as the
were carried out in the 2.4-GHz band and with a bandwidth ESP32-S2-DevKitM-1 or the ESP32-S2-Saola-1. Using the
of 20 MHz. The findings indicated that the RSSI estimates 43 GPIO pins, the device can be configured to provide dif-
outperform those obtained from the FTM sensors, unless the ferent peripheral interfaces, including four serial peripheral
sensors are calibrated individually, in which case the FTM interfaces (SPIs), two inter-IC sound (I2 S) and interinte-
localization is the best. The error values, in this case, yielded grated circuit (I2 C) interfaces, three universal asynchronous
a mean error of 3.52 m for calibrated FTM and a mean error of receiver–transmitter (UART) interfaces, 16 pulse-width mod-
4.47 m using RSSI. Horn [20] used a smartphone to carry out ulation (PWM) channels for light-emitting diodes (LEDs), a
Wi-Fi FTM measurements to obtain a positioning estimator. liquid-crystal display (LCD) interface, a camera interface, 18
To improve its accuracy, the author integrated the measure- analog-to-digital converter (ADC) channels, two 8-bit digital-
ments from two different frequency bands, 2.4 and 5 GHz, to-analog converter (DAC) channels, and 14 capacitive touch
showing that there is no correlation between them. The work interfaces.
also included a study of the possible reasons why errors appear The most important characteristic of the ESP32-S2 for this
with this technology. work is that it supports the IEEE 802.11-2016 standard with
In general, all the aforementioned works showed that the the FTM protocol, which enables localization based on dis-
Wi-Fi FTM technology can provide good results in terms tance estimates between two Wi-Fi devices. However, it should
of accuracy in outdoor environments without obstacles, but be noted that only the 2.4-GHz Wi-Fi band is available, thus
many problems arise in indoor environments. In these com- the bandwidth is restricted to 20 or 40 MHz, which limits the
plex scenarios, the studies showed that, without a minimum accuracy that can be achieved with the FTM protocol [18].
calibration or optimization of each device, the results may More specifically, according to [18], the 90th percentile of the
lead to errors of tens of meters. In all the studies, Wi-Fi error is expected to be 8 m for 40 MHz, 4 m for 20 MHz,
cards or smartphones were used as initiating devices, hence and 2 m for 80 MHz.
none of them addressed the problem of energy consumption
or cost when describing the technology. In this article, we B. Measurement Scenarios
will analyze whether the ESP32-S2 offers results with similar To analyze the performance of the ESP32-S2 module
accuracy to those obtained in previous works, but also take using Wi-Fi RTT, two different measurement campaigns were
into account its characteristics as a device to be used in IoT planned. One of them was carried out in an outdoor envi-
environments. ronment, away from buildings and possible interferences. The
18308 IEEE INTERNET OF THINGS JOURNAL, VOL. 9, NO. 19, 1 OCTOBER 2022

Fig. 2. Indoor measurement setup.


Fig. 1. Indoor scenario.

second one was carried out in an indoor scenario, in a show-


room of the Centre for Information and Communications
Technology Research (CITIC), at the University of A Coruña,
Spain. The ESP32-S2-Saola-1 development boards from
Espressif Systems were used in both cases. Such modules
were mounted on tripods and then placed in a series of known
positions in order to compare the distance estimates with the
actual values. Some of the modules were used as Wi-Fi FTM
responders (acting as beacons) and others as communication
initiators (acting as tags). Fig. 3. Outdoor scenario.

1) Indoor Scenario: The CITIC showroom (see Fig. 1) at


the University of A Coruña, Spain, was selected as an indoor 2) Outdoor Scenario: In order to obtain more information
environment. This is a space dedicated to the dissemination about the capabilities of the ESP32-S2 module for ranging
of the research activities carried out in the center. It is a operations with the Wi-Fi FTM protocol, another measurement
room with many obstacles inside and surrounded by sources of campaign was performed in an outdoor environment. In this
interference such as other Wi-Fi networks (more than 7 were way, we tried to minimize the possible effect of interference
detected with a high signal level from inside the room) coexist- and multipath typically found in indoor scenarios. In fact, in
ing with ZigBee sensor networks and Bluetooth devices. The this scenario, not a single nearby Wi-Fi network was detected
dimensions of the room are 12 m long and 6 m wide, with a that could be a source of interferences. To carry out the mea-
height of 3.2 m. surements, we selected an area of the campus at the University
To have a greater diversity of measurements, reduce data of A Coruña away from the buildings. Only two modules were
collection time, and have a data set applicable to future posi- used in the experiment, one acting as a tag and the other as a
tioning algorithms, four ESP32-S2 devices were placed at the beacon. They were mounted on tripods and placed one in front
corners of the room acting as beacons, while the commu- of the other at the same height (1.75 m). The measurements
nication initiating tag was moved to different points along were taken during 120 s at distances varying from 1 to 20 m,
a straight line. This tag was placed at a height of 2 m. A at 1 m intervals. Two different measurement campaigns were
schematic of the anchors and measurement positions is shown performed, one with the modules configured with a bandwidth
in Fig. 2. Due to some of the obstacles present in the room, of 20 MHz, and the other with a bandwidth of 40 MHz. Fig. 3
measurements could not be taken in certain areas. At each shows a picture of the outdoor measurement scenario.
point, measurements were taken for 180 s and the ESP32-S2
devices were configured to work with a 40-MHz bandwidth,
which is the maximum bandwidth allowed at the 2.4-GHz C. Software Development
band. Notice that, due to the relative placement between tag In order to collect the measurements, several software mod-
and beacons in this scenario, measurements were obtained at ules were implemented. On the one hand, a new firmware was
different distances and with different relative angles between programmed for the ESP32-S2s acting as beacons. In this case,
transmitter and receiver. the application configured the module as a Wi-Fi AP with the
BARRAL VALES et al.: FINE TIME MEASUREMENT FOR INTERNET OF THINGS 18309

FTM responder features enabled. On the other hand, another


firmware was programmed for the module acting as a tag. In
this case, the functionality of this firmware was divided into
three main parts: 1) a scan of APs capable of responding to an
FTM request was performed; 2) once this list was obtained,
the module entered in a loop of FTM requests with each of the
APs detected in the previous phase; and 3) the measurements
obtained were written to the serial port of the development
board.
To assess the collected data from a PC, a Robot Operating
System (ROS) environment was deployed on a Raspberry
Pi 3B. ROS [38] is a software commonly used in robotics
and allows for decoupling communications between hardware
devices (typically sensors) and the software elements in charge
of processing their data. Within ROS, the fundamental working
element is the node. A ROS node can publish information in
a given topic (a text string similar to a file path or a URL) and Fig. 4. Actual versus estimated distance in the indoor scenario.
can also subscribe to the data available from topics published
by other nodes. In our case, we implemented a node capa-
ble of collecting the FTM measurements captured from the 4) t2: Timestamp of the reception of the ranging request
ESP32-S2 (connected via a USB port) and publishing them in at the receiver expressed in picoseconds.
the ROS ecosystem. On the PC we used rosbag, an application 5) t3: Timestamp (in picoseconds) of the response mes-
included by default in ROS that allows for the subscription and sage at the receiver.
subsequent storage of measurements in different logs for later 6) t4: Timestamp (in picoseconds) of the reception of the
analysis. Those measurements were sent from the Raspberry response message from the receiver at the sender.
Pi to the PC via an Ethernet link. Note that the choice of ROS The results corresponding to indoor and outdoor campaigns
in this work has been solely to take advantage of its commu- are analyzed in Sections IV-A and IV-B, respectively.
nication system and its measurement collection tools, and not
because the nature of what is described here is related to the A. Analysis of the Indoor Measurements
field of robotics.
The first information we extract from the measurements cap-
As part of the contributions of this article, the code of all
tured in the indoor environment is the distance estimate. The
these software modules is publicly available as open source.1
ESP32-S2 provides two RTT parameters: 1) rtt_raw, which
corresponds to the average of the values obtained in the differ-
ent frames and 2) rtt_est, which is estimated by the chip.
IV. M EASUREMENTS A NALYSIS
How the rtt_est estimate is obtained from the raw value is
This section shows a descriptive analysis of the measure- not documented by the manufacturer. These RTT parameters
ments obtained in the different campaigns. Each measurement can be easily translated into a distance estimate d using the
includes the following parameters. formula
1) anchorId: Identifier of the module that acted as rtt · c
beacon in the measurement. d= (1)
2
2) rtt_raw: RTT value averaged among the different
frames sent and expressed in nanoseconds. where rtt is the RTT value, and c is the speed of light.
3) rtt_est: RTT estimation provided by the ESP32-S2 Note that depending on the value of rtt used, rtt_est or
firmware in nanoseconds. rtt_raw, two different distance estimates can be obtained.
4) dist_est: Distance estimation in meters. Internally, The ESP32-S2 firmware uses rtt_est to provide an estimate
rtt_est is used to calculate this value. of the distance between the devices available as dist_est.
5) num_frames: The number of frames successfully sent Fig. 4 shows the captured samples, their actual position,
during the RTT communication. and the two estimates: the one provided by the chip itself,
6) frames: A list of all successfully sent frames. dist_est, and the value obtained from rtt_raw using (1).
Each individual frame includes the following information. The values obtained in this indoor environment are clearly
1) rssi: RSS in dBm. very inaccurate. There are large differences between actual
2) rtt: RTT value for that frame in nanoseconds. and estimated values. It can be seen that the estimates based
3) t1: Outgoing timestamp of the first packet from the on the rtt_raw value lead to the worst results, whereas those
sender in picoseconds. based on the dist_est achieve a significant improvement in
terms of accuracy. The error level obtained can be better seen
1 The in Fig. 5, where the empirical cumulative distribution function
source code can be downloaded from
https://github.com/valentinbarral/*, where * is one of these project identifiers: (ECDF) of the absolute error is shown for both cases. Besides
esp32s2-ftm-tag, esp32s2-ftm-anchor, rosftm, or rosmsgs (see [31]–[34]). observing the general level of inaccuracy of the measurements,
18310 IEEE INTERNET OF THINGS JOURNAL, VOL. 9, NO. 19, 1 OCTOBER 2022

Fig. 5. ECDF of the absolute error in the indoor scenario. Fig. 7. Comparison between actual and estimated distances for both outdoor
data sets, and for bandwidth values of 20 and 40 MHz.

B. Analysis of the Outdoor Measurements


Fig. 7 shows the distance estimates obtained for the two
bandwidth values considered (20 and 40 MHz) versus the
actual distance. As in the indoor case, both the distance val-
ues provided directly by the chip (dist_est) and those
generated from the temporal rtt_raw values from (1) are
shown. In Fig. 7, it can be seen that how the estimated val-
ues are much closer to the actual ones than in the indoor
case (shown in Fig. 4) for both the 20 and 40 MHz band-
width values. However, in this scenario, a counter-intuitive
phenomenon can be seen: the estimates generated with the raw
RTT values (rtt_raw) are closer to the actual values than
the estimates provided by the chip. Such a phenomenon can
be clearly observed in Fig. 8, where the estimates from the
Fig. 6. Mean RSSI for each measurement versus actual distance for the ESP32-S2 are noticeably worse than those obtained directly
indoor scenario. from rtt_raw. This effect is clearly visible in the measure-
ments corresponding to the 20-MHz data set, whereas in the
40-MHz data sets, both values are more similar. This appar-
with errors up to 20 m in some cases, we can see that the ent inconsistency is discussed in more detail in Section IV-C.
distance estimates obtained by the chip are able to improve Fig. 8 also shows that the raw values from the 20-MHz con-
those from the raw RTT samples. As an example, by means figuration (rtt_raw) yield better results than those obtained
of the ESP32-S2 estimation, about 75% of the measurements with 40 MHz, whereas with the values estimated by the chip
are below 5 m of error, whereas using the rtt_raw parameter (dist_est), this effect is reversed, and the 40-MHz results
only 50% are below such a threshold. are slightly better.
Another parameter of interest is the RSSI value. Fig. 6 Finally, Fig. 9 shows the RSSI values corresponding to the
shows the different measurements in the indoor scenario two bandwidths obtained in the outdoor scenario. We can see
according to their RSSI value and the actual distance at which that the RSSI values exhibit less small-scale fading than in
they were taken. Note that the ESP32-S2 does not gener- the indoor case (see Fig. 6), and they are similar regardless
ate an RSSI value for each FTM sample, but rather for each of the bandwidth. The energy clearly decreases with distance,
frame transmitted within an FTM communication. In this case, although there are points where multipath effects are observed,
the RSSI values shown in Fig. 6 correspond to the average probably caused by the signal bouncing off the ground or other
of all the frames in each FTM sample. It can be observed obstacles close to the measurement area.
that there is a slight decay of the energy as the distance
between the devices increases. However, the strong multipath
propagation in the indoor environment leads to a severe C. Estimated RTT Versus Raw RTT
small-scale fading, and some samples are obtained with high After the analysis of the data captured in the different
RSSI values at long distances and low RSSI values at short measurement campaigns, one of the most surprising aspects
distances. detected was the difference in accuracy between the distance
BARRAL VALES et al.: FINE TIME MEASUREMENT FOR INTERNET OF THINGS 18311

Fig. 8. ECDF of the absolute error for both outdoor data sets and for both Fig. 10. rtt_raw − rtt_est for all data sets.
bandwidth values (20 and 40 MHz).

that depends linearly on its value. Such a linear relation-


ship has a different gradient depending on whether the values
are below 10 ns, between 10 and 124 ns, or above 124 ns.
Probably, due to the still recent implementation of the FTM
support on these chips, the chosen correction is not the best.
Although it is difficult to say for sure, it seems that an attempt
was made to improve the accuracy in indoor environments (a
typical scenario to use a Wi-Fi module) at the cost of wors-
ening the results in better conditions, with a good LoS, and
in the absence of obstacles or significant interference between
the devices. What does seem clear is that these thresholds,
located at 10 and 124 ns, are consistent across all measure-
ment scenarios, so they must be hard-coded in the ESP32-S2
firmware.

V. P ROPOSED E STIMATOR BASED ON


Fig. 9. RSSI versus actual distance for both outdoor data sets, with bandwidth M ACHINE L EARNING
values of 20 and 40 MHz.
After observing the limitations of the current ESP32-S2
estimation algorithm described in Section IV-C, an opportu-
nity appears to propose a better alternative. This new method
estimated by the ESP32-S2 and the value computed directly should be able to operate within the computational limitations
from the raw RTT values. While in the indoor case, the esti- of the ESP32-S2, so that it must compute the distance estimate
mation improved the raw accuracy, this was not the case in from the rtt_raw in real time and for each FTM commu-
the outdoor measurements, especially for the case with a band- nication, providing a more accurate result. Having hundreds
width of 20 MHz. In the latter case, the ESP32-S2 estimates of data records after the measurement campaigns, one of the
were clearly worse than those obtained using the rtt_raw direct approaches to the problem would be using ML tech-
value directly. niques to generate a regression model of the desired correction.
To try to detect the reason for this behavior, and since there This approach is very common to deal with this type of prob-
is no documentation from the manufacturer about how the lems [35], [39] and was also used previously by the authors
distance estimate is generated by the device, a study of the in previous works for the UWB technology [40].
differences between the rtt_raw and rtt_est values was As training features, we selected the rtt_raw values and
carried out. Fig. 10 shows the difference between these two the average RSSI values, discarding other parameters that did
values for all captured measurements (indoors and outdoors) not provide any improvement in a preliminary study, such as
with respect to the rtt_raw value, in which three linear the number of frames successfully transmitted or the variance
correction models that are directly related to the rtt_raw of rtt_raw for each sample. To create the training set, we
value itself can be identified. That is, in view of these val- randomly selected 70% of the samples from each of the three
ues, it seems clear that, to generate the rtt_est value, the data sets (the one corresponding to the indoor measurements
ESP32-S2 simply applies a correction factor to rtt_raw and the two outdoors) and merged them into a single one. The
18312 IEEE INTERNET OF THINGS JOURNAL, VOL. 9, NO. 19, 1 OCTOBER 2022

TABLE I
remaining samples were reserved as test sets. At the time of M AIN PARAMETERS OF T ESTED ML A LGORITHMS
training, cross-validation was used with fivefold, an adequate
number for the not excessively large size of the training set
(around 7000 samples). The Bayesian optimization [41] was
used to search for the best hyperparameters of each algorithm.
The considered ML algorithms were regression trees,
support vector machines (SVMs), Gaussian process (GP)
regression, and shallow NNs. Their details can be found in
Section V-A. More complex techniques, such as those based on
deep learning, were discarded because of their computational
needs, out of the capabilities of the ESP32-S2, and because
the number of samples available was too low to apply these
techniques with confidence.

A. Description of the ML Algorithms


The considered ML algorithms are described below. All of
them are classical algorithms in the literature, and they are
widely used in regression problems.
1) Regression Trees: This is an intuitive technique based
on binary search trees applied to the regression
problem [42]. The idea of these algorithms is to asso-
ciate homogeneous input sets with the same output. The
minimum leaf size is a fundamental parameter in this
type of algorithms since, depending on its value, the
trees can easily tend to overfitting. In the case presented
in this work, the regression tree had a minimum leaf
size equal to four.
2) SVM: This is another classic ML algorithm originally
Fig. 11. ECDF of the absolute error. Test set: indoors with a bandwidth of
described in [43] that can be used in both classification 20 MHz.
and regression problems [44]. Among the hyperparam-
eters that can be configured in this algorithm, the main
one is the type of kernel used to map the input ele- is one of the most classic ML algorithms, already ref-
ments in the n-dimensional feature space in which the erenced in the middle of the last century, and a pillar
regression process is applied. In the implementation con- of the most complex networks used nowadays in deep
sidered in this work, a Gaussian kernel was chosen with learning [46]. In this work, we implemented a sim-
the form ple configuration with a single hidden layer consisting
    2  of 100 neurons with a rectified linear unit (ReLU)
k xi , xj = exp −xi − xj  (2)
activation function, and a linear activation function in
being xi , xj ∈ Rn with n = 2 since the input vectors the output layer. All these parameters, as in the rest
consider two features in our case. of the algorithms, were obtained using the Bayesian
3) GP: This is a generalization of the Gaussian proba- optimization mechanism limited to 50 iterations.
bility distribution in which the behavior of a function Table I shows a summary of the parameters of each algorithm.
is described. Using this idea, regression and clas-
sification models are built with high accuracy and B. Results of the ML Algorithms
performance [45]. In the implementation considered in
This section shows the results obtained after applying the
this work, we considered an exponential kernel
  trained algorithms to the different test sets, each one com-
k xi , xj = σf2 exp(−r/σl ) (3) ing from a different data set. Fig. 11 shows the ECDF of the
absolute error in the indoor scenario in which all the trained
being xi , xj ∈ Rn , σf is the signal standard deviation, and
ML algorithms exhibit a clear improvement over the estimates
σl is the characteristic length scale. Finally, r is defined
from the ESP32-S2. Even with a simple algorithm, such as
as the Euclidean distance between the vectors xi and xj
 the regression trees, a noticeable improvement is achieved
 T   for most of the samples, being able to place 80% of them
r= xi − xj xi − xj .
below 1.5-m error, whereas with the original estimates, the
After the validation phase, the kernel parameters for the corresponding error increases up to 6 m.
best case were set to σf = 4.6873 and σl = 0.7051. Fig. 12 shows the ECDF of the absolute error in the outdoor
4) Neural Network: The last of the considered classical scenario considering a bandwidth of 20 MHz. This was the
algorithms was a fully connected feedforward NN. This case in which the ESP32-S2 estimates were clearly worse than
BARRAL VALES et al.: FINE TIME MEASUREMENT FOR INTERNET OF THINGS 18313

Fig. 14. Scenario in the Scientific Area building.

Fig. 12. ECDF of the absolute error. Test set: outdoors with a bandwidth of
20 MHz.

Fig. 15. Measurement setup of the scenario in the Scientific Area building.
Anchors 0 and 1 use a bandwidth of 20 MHz, whereas anchors 2 and 3 employ
40 MHz.

experiment was carried out in a completely new measurement


scenario. The details and results obtained from this experiment
are shown in Section VI.

Fig. 13. ECDF of the absolute error. Test set: outdoors with a bandwidth of VI. A SSESSMENT OF THE ML T RAINED M ODELS IN
40 MHz. D IFFERENT E NVIRONMENT
A proposal was presented in Section V to use classical ML
those computed using the rtt_raw parameter directly. In algorithms to estimate the actual distance from the rtt_raw
view of Fig. 12, all the ML algorithms outperform both the value and the signal level. These algorithms were trained with
ESP32-S2 estimates and the values computed from rtt_raw. part of the samples collected in the two proposed scenarios,
Finally, Fig. 13 shows the ECDF of the absolute error also the outdoor and the indoor one. The results of this training
in the outdoor scenario, but in this case using the 40-MHz were tested with the samples from these data sets that had not
bandwidth configuration. With this configuration, and accord- been included in the training set. In a further step, to validate
ing to the ECDF in Fig. 8, there was originally very little this approach and check if it can be used in other different
difference between the ESP32-S2 estimates and the values environments, a new measurement campaign was carried out
computed from the rtt_raw parameter (although the esti- in a different scenario. This new environment is described in
mates yielded the best result, as shown in Fig. 8). However, Section VI-A.
in view of Fig. 13, a significant improvement is observed when
the ML algorithms are employed. A. Test Scenario
In a conclusion, in view of the results shown in To test the trained models, we looked for a scenario differ-
Figs. 11–13, ML-based estimators improve the accuracy of the ent from the outdoor and indoor scenarios already considered.
measurements to some degree. However, it should be noted The place chosen (see Fig. 14) was the ground floor of the
that, although the test set did not include any samples in com- Scientific Area building, a research building located in the
mon with the training set, it is true that the general distribution Campus of Elviña at the University of A Coruña, Spain. From
is similar because they all come from the same data set. For the point of view of radio propagation, it is a complicated sce-
this reason and to assess the robustness of the models, a new nario due to its low ceiling, glazed areas, and metal structures
18314 IEEE INTERNET OF THINGS JOURNAL, VOL. 9, NO. 19, 1 OCTOBER 2022

Fig. 16. ECDF of the absolute error. Test set: Scientific Area building with Fig. 17. Mean RSSI on the measurements captured in the Scientific Area
bandwidth values of 20 and 40 MHz. building with bandwidth values of 20 and 40 MHz.

located at different points. In addition, being a research build- the number of values with errors below 4 m is practically the
ing, there are several nearby devices radiating in the 2.4-GHz same using both approaches.
band that could affect to some degree the communications with As for the predictions of the ML algorithms, we see in
the ESP32-S2. Specifically, after scanning inside the area, 5–7 Fig. 16 that we do not achieve a performance improvement
APs with a medium-low signal level were detected. similar to that obtained with the other data sets. The values
To perform the measurements, four tripods were placed at obtained are very close to the ESP32-S2 estimates, slightly bet-
the corners of a 10 × 5 m rectangle, mounting an ESP32-S2, ter in some cases. The reason for this difference with respect
configured as an anchor, on each of them (at different heights), to the results is due to the nature of the chosen scenario and its
as shown in Fig. 15. Anchors labeled with 0 and 1 employed a propagation problems, as well as by the ESP32-S2 antenna and
bandwidth of 20 MHz, whereas anchors 2 and 3 used 40 MHz. its radiation pattern. Fig. 17 shows the RSSI-level distribution
A series of points were marked within a grid as shown in of the samples with respect to the distance. There are hardly
Fig. 15 and measurements were taken with a fifth ESP32-S2 any differences between the values obtained at a distance of
device mounted on another tripod and moved over each of 1.5 m with respect to those captured at distances of more than
the measurement points. FTM measurements were captured 10 m. If we compare these values with those obtained from
for 120 s at each point using the same software and hardware the other scenarios (see Figs. 6 and 9), we can see that, in this
configuration as in the previous data sets. That is, a Raspberry case, the values are strongly affected by multipath, and there
Pi 3B connected to the ESP32-S2, which acted as a tag, was is not a clear energy drop as the distance between the emitter
in charge of reading the measured values through the serial and the receiver increases. This explains, at least in part, why
port and publishing them within a ROS environment to be the estimation algorithms in this scenario, which were trained
later saved in a remote PC. All the samples collected, as well with the rtt_raw features and the RSSI, do not perform as
as those from the other data sets, are publicly available to the well as in the other scenarios. However, it must be said that
research community in [30]. the estimations are never worse than those provided by the
ESP32-S2, hence it is realistic to think that, in less aggressive
scenarios, the results will be better and more similar to those
B. Results obtained in the initial test scenarios. Therefore, ML algorithms
After performing the measurement campaign in the provide stability and robustness against any kind of scenario,
Scientific Area building, the algorithms trained with the other being a more adequate solution than the one included with the
data sets were run on the new samples. All the results from ESP32-S2 firmware.
this measurement scenario consider simultaneously values cor-
responding to 20 and 40 MHz bandwidth values. Fig. 16 shows
the ECDF of the absolute error and several details of interest VII. D EPLOYMENT IN THE ESP32-S2
can be observed. First, we see that the error is slightly lower Taking advantage of the ESP32-S2 capabilities, one of the
than in the indoor scenario (see Fig. 11), but much higher than previously trained algorithms was implemented inside the
in the outdoor scenario (see Figs. 12 and 13). On the other chip. In particular, due to its simplicity, we implemented
hand, we see that the ESP32-S2 estimation improves the value the regression trees algorithm. This algorithm, once trained,
computed directly from rtt_raw, although the differences has very low computational requirements to generate a new
are smaller than in the indoor scenario. These differences are estimate. In this way, real-time estimates could be obtained
found in the values with the highest level of error, whereas at the same time as the ESP32-S2’s own estimates were
BARRAL VALES et al.: FINE TIME MEASUREMENT FOR INTERNET OF THINGS 18315

Fig. 18. ECDF of the absolute error. Test set: Scientific Area building. Offline Fig. 19. ESP32-S2 current consumption measurement setup.
versus real-time ESP32-S2 implementation considering bandwidth values of
20 and 40 MHz.
5 V, hence the conversion from current to power consumption
is direct.
calculated. Thus, the measurements obtained during the mea- In order to get the current consumption values, the board
surement campaign in the Scientific Area building already was switched to the deep-sleep mode, and the red LED was
include an additional own_est parameter that corresponds removed to save energy and to obtain more realistic cur-
to the real-time estimation provided by this algorithm. rent measurements. The current consumption obtained was
Hence, the ESP32-S2 firmware was modified to include a 560.6 μA, which basically includes the consumption of the
new function whose workflow was: ESP32-S2, the USB-UART bridge, and the low-dropout reg-
1) get the rtt_raw value of the last FTM measurement; ulator (LDO). To break down the consumption of each of
2) generate the average RSSI of all frames correctly sent these components, the ESP32-S2 and the USB-UART bridge
within the measurement; were disassembled, and the consumption was measured again.
3) normalize these values with the same normalization In this way, the LDO consumption was obtained, which was
parameters used during the training phase; 337.9 μA. Taking into account the USB-UART bridge, and the
4) run the regression tree algorithm to estimate a distance ESP32-S2 datasheets [37], [47], the typical current consump-
value; tion, when they are not in use, ranges between 195 and 200 μA
5) add this new value as the own_est parameter within in the case of the USB-UART bridge, and between 20 and
the measurements written to the serial port. 25 μA in the case of the ESP32-S2. The difference between
For the implementation, we started from the code gener- 560.6 and 337.9 μA results in 222.7 μA, which corresponds
ated using the MATLAB Coder utility. Once this base was to the current consumption specified for the ESP32-S2 and
obtained, it was modified and adapted to the needs of the the USB-UART bridge. Once these calculations were avail-
ESP32-S2, both in terms of memory management and the able, the current consumption of the ESP32-S2 module was
use of libraries. This implementation is also publicly avail- estimated, which varies between 222.7 − 200 = 22.7 μA and
able as open source [31]. The final size of the executable is 222.7 − 195 = 27.7 μA.
only 403 kB, out of a total of 4 MB available on the ESP32-S2. Finally, after assembling the components that were removed
Fig. 18 shows the ECDF of the absolute value of the two from the board, the current consumption was measured while
versions: 1) the offline algorithm and 2) the real-time algorithm performing FTM with a resolution of 128 000 points/s. The
implemented within the chip. It can be seen how the results setup can be seen in Fig. 19, whereas Fig. 20 shows the
are practically identical, the small differences being due to obtained results. When the ESP32-S2 is transmitting, high
possible inaccuracies in some values at the time of averaging consumption peaks appear with a maximum of 454 mA, and
the RSSI or the normalization process. when it is not transmitting, the consumption is almost constant
around 73 mA. Since an FTM operation takes 636 ms to com-
plete, during that time the average consumption is 75.6 mA.
A. ESP32 Current Consumption This is a large current value since the microcontroller unit
Within the IoT world, sensor energy consumption is often (MCU) cannot be switched to the deep-sleep mode when it is
a factor of utmost importance. This section shows the current transmitting data. If the chip were switched to the deep-sleep
consumption details of the ESP32-S2 when performing posi- mode when it is not transmitting, the average consumption
tioning tasks using FTM. These measurements were obtained could be reduced significantly.
using an N6705 Keysight DC Power Analyzer (see Fig. 19). This large difference in power consumption between the
Notice that the voltage applied to the power supply was set to idle mode and the FTM transmission mode can be seen more
18316 IEEE INTERNET OF THINGS JOURNAL, VOL. 9, NO. 19, 1 OCTOBER 2022

(a)

Fig. 20. ESP32-S2 current consumption while FTM protocol.

clearly using the concept of the energy budget. This concept (b)
describes the energy consumption of the chip depending on the
Fig. 21. Energy budget for one day performing a different number of
different working modes in which it is configured throughout FTM transmissions. (a) Performing a single FTM transmission per minute.
the day. This idea is similar to the one presented in other (b) Performing a single FTM transmission per 10 min.
works, such as [48] and [49]. Thus, we define the daily energy
budget as TABLE II
FTM C URRENT C ONSUMPTION E STIMATION AND E STIMATED
E(daily budget) = E(idle) + E(FTM) (4) BATTERY L IFETIME W ITH A 2000- M A H BATTERY
where E(daily budget) is the energy consumed by the chip in one
day, E(idle) is the energy consumed when the chip is in the idle
mode, and E(FTM) is the energy consumed when FTM pro-
tocol messages are being transmitted. Obviously, this energy
consumption will be different depending on the number of
FTM measurements taken during the day. Thus, as an exam-
ple, Fig. 21 shows the daily energy budget considering two
different intervals. In the case of Fig. 21(a), the energy values
are considered when performing a single FTM measurement
per minute, while in Fig. 21(b), the values correspond to a
measurement periodicity of 10 min. It can be seen that how
the impact of the FTM measures is very large in the total, even
though the chip spends most of the day in idle mode (98.8%
of the time when the FTM periodicity is 1 min, and 99.89%
of the time when the FTM periodicity is 10 min). have performed several measurement campaigns in different
In order to verify the impact on the current consumption scenarios, using several ESP32-S2 devices with a specific
caused by the proposed solution based on ML, new measure- firmware. Subsequently, we have evaluated the estimates
ments were taken with and without this functionality activated. obtained, resulting in high error values in indoor environments
Table II shows an estimation of the average current consump- (up to 5 m for the 75% of the measurements with a bandwidth
tion if the number of FTM frames were 1 every 10 s, 1 every of 20 MHz) and lower errors in outdoor environments (up to
min, etc., considering a 2000-mAh battery to estimate the bat- around 1.5 m for the 75% of the measurements with a band-
tery lifetime. The estimation was made taking into account width of 40 MHz and up to 2.5 m when the bandwidth is
that the chip was in the deep-sleep mode when it was not 20 MHz). This difference in the error levels is due to several
transmitting. As it can be seen in Table II, the proposal hardly factors. One of them is the utilization of an algorithm based
has an impact on the current consumption. on an energy threshold to perform the temporal marking of
the packets during the FTM protocol. In this case, multipath
VIII. C ONCLUSION AND F UTURE W ORK and interference problems in indoor environments cause that
In this work, we have analyzed the performance of the the first path of the signal be missed, and a bounce is taken
ESP32-S2 module as a device capable of providing distance instead. In this case, the time of flight (TOF) of the signal
estimation using FTM Wi-Fi technology implemented accord- becomes longer than the actual one, and therefore the distance
ing to the IEEE 802.11-2016 standard. For this purpose, we estimation is also longer.
BARRAL VALES et al.: FINE TIME MEASUREMENT FOR INTERNET OF THINGS 18317

During the study, it has also been found that the ESP32- [7] F. Seco and A. R. Jiménez, “Smartphone-based cooperative indoor
S2 employs RTT distance estimates different than the localization with RFID technology,” Sensors, vol. 18, no. 1, p. 266,
2018.
ones observed in the frames during FTM communications. [8] C. Yang and H.-R. Shao, “WiFi-based indoor positioning,” IEEE
Although this is not detailed in the ESP32-S2 documenta- Commun. Mag., vol. 53, no. 3, pp. 150–157, Mar. 2015.
tion, we have experimentally verified that a linear correction [9] M. Terán, J. Aranda, H. Carrillo, D. Mendez, and C. Parra, “IoT-based
system for indoor location using Bluetooth low energy,” in Proc. IEEE
is applied to the raw RTT values depending only on the val- Colombian Conf. Commun. Comput. (COLCOM), 2017, pp. 1–6.
ues themselves. We have found that this approach improves [10] C.-N. Huang and C.-T. Chan, “ZigBee-based indoor location system by
the accuracy in some cases but produces large errors in other k-nearest neighbor algorithm with weighted RSSI,” Procedia Comput.
Sci., vol. 5, pp. 58–65, Jan. 2011.
cases. [11] Z. Sahinoglu, S. Gezici, and I. Guvenc, Ultra-Wideband Positioning
We have proposed to use classical ML algorithms to per- Systems. New York, NY, USA: Cambridge Univ. Press, 2008.
form the final distance estimation, taking as training features [12] E. Au, “The latest progress on IEEE 802.11mc and IEEE 802.11ai
[standards],” IEEE Veh. Technol. Mag., vol. 11, no. 3, pp. 19–21,
the raw RTT values and the signal level indicator of each Sep. 2016.
sample. We have trained and tested the algorithms, showing [13] O. Hashem, K. A. Harras, and M. Youssef, “Accurate indoor position-
an improvement in the absolute error obtained. Additionally, ing using IEEE 802.11mc round trip time,” Pervasive Mobile Comput.,
vol. 75, Aug. 2021, Art. no. 101416.
we have implemented one of these trained algorithms inside
[14] C. Gentner, M. Ulmschneider, I. Kuehner, and A. Dammann, “WiFi-
the ESP32-S2, so that we have been able to generate the esti- RTT indoor positioning,” in Proc. IEEE/ION Position Location Navig.
mates in real time and simultaneously with those provided Symp. (PLANS), 2020, pp. 1029–1035.
by the chip. An additional measurement campaign was car- [15] A. Dammann, R. Raulefs, and S. Zhang, “On prospects of positioning
in 5G,” in Proc. IEEE Int. Conf. Commun. Workshop (ICCW), 2015,
ried out, in a totally different scenario from those considered pp. 1207–1213.
to obtain the training samples, with the objective of validat- [16] R. M. Buehrer, H. Wymeersch, and R. M. Vaghefi, “Collaborative sen-
ing the ML algorithms and the real-time implementation. The sor network localization: Algorithms and practical issues,” Proc. IEEE,
vol. 106, no. 6, pp. 1089–1114, Jun. 2018.
results obtained, despite the difficulties of the environment, [17] N. Suryavanshi, K. V. Reddy, and V. Chandrika, “Direction finding capa-
demonstrated that our proposal based on ML is suitable to bility in Bluetooth 5.1 standard,” in Proc. Ubiquitous Commun. Netw.
address the problem of generating the final estimates from the Comput., Bangalore, India, Feb. 2019, pp. 53–65.
[18] “Wi-Fi RTT (IEEE 802.11mc).” 2021. [Online]. Available:
RTT values. https://source.android.com/devices/tech/connect/wifi-rtt
Overall, the FTM implementation in the ESP32-S2 is [19] M. Bullmann, T. Fetzer, F. Ebner, M. Ebner, F. Deinzer, and
still far from being usable in complex indoor environments. M. Grzegorzek, “Comparison of 2.4 GHz WiFi FTM- and RSSI-based
indoor positioning methods in realistic scenarios,” Sensors, vol. 20,
While its performance in outdoor environments exhibited good no. 16, p. 4515, 2020.
results, with almost 90% of the samples below 2 m of absolute [20] B. K. P. Horn, “Doubling the accuracy of indoor positioning: Frequency
error for a bandwidth value of 40 MHz, in indoor environ- diversity,” Sensors, vol. 20, no. 5, p. 1489, 2020.
[21] M. Ibrahim et al., “Verification: Accuracy evaluation of WiFi fine
ments, only 40% of the samples fall below such a threshold time measurements on an open platform,” in Proc. 24th Annu. Int.
(for a bandwidth value of 20 MHz). In addition, in the indoor Conf. Mobile Comput. Netw., 2018, pp. 417–427. [Online]. Available:
scenario, there were very large estimation errors for some of https://doi.org/10.1145/3241539.3241555
[22] “88W8987 DB 1x1 802.11ac, Bluetooth 5.2.” [Online]. Available:
the samples, with almost 10% of the measurements having https://www.nxp.com/products/wireless/wi-fi-plus-bluetooth/2-4-5-ghz-
more than 8 m of error. Thus, with these results, it would be dual-band-1x1-wi-fi-5-802-11ac-plus-bluetooth-5-2-solution:88W8987
very difficult to generate 2-D or 3-D position estimates with (Accessed: Sep. 22, 2021).
an error smaller than the size of a medium-sized room. [23] “88MW32X Wi-Fi Microcontroller SoC.” [Online]. Available:
https://www.nxp.com/products/wireless/wi-fi-plus-bluetooth/88mw32x-
In future work, new experiments will be designed to assess 802-11n-wi-fi-microcontroller-soc:88MW32X (Accessed: Sep. 22,
the accuracy obtained in a 3-D environment, considering not 2021).
only the location in a plane but also the height. [24] “Wireless MCUs.” [Online]. Available: https://www.cypress.com/
products/wireless-mcus (Accessed: Sep. 22, 2021).
[25] “Release ESP-IDF Pre-Release v4.3-Beta1.” espressif/esp-idf. 2021.
[Online]. Available: https://github.com/espressif/esp-idf/releases/tag/v4.
R EFERENCES 3-beta1
[1] F. Khelifi, A. Bradai, A. Benslimane, P. Rawat, and M. Atri, “A survey of [26] “Global SOC as a Service Market Size, and Forecast to 2028.” 2021.
localization systems in Internet of Things,” Mobile Netw. Appl., vol. 24, [Online]. Available: https://www.quincemarketinsights.com/industry-
pp. 761–785, Jun. 2019. analysis/soc-as-a-service-market
[2] P. Tedeschi, S. Bakiras, and R. Di Pietro, “IoTrace: A flexible, efficient, [27] “ESPHome.” 2021.[Online]. Available: https://esphome.io/index.html
and privacy-preserving IoT-enabled architecture for contact tracing,” [28] “Tasmota.” 2021. [Online]. Available: https://tasmota.github.io/docs/
IEEE Commun. Mag., vol. 59, no. 6, pp. 82–88, Jun. 2021. About/
[3] Y. Li et al., “Toward location-enabled IoT (LE-IoT): IoT positioning [29] “ESP Easy.” 2021. [Online]. Available: https://espeasy.readthedocs.io/
techniques, error sources, and error mitigation,” IEEE Internet Things en/latest/ESPEasy/AboutUs.html
J., vol. 8, no. 6, pp. 4035–4062, Mar. 2021. [30] V. Barral, O. Campos, T. Domínguez-Bolao, C. J. Escudero,
[4] R. F. Brena, J. P. García-Vázquez, C. E. Galván-Tejada, and J. A García-Naya, 2021. “ESP32S2 FTM
D. Muñoz-Rodriguez, C. Vargas-Rosales, and J. Fangmeyer, “Evolution Measurements,” tex.referencetype: data. [Online]. Available:
of indoor positioning technologies: A survey,” J. Sens., vol. 2017, https://dx.doi.org/10.21227/2pv8-ze59
Mar. 2017, Art. no. 2630413. [31] V. Barral. “ESP32 FTM Tag Source Code.” 2021. [Online]. Available:
[5] W. Sakpere, M. Adeyeye-Oshin, and N. B. Mlitwa, “A state-of-the-art https://github.com/valentinbarral/esp32s2-ftm-tag
survey of indoor positioning and navigation systems and technologies,” [32] V. Barral. “ESP32 FTM Anchor Source Code.” 2021. [Online].
South African Comput. J., vol. 29, no. 3, pp. 145–197, 2017. Available: https://github.com/valentinbarral/esp32s2-ftm-anchor
[6] C. Laoudias, A. Moreira, S. Kim, S. Lee, L. Wirola, and C. Fischione, [33] V. Barral. “ROS FTM Reader Source Code.” 2021. [Online]. Available:
“A survey of enabling technologies for network localization, track- https://github.com/valentinbarral/rosftm
ing, and navigation,” IEEE Commun. Surveys Tuts., vol. 20, no. 4, [34] V. Barral. “ROS Messages Source Code.” 2021. [Online]. Available:
pp. 3607–3644, 4th Quart., 2018. https://github.com/valentinbarral/rosmsgs
18318 IEEE INTERNET OF THINGS JOURNAL, VOL. 9, NO. 19, 1 OCTOBER 2022

[35] N. Dvorecki, O. Bar-Shalom, L. Banin, and Y. Amizur, “A machine Tomás Domínguez-Bolaño received the B.S. degree
learning approach for Wi-Fi RTT ranging,” in Proc. Int. Techn. Meeting in computer engineering and the Ph.D. degree in
Inst. Navig., Reston, VA, USA, Jan. 2019, pp. 435–444. computer engineering (with the Distinction “Doctor
[36] J. Choi, Y.-S. Choi, and S. Talwar, “Unsupervised learning techniques with European Mention”) from the University of
for trilateration: From theory to android APP implementation,” IEEE A Coruña, A Coruña, Spain, in 2014 and 2018,
Access, vol. 7, pp. 134525–134538, 2019. respectively.
[37] “ESP32-S2.” Espresssif Systems. 2021. [Online]. Available: Since 2014, he has been with the Group
https://www.espressif.com/en/products/socs/esp32-s2 of Electronics Technology and Communications,
[38] “ROS Main Site.” ROS. 2021. [Online]. Available: http://www.ros.org University of A Coruña. In 2018, he was a Visiting
[39] H. Wymeersch, S. Marano, W. M. Gifford, and M. Z. Win, “A machine Scholar with Tongji University, Shanghai, China. He
learning approach to ranging error mitigation for UWB localization,” is an author of more than 15 papers in peer-reviewed
IEEE Trans. Commun., vol. 60, no. 6, pp. 1719–1728, Jun. 2012. international journals and conferences. He was awarded with a predoctoral
[40] V. Barral, C. J. Escudero, J. A. García-Naya, and P. Suárez-Casal, grant and two research-stay grants. His research interests include channel mea-
“Environmental cross-validation of NLOS machine learning classifi- surements, parameter estimation and modeling, and experimental evaluation
cation/mitigation with low-cost UWB positioning systems,” Sensors, of wireless communication systems.
vol. 19, no. 24, p. 5438, 2019.
[41] M. Pelikan and D. E. Goldberg, and E. Cantú-Paz, “BOA: The Bayesian
optimization algorithm,” in Proc. 1st Annu. Conf. Genet. Evol. Comput.,
1999, pp. 525–532.
[42] G. G. Moisen, “Classification and regression trees,” in Encyclopedia of
Ecology, vol. 1, S. E. Jørgensen and B. D. Fath, Eds. Oxford, U.K.:
Elsevier, 2008, pp. 582–588. [Online]. Available: https://www.fs.usda.
gov/treesearch/pubs/30645
[43] V. Vapnik, The Nature of Statistical Learning Theory (Information
Science and Statistics), 2nd ed. New York, NY, USA: Springer-
Verlag, 2000. [Online]. Available: https://www.springer.com/gp/book/
9780387987804
Carlos J. Escudero (Senior Member, IEEE)
[44] H. Drucker, C. J. C. Burges, L. Kaufman, A. Smola, and V. Vapnik,
received the Ph.D. degree in computer science from
“Support vector regression machines,” in Proc. Int. Conf. Adv. Neural
the University of A Coruña (UDC), A Coruña,
Inform. Process. Syst., vol. 28, Jan. 1997, pp. 779–784.
Spain, in 1998.
[45] C. E. Rasmussen, “Gaussian processes in machine learning,”
He is a Full Professor with UDC in the area of
in Advanced Lectures on Machine Learning: ML Summer
signal theory and communications. Since 1992, he
Schools, O. Bousquet, U. von Luxburg, and G. Rätsch, Eds.
has been a Faculty Member with the Department of
Heidelberg, Germany: Springer, 2004, pp. 63–71. [Online]. Available:
Computer Engineering, UDC, where he became an
https://doi.org/10.1007/978-3-540-28650-9_4
Associate Professor in 1998. He was the Secretary
[46] J. Schmidhuber, “Deep learning in neural networks: An overview,”
of the Department, the Vice-Dean of the Faculty
Neural Netw., vol. 61, pp. 85–117, Jan. 2015. [Online]. Available:
of Informatics, and the Head of the Department of
http://arxiv.org/abs/1404.7828
Electronics and Systems, UDC, where he has been the Deputy Rector of
[47] “CP2102N-GQFN28 USBXpress USB Bridges.” Silicon Labs.
Information and Communication Technologies (University CIO) since January
2021. [Online]. Available: https://www.silabs.com/interface/usb-
2016. His research focuses on the applications of signal processing in com-
bridges/usbxpress/device.cp2102n-gqfn28
munications, wireless sensor networks, and indoor location systems. Proof
[48] M. Pincheira, M. Vecchio, R. Giaffreda, and S. S. Kanhere, “Cost-
of this are some of the merits alleged in the curriculum: publications in the
effective IoT devices as trustworthy data sources for a blockchain-based
most prestigious journals and books, many national and international collab-
water management system in precision agriculture,” Comput. Electron.
orations with renowned researchers, dozens of papers/publications in national
Agr., vol. 180, Jan. 2021, Art. no. 105889.
and international conferences, highlighting the most significant in the curricu-
[49] T. Bouguera, J.-F. Diouris, J.-J. Chaillout, R. Jaouadi, and G. Andrieux,
lum, participation in more than 25 competitive research projects in which he
“Energy consumption model for sensor nodes based on LoRa and
has been the principal investigator on 7, responsible for 20 contracts with
LoRaWAN,” Sensors, vol. 18, no. 7, p. 2104, Jul. 2018.
companies, author of two patents, and the founding member of two spinoff
companies.

Valentín Barral Vales received the Ph.D. degree


in computer engineering with a thesis titled Ultra
Wideband Location in Scenarios Without Clear Line
of Sight from the University of A Coruña, A Coruña,
Spain, in 2020.
He works as an Associate Researcher with the
University of A Coruña. His research field is indoor
localization using radio technologies, a field in
which he has published several works since 2012. He
has also participated in many national and European
projects, always related to indoor localization in José A. García-Naya (Senior Member, IEEE)
complex environments. received the M.Sc. and Ph.D. degrees in computer
engineering from the University of A Coruña
(UDC), A Coruña, Spain, in 2005 and 2011,
respectively.
He is with the CITIC Research Center
Omar Campos Fernández received the B.S. degree and the Group of Electronics Technology and
in electronics engineering from the University of A Communications, UDC, where he is an Associate
Coruña, A Coruña, Spain, in 2019, and the M.Sc. Professor. He is the coauthor of more than 120
degree in electronics systems engineering from the peer-reviewed papers in journals and conferences.
University Carlos III of Madrid, Madrid, Spain, in He was a member of the research team in more than
2020. 40 research projects funded by public organizations and private companies,
His research interests include indoor localization being principal investigator in two of them. His research interests focus
systems and wireless sensor networks. on wireless engineering, with special emphasis on experimental evalua-
tion, including wireless channel characterization, high-mobility vehicular
transportation, time-modulated arrays, location systems, and IoT.

You might also like