Wi-Fi localization at the 802.11 MAC layer: thesis and algorithm
Wi-Fi localization at the 802.11g MAC layer: the algorithm in the contention-free period, time of arrival, trilateration with an example, MATLAB simulations and today's FTM.
https://www.electronics-engineering.com/en/wifi-localization-802-11-mac-layer-thesis-algorithm/

How do you locate a phone or a laptop using only the Wi-Fi network? This thesis proposes a localization algorithm at the MAC layer of the IEEE 802.11g standard: the stations of the network measure the time of arrival of the terminal’s signal, and the Access Point computes its position. On this page you will find the context (location-based services and localization systems), the idea of the algorithm in the contention-free period of the MAC, a numerical example of trilateration, the results of the MATLAB simulations and what has changed in the standard since then. At the bottom are the full thesis, the presentation and the simulator.
Why localize in a wireless network
Computing has moved from the personal computer to portable devices that go with the user everywhere. When information has to follow the user, it is best to provide content linked to what they are doing, and the first approximation of the activity is the position. This is how Location Based Services (LBS) arose: services that deliver the right information in the right place, from guidance in a museum or an airport to faster rescue, up to targeted commercial offers. To work, they must bring an advantage both to those who offer them and to those who use them.
From the engineering point of view the problem is interesting because one seeks the best precision, accuracy and scalability under precise structural and economic constraints. Outdoors, satellite systems are used (GPS, Galileo); indoors, where the satellite signal does not reach, at the time of the thesis there were dedicated research projects such as neuRFon and PicoRadio. Localization can also be carried out on cellular networks and on IEEE 802.11 wireless networks, with one limit: the 802.11 standard was not designed for localization.
The IEEE 802.11 standard at the time of the thesis
The IEEE 802.11 standard was approved in June 1997, after seven years of work, and defines the physical layer and the MAC layer for communication between wireless devices and with the wired network. The first version reached 1 or 2 Mbit/s. The 802.11g amendment, approved in June 2003, brought into the 2.4 GHz band the OFDM modulation already used by 802.11a, with speeds up to 54 Mbit/s. As costs fell, W-LANs became a concrete alternative to wired networks, in offices and in public places such as campuses, airports, hotels and conference centres.
In these environments, locating terminals serves security and control, in both civil and industrial settings, and offers a radio-navigation service with low-to-medium mobility over the covered area. However, the 802.11g standard foresaw nothing for localization, neither at the hardware level nor in the network architecture: the thesis studies which characteristics of the MAC layer can be exploited for this purpose.
The algorithm: localizing in the contention-free period
The architecture foresees a network in infrastructure mode with:
- n localization stations (BS), Wi-Fi devices at known positions, which measure the time of arrival (TOA) of the terminal’s signal and derive the distance from it;
- m mobile terminals (MT) to be located;
- an Access Point (AP), which is also one of the BS, collects the distances and computes the position (network based approach), then communicates it to the terminal if it requests it.
The 802.11 MAC alternates within a superframe a contention period (DCF, CSMA/CA access) and a contention-free period (PCF, in which the AP polls the stations in turn). Localizing during the DCF would give flexibility, but collisions would delay the localization signals. The thesis instead uses the contention-free period for the measurements and the contention period for the exchange of data:
- at association the terminal asks to enter the location list, indicating a mobility class (stationary, low mobility such as a person walking, high mobility), on which the frequency of the updates depends;
- during the PCF the AP sends the terminal a request to update its position;
- after a SIFS interval the terminal replies with a broadcast packet, received by all the BS in coverage;
- each BS estimates the time of arrival, and therefore the distance from the terminal;
- in the following contention period the BS send the distances to the AP;
- the AP, with at least three distances, computes the position by trilateration and sends it to the terminal if requested.
How long is the request packet
The location update request packet contains a MAC header of 240 bits, the position estimated at the previous step (3 coordinates of 32 bits, 96 bits), a 32-bit timestamp and the 32-bit FCS check: 400 bits in all. At 54 Mbit/s the data field lasts
, at 6 Mbit/s about
, to which about 20 µs of preamble and OFDM physical header are added. These times determine how many terminals can be polled in a single contention-free period.
From distance to position
The distance is obtained from the propagation time:
, with
. An error of just 10 ns in the time measurement gives an error of 3 m in the distance: for this reason the estimate of the time of arrival, disturbed by multipath in indoor environments, is the critical point. Each distance places the terminal on a circle centred on the BS; in two dimensions at least three circles are needed.
Worked example: trilateration with three stations
Three stations at
,
and
m measure the distances
,
and
m. The equations of the circles are
![]()
Subtracting the first from the others the quadratic terms disappear and a linear system remains:
and
, so the terminal is at
m. If the first distance were overestimated by 1.5 m, the same calculation would give about
m: a position error of about 1.6 m. With more than three stations the system is solved by least squares and the error decreases.
MATLAB simulation results
The algorithm was simulated in MATLAB by varying the number of localization stations, the user’s speed, the coverage radius and the transmission rate, first with a single terminal and then with many terminals to evaluate the network under load. According to the conclusions of the thesis:
- the main limit is not the channel capacity but the coverage radius of the signal;
- with radii of at least 30-35 m, over areas of 1200-1300 m², the results are good and scale up to 40 managed terminals;
- with radii of about 25 m the results are acceptable; below 20 m only a few users are located with good probability.
The system is therefore suitable for large environments with few obstacles, such as the terminals of an airport or the halls of a large museum. As future development the thesis indicates combining it with a physical-layer simulator that estimates the time of arrival (for example with a Kalman filter) and the use of the MIMO of 802.11n, then still in preparation.
Structure of the thesis
- Chapter 1 – Localization technologies for indoor wireless networks: structure of a localization system, measurement techniques and position estimation algorithms (traditional algorithms and pattern recognition).
- Chapter 2 – The IEEE 802.11g standard: the access modes of the MAC layer (DCF and PCF) and the ERP physical layers.
- Chapter 3 – OFDM modulation: modulation and demodulation architectures, performance, equalization, synchronization and applications.
- Chapter 4 – Localization algorithm at the 802.11 MAC layer: the network based algorithm described above, with the times of each phase.
- Chapter 5 – Simulations of the proposed algorithm: performance in MATLAB and results.
- Appendix A: characteristics and models of wireless channels with multipath.
- Appendix B: preliminary simulation of the DCF phase of the 802.11 MAC, used to choose some parameters of the main simulation.
What has changed since then
After 802.11g came 802.11n (Wi-Fi 4), 802.11ac (Wi-Fi 5), 802.11ax (Wi-Fi 6 and 6E) and 802.11be (Wi-Fi 7). Above all, localization has entered the standard: the Fine Timing Measurement (FTM, born with the 802.11mc amendment and included in IEEE 802.11-2016) measures the round-trip time between the terminal and the Access Point, and it is supported for example by Android from version 9 under the name Wi-Fi RTT; the 802.11az amendment (Next Generation Positioning) improves its precision and security. The PCF on which the thesis is based, by contrast, has been little implemented in commercial products. The basic idea remains valid: measure flight times with the timing of the MAC and combine several distances by trilateration.
In summary
- The thesis proposes a localization algorithm on the MAC of IEEE 802.11g, which at the time had no localization functions.
- The time-of-arrival measurements take place in the contention-free period (PCF), the exchange of distances in the contention period (DCF); the AP computes the position.
- With
, 10 ns of error are worth 3 m; three distances are enough for trilateration in two dimensions. - The MATLAB simulations give good results up to 40 terminals with coverage radii of at least 30-35 m.
- Today Wi-Fi localization is standardized with FTM (802.11mc) and 802.11az.
Material to download
SIMULATOR OF THE LOCALIZATION ALGORITHM AT THE 802.11G MAC LAYER
Archive with the simulation written in MATLAB and the results in Excel sheets.
THESIS – LOCALIZATION SERVICES AT THE 802.11G MAC LAYER
Archive with the chapters of the thesis in Word format.





Hi, I am the author of “Servizi di Localizzazione a Livello MAC 802.11”. Questions, doubts, error reports and requests for more detail are all welcome: write them below and I will answer. You can also rate the page with the stars at the top of the article.
La presente tesi ha avuto il massimo del punteggio All’Università Roma 3.
se volete qualche informazione in piu’ sulla simulazione realizzata in Matlab potete lasciare qualche commento in questo spazio