Application Note: An Introduction to Ranging with the SX1280 Transceiver
Brand: Semtech
Product: SX1280 Long Range, Low Power 2.4 GHz Transceiver
Document Revision: Rev 1.0, March 2017
Table of Contents
1 Basic Operation
The ranging functionality of the SX1280 is based on measuring the round trip time of flight (RTToF) between a pair of SX1280 transceivers. This process utilizes the LoRa modulation scheme, benefiting from LoRa's advantages in long range and low power consumption. The basic ranging operation is outlined as follows:
Step i): A Master SX1280 initiates a ranging exchange by transmitting a ranging request. The Master starts an internal timer simultaneously.
Step ii): The addressed Slave SX1280 receives the ranging request and synchronizes itself. The Slave does not know the exact transmission time, but the synchronization process requires a fixed time known by the Master. There is no common absolute timing reference between Master and Slave.
Step iii): The Slave sends a synchronized ranging response back to the Master. Upon reception, the Master calculates the RTToF based on the elapsed time, which represents the time taken for the electromagnetic wave to travel from Master to Slave and back.
Diagram Description: A three-step process illustrating the ranging exchange. Step i) shows the Master sending a 'Ranging Request' to the Slave, starting its timer. Step ii) shows the Slave synchronizing. Step iii) shows the Slave sending a 'Ranging Response' back to the Master, completing the round trip.
2 Source of Ranging Error
2.1 Measurement Error and Dilution of Precision
The principal sources of measurement error in the ranging exchange involve both the Master and Slave radios. These errors can be categorized as follows:
- Crystal Timing Error (1): A difference in the precise clock frequency between the Master and Slave leads to an unknown timing offset, and consequently, a distance offset.
- Transmit/Receive Path Delays (2, 3): Delays incurred through digital and analog signal processing and conditioning blocks. These are typically design-specific and can be compensated if known.
- Antenna Delay (4): Delay experienced by a signal radiated or received by the antenna. This delay may vary depending on the direction of radiation.
- Multipath (5): Phenomenon where the electromagnetic wave takes multiple reflected and diffracted paths, causing the received signal to be a combination of these paths. This effect is more severe with obstructions between transmitter and receiver.
This application note focuses on ideal Line-of-Sight (LoS) conditions, excluding multipath and antenna delay effects to evaluate the inherent SX1280 ranging performance. The primary errors to be compensated are:
- A fixed offset due to design-specific delays.
- An unknown variable reference timing offset between Master and Slave.
Sections 3 and 4 will detail the compensation of these errors, followed by discussions on accuracy and precision in Sections 5, 6, and 7.
3 Correction of Fixed Delays
3.1 Elimination of Timing Error
To address time-varying ranging estimation errors caused by timing and frequency offsets, a universal correction for intrinsic design delays can be applied by cancelling the timing error. This is achieved by switching the roles of Master and Slave.
Diagram Description: Two diagrams illustrate Master-Slave switching. The first shows a Master and Slave with a timing error (+Terror) resulting in a measured time of flight (TMaster-Slave = 2TToF + TERROR). The second diagram reverses the roles, showing the Slave and Master with the timing error reversed (-Terror), resulting in TSlave-Master = 2TToF - TERROR.
By averaging these two measurements, the timing error is cancelled:
$$ T_{RTToF} = \frac{T_{slave-Master} + T_{Master-Slave}}{2} $$
This method assumes negligible timing drift between Master and Slave during the measurement. While temperature fluctuations can cause crystal oscillator drift, performing measurements at equivalent temperatures allows for static drift compensation.
3.2 Practical Ranging Calibration Measurements
A conducted ranging measurement setup is used to characterize fixed design-specific delays. The setup involves two SX1280 transceivers (Alpha and Beta) connected via a known length of coaxial cable (approx. 100m), with RF attenuators (22 dB and 40 dB) in the signal path. A PC controls the measurements. Shielded enclosures are used to negate the influence of shorter direct radiated paths.
Diagram Description: A block diagram showing the calibration setup with two SX1280 modules connected by a ~100m cable, attenuators, and a PC. Antennas are depicted for both modules.
The calibration measurements are performed over a wide range of frequencies and averaged to account for statistical spread. The distance resolution (DLSB) is calculated using the formula:
$$ D_{LSB} = \frac{c}{2^{12} \times BW} $$
where 'c' is the speed of light and 'BW' is the modulation bandwidth in Hz. It is crucial to distinguish between resolution and accuracy.
The raw output register value 'RangingResult' is converted to RTToF distance using:
$$ D_{RTToF} = RangingResult \times D_{LSB} $$
The calibration value is determined by:
$$ D_{uncalibrated} = (RangingResult \times D_{LSB})/2 $$
$$ D_{calibration} = (D_{uncalibrated} - D_{cable})/2 $$
$$ Calibration = D_{calibration} / D_{LSB} $$
3.3 Calibration of Design Specific Delays
A calibration table provides measured calibration values for different bandwidths (400 kHz, 800 kHz, 1600 kHz) and spreading factors (SF5 to SF10). These values are used to automatically apply calibration correction by writing them to the RxTxDelay register in the SX1280.
BW (kHz) | SF | |||||
---|---|---|---|---|---|---|
5 | 6 | 7 | 8 | 9 | 10 | |
400 | 10299 | 10271 | 10244 | 10242 | 10230 | 10246 |
800 | 11486 | 11474 | 11453 | 11426 | 11417 | 11401 |
1600 | 13308 | 13493 | 13528 | 13515 | 13430 | 13376 |
3.4 Aside: Bidirectional Ranging Protocol
The role reversal technique can be used for a ranging protocol that cancels timing error. However, this doubles communication overhead, increasing energy consumption. Alternative techniques discussed in Section 4.3 are preferred.
4 Correction of Timing Errors
4.1 Characterization
After calibrating fixed delays, the primary remaining error source is the clock offset between Master and Slave. The SX1280's external crystal oscillator serves as the reference for both ranging and RF carrier frequency. Therefore, carrier frequency measurement corresponds to timing drift measurement.
The graphs illustrate the influence of timing drift on ranging distance evaluation at 400 kHz bandwidth. Distance error increases with spreading factor (SF) and timing drift (carrier frequency offset). The range error shown is within the ±30 ppm operational range for LoRa.
Diagram Description: A 3D plot showing 'Average raw distance [m]' on the Y-axis, 'dF [kHz]' on the X-axis, and different Spreading Factors (SF5-SF10) represented by lines. The plot demonstrates how distance error increases with frequency offset, particularly at higher SF values.
Frequency error correction involves:
- Reducing the error range using a higher precision oscillator.
- Piecewise linear distance error correction.
The LoRa Frequency Error Indicator (FEI) can be used to accurately evaluate timing and distance errors.
4.2 Correction
A linear correction is applied to the range measurement using the formula:
$$ Range' = Range - (m \times f_{error}) $$
where m
is the gradient correction factor obtained from characterization measurements (summarized in Table 2), and ferror
is the measured frequency error in kHz.
BW (kHz) | SF | |||||
---|---|---|---|---|---|---|
5 | 6 | 7 | 8 | 9 | 10 | |
400 | -0.148 | -0.214 | -0.419 | -0.853 | -1.686 | -3.423 |
800 | -0.041 | -0.118 | -0.218 | -0.429 | -0.853 | -1.737 |
1600 | 0.103 | -0.041 | -0.101 | -0.211 | -0.424 | -0.87 |
4.3 Protocol Implications
This technique requires a standard LoRa communication prior to ranging to measure frequency error. This can be beneficial for authentication or transferring application payload data, as the ranging frame itself does not carry payload. These communication frames have lower overhead than bidirectional approaches, as frequency measurement is only repeated when significant crystal frequency changes occur.
5 Accuracy and Precision
Accuracy and precision are defined as follows:
- Accuracy: The difference between the average measurement value and the ground truth.
- Precision: A measure of the spread of results, defined here as the standard deviation of measurement values.
Diagram Description: An illustration showing multiple measurement points clustered around an 'Average' point, which is offset from the 'Ground Truth'. 'Accuracy' is the distance between 'Average' and 'Ground Truth'. 'Precision' is indicated by the spread (σ) of the individual measurements.
Understanding these definitions allows for the evaluation of the ranging system's theoretical and real-world performance.
6 Ranging Precision in an Ideal Channel
6.1 Theoretical Precision
In an ideal environment, ranging accuracy is governed by the calibration correction. Theoretical precision is calculated using the Cramér Rao Lower Bound (CRLB) for spread spectrum RTToF systems:
$$ \sigma^2 = \frac{1}{8\pi^2 SNR \sqrt{N} BW 2^{SF}} $$
where SNR is the signal-to-noise ratio, N is the number of ranging symbols (20), BW is the bandwidth, and SF is the spreading factor.
Diagram Description: A 3D plot showing 'Standard Deviation of the Distance Error, σ [m]' on the Z-axis, 'Spreading Factor' on the X-axis, and 'Bandwidth [kHz]' on the Y-axis. It illustrates the CRLB with SNR = 10 dB, showing how precision improves with higher SF and BW.
6.2 Measured Precision
Measurements were conducted using a 108-meter coaxial cable (approx. 123 m electrical length) simulating an ideal channel. The results, based on 500 ranging exchanges across 40 channels with SNR between +7 to +11 dB, show that increasing SF and bandwidth generally improve precision.
Diagram Description: A 3D plot similar to the theoretical one, showing 'Standard Deviation of the Distance Error, σ [m]' on the Z-axis, 'Spreading Factor' on the X-axis, and 'Bandwidth [kHz]' on the Y-axis. It displays the measured precision, indicating optimal performance at 1600 kHz bandwidth with a precision of 0.42 m RMS.
Optimal performance is achieved at a bandwidth of 1600 kHz, yielding a precision of 0.42 m RMS.
6.3 Ranging Protocol Considerations
The experimental setup uses a Bluetooth Low Energy channel plan (40 channels from 2402 MHz to 2480 MHz). A single LoRa communication exchange on a fixed channel precedes each measurement sequence to determine signal strength and frequency error. All 40 channels are hopped over, with a ranging exchange performed on each. To gather statistically significant data, this process is repeated 50 times, resulting in 2000 measurements.
7 Ranging Precision in a Line of Sight Channel
7.1 Precision Measurement Setup
For outdoor line-of-sight (LoS) evaluation, the Master was placed 171.2 m from the Slave, both at a height of 1.8 m. The setup ensured clear optical LoS with negligible clutter. Experiments were conducted in various climatic conditions with no measurable influence.
Diagram Description: Two photographs of the ranging test site. The left image shows the Ranging Slave, viewed towards the Master. The right image shows the Ranging Master, viewed towards the Slave. Both are set up in a snowy environment.
500 ranging exchanges were performed across the 40 channels.
7.2 Precision Measurement Results
Measurements at 170 m, based on 50 frequency-hopped ranging exchanges, show that at the highest SF and bandwidth combination, the RMS ranging precision is approximately 1 m. This represents a dilution of precision by a factor of 2 to 2.5 compared to the ideal coaxial cable channel.
Diagram Description: A 3D plot comparing measured performance in air versus coaxial cable. 'Standard Deviation of the Distance Error, σ [m]' is on the Z-axis, 'Spreading Factor' on the X-axis, and 'Bandwidth [kHz]' on the Y-axis. It shows that air measurements have higher error than cable measurements.
7.3 Accuracy Measurement Setup
Accuracy was investigated by repeating measurements at ranges from 10 m to 200 m in a LoS environment. Ranges were determined by GPS and validated by a laser range finder. A reflector was used for measurements beyond 200 m. The laser range finder has a display resolution of ±1 m, with an estimated operator error of 2% of the overall range.
Diagram Description: An aerial view of the test setup showing the Master unit and multiple Slave units at different distances (10m to 200m). A laser range finder is shown, along with a reflector used for longer distances.
Diagram Description: A line graph showing 'Measurement Error [m]' on the Y-axis versus 'Ground Truth [m]' on the X-axis. It illustrates the theoretical measurement accuracy of a laser range finder with 2% operator error, showing an increasing error with distance.
7.4 Accuracy Measurement Results
Accuracy measurements of the SX1280 at 400 kHz bandwidth show that RTToF measurements are of a similar order of magnitude to the laser range finder error.
Diagram Description: Two plots comparing Ranging Performance and Ranging Error at 400 kHz relative to a Laser Range Finder. The top plot shows 'Average Measured Range [m]' vs 'Ground Truth [m]', indicating a linear relationship. The bottom plot shows 'Measured Error [m]' vs 'Ground Truth [m]', illustrating the error for different spreading factors.
At 800 kHz bandwidth, measurements are largely within the laser range finder's error margin, with reduced spread.
Diagram Description: Two plots comparing Ranging Performance and Ranging Error at 800 kHz relative to a Laser Range Finder. Similar to the 400 kHz plots, showing improved performance.
At 1600 kHz bandwidth, the spread is further reduced, with a clear outlier at 10 m.
Diagram Description: Two plots comparing Ranging Performance and Ranging Error at 1600 kHz relative to a Laser Range Finder. These plots show the tightest spread and highlight the 10m outlier.
7.5 Accuracy and Number of Ranging Exchanges
While accuracy comparable to a laser range finder can be achieved, the number of exchanges impacts the time required for a ranging operation. Reducing the number of exchanges involves a trade-off with accuracy.
Diagram Description: A scatter plot showing 'Accuracy Error [m]' on the Y-axis versus 'Number of Ranging Exchanges' on the X-axis. Blue circles represent individual measurement sequences. A red horizontal line indicates 1-meter accuracy. The plot shows that accuracy improves with more exchanges, reaching 1-meter accuracy after approximately 80 exchanges.
Gathering more ranging measurements leads to increased accuracy. 1-meter accuracy is achieved after approximately 80 ranging exchanges.
7.6 Design Intuition
Individual ranging measurements on a single channel yield a precision of approximately 1 m at high SF and high bandwidth. Aggregating 80 results across frequency-hopped channels provides an accuracy of approximately 1 m under these settings.
Link design involves trade-offs between accuracy, time-on-air (energy consumption), and range. Design considerations for optimization include:
- Higher Accuracy: Increase number of measurements or increase SF and bandwidth.
- Lower Time on Air: Reduce SF and increase bandwidth.
- Longer Range: Reduce bandwidth and increase SF.
Diagram Description: A conceptual graph illustrating the trade-offs between Bandwidth and Spreading Factor for LoRa modem configuration. It highlights 'Lowest Energy / Lowest Time on Air' at high bandwidth/low SF, 'Highest Ranging Accuracy' at high bandwidth/high SF, and 'Longest Range' at low bandwidth/high SF.
8 Short Range Result Processing
At short distances (below 20 m), ranging results can exhibit non-linearity, potentially leading to underestimated or even negative distances. A correction, typically curve fitting using an exponential basis function, is applied to these short-range results.
The following pseudo-code illustrates the correction principle:
IF measuredDistance <= 18.5 m
displayDistance = EXP( ( measuredDistance + 2.4917 ) / 7.2262 )
ELSE
displayDistance = measuredDistance
END
The displayDistance
is the corrected value presented to the user.
Diagram Description: A scatter plot comparing 'Measured Distance [m]' on the X-axis with 'Display Distance [m]' on the Y-axis. It shows 'handheld Measurement' points, 'handheld Corrected' points (following an exponential curve), and an 'ideal' y=x line. The corrected measurements align better with the ideal line, especially at shorter distances.
9 Conclusion
The steps for calibrating fixed and variable timing offsets for SX1280 RTToF measurements have been presented. In a practical peer-to-peer ranging system with a basic frequency-hopping protocol, ranging precision of less than 0.5 m was achieved in an ideal (cable) single frequency channel, increasing to 1 m in a line-of-sight radiated configuration.
An accuracy of approximately 1 m is attainable with SF9 and 1600 kHz bandwidth, based on an average of 80 ranging exchanges over 40 frequency-hopped channels.
10 References
- [1] Andreas F. Molisch, in Wireless Communications, Second Edition, 2011, John Wiley & Sons Ltd.
- [2] INTERNATIONAL STANDARD ISO/IEC 24730-5 Information technology, Real-time locating systems (RTLS) - Part 5: Chirp spread spectrum (CSS) at 2.4 GHz air interface.
- [3] SX1280 Datasheet, Semtech Corporation. http://www.semtech.com/images/datasheet/sx1280_81.pdf
- [4] Bartlett, in Essentials of Positioning and Location Technology Cambridge April 2013.
- [5] Lanzisera et al, in RF Time of Flight Ranging for Wireless Sensor Network Localization, Fourth Workshop on Intelligent Solutions in Embedded Systems (WISES'06). http://robotics.eecs.berkeley.edu/~pister/publications/2006/Lanzisera%20RF%20TOF.pdf
- [6] Bresser 800 m LR Laser Range Finder Manual. https://www.bresser.de/out/media/51fc6c7abb2ee381d00b4c470b50f3f2.pdf
- [7] Lois P. Sicking, in Rangefinder Comparison, US Forest Service Febuary 1998. https://www.fs.fed.us/eng/pubs/html/98241307/98241307.html
- [8] SX1280 MBED Reference Code. https://developer.mbed.org/components/SX1280RF1ZHP/