Fine Time Measurement For The Internet of Things A Practical Approach Using ESP32
Fine Time Measurement For The Internet of Things A Practical Approach Using ESP32
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
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.
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).
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.
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.
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)
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.