Intro of TDoA: Open-source implementation of IEEE 802.15.4z
TDoA (Time Difference of Arrival) is a technique used for high-precision localization, especially in Ultra-Wideband (UWB) systems like those standardized in IEEE 802.15.4z (Enhanced UWB PHY). Below is an overview of open-source implementations and resources related to TDoA for UWB-based localization.
1. IEEE 802.15.4z & TDoA Basics
- 802.15.4z enhances UWB with improved security (STS, AES-128) and ranging accuracy (HRP/LRP modes).
- TDoA vs. ToF (Time of Flight)
- TDoA: Uses multiple anchors (fixed reference nodes) to compute tag position based on signal arrival time differences (better for large-scale deployments).
- ToF (Two-way ranging): Measures round-trip time between two devices (used in Apple AirTag, Samsung SmartTag).
2. Open-Source TDoA Implementations list
2.1 Decawave (Now Qorvo) DW1000-based Solutions
The DW1000 UWB transceiver is widely used in open-source UWB projects.
Some key Github repos are:
- Pozyx.io: Supports TDoA and ToF localization, and, Works with Arduino & Raspberry Pi.
- Bitcraze Crazyflie (UWB TDoA for Drones), Uses LPS (Loco Positioning System) with DW1000, and, Supports TDoA2 (improved version of TDoA).
2.2 ESP32 + UWB (Cheaper Alternative)
- ESP32 + DW1000 : Arduino library.
- ESP32 + DW3000: Makerfabs ESP32 UWB contains an ESP32 and a DW3000 chip.
2.3 Apple & Android Ecosystem (Closed but Relevant)
- Apple U1 Chip (UWB-based AirTags): Uses proprietary TDoA-like methods.
- Android UWB Stack (Samsung, Google Pixel): Based on FiRa Consortium standards.
3. TDoA Algorithm Implementation
A basic TDoA algorithm involves:
- Anchor Synchronization (Clock sync between anchors).
- Time Difference Calculation (e.g., Cross-Correlation of received signals).
- Hyperbolic Positioning (Solving nonlinear equations(hyperbolic curves) via LS/ML estimation): requires at least 3 anchors for 2D (4 ones for 3D).
3.1 Visulaze 2D TDoA :
Anchors: A0[0, 0], A1[5, 0], A2[0, 5]
Tag: [2, 3]
illustrating with a text figure
Y-axis
|
5 + A2 (0,5)
| *
| / \
| / \ hyperbola points (A0-A2)
| / \
| / \
3 + * Tag (2,3)
| \ /
| \ / hyperbola points (A0-A1)
| \ /
| \ /
0 +------*------- X-axis
A0 (0,0) A1 (5,0)
3.2 Python code and running result:
import numpy as np
from scipy.optimize import least_squares
# Anchor positions (same as original)
anchors = np.array([[0, 0], [5, 0], [0, 5]])
# True tag position (for synthetic data generation)
true_pos = np.array([2.0, 3.0])
# Simulate TDoA measurements (add slight Gaussian noise)
c = 3e8 # Speed of light (m/s)
noise_std = 1e-9 # 1 ns standard deviation (realistic for UWB)
# Theoretical time differences (no noise)
d_true = np.array([
np.linalg.norm(true_pos - anchors[1]) - np.linalg.norm(true_pos - anchors[0]),
np.linalg.norm(true_pos - anchors[2]) - np.linalg.norm(true_pos - anchors[0])
])
# Add noise to simulate real measurements
tdoa_meas = d_true / c + np.random.normal(0, noise_std, size=2)
# original TDoA solver function as residuals f(x) for later least_squares
def tdoa_error(x, anchors, tdoa_meas):
return [
np.sqrt((x[0]-anchors[1][0])**2 + (x[1]-anchors[1][1])**2) -
np.sqrt((x[0]-anchors[0][0])**2 + (x[1]-anchors[0][1])**2) - tdoa_meas[0]*c,
np.sqrt((x[0]-anchors[2][0])**2 + (x[1]-anchors[2][1])**2) -
np.sqrt((x[0]-anchors[0][0])**2 + (x[1]-anchors[0][1])**2) - tdoa_meas[1]*c
]
# Solve using nonlinear least-squares optimizer
result = least_squares(tdoa_error, [0, 0], args=(anchors, tdoa_meas))
estimated_pos = result.x
# Print results
print(f"Tag True position: {true_pos}")
print(f"Tag Estimated position: {estimated_pos}")
print(f"Error (meters): {np.linalg.norm(true_pos - estimated_pos):.4f}")
running result:
~ % python3 tdoa.py
Tag True position: [2. 3.]
Tag Estimated position: [1.97366561 2.86600114]
Error (meters): 0.1366
4. Challenges in Open-Source TDoA
- Clock Synchronization: Requires precise anchor sync (PTP, wired sync, or wireless sync).
- Multipath Interference: UWB signals reflect in indoor environments.
- Security: 802.15.4z adds AES-128 for secure ranging (hard to implement in open-source).
5. Further Resources
- FiRa Consortium (Industry UWB standards): https://www.firaconsortium.org/
- IEEE 802.15.4z Spec: IEEE Xplore
- Nonlinear least-squares (NLLS) problem by Gauss-Newton method: Gauss-Newton method
NOTE: subject to change in the future