Back to articles

# Using the Nordic Distance Toolbox to measure the distance between short-range radios

Knowing the distance between two short-range transceivers is useful for many applications. Examples include proximity measurement for making sure people maintain a set distance apart for safety reasons, indoor navigation, and tracking items in a warehouse.

- Read more: Transforming warehouse management
- Read more: Finding your way with Bluetooth

There are several techniques for measuring distance from straightforward received signal strength indicator (RSSI) and time-of-flight (ToF), through more complex phase-based measurements to advanced techniques such as Inverse Fast Fourier Transform (IFFT) and estimation of multipath channel impulse response from frequency spectrum measurements. Each trades off some combination of accuracy, resolution, calculation time, processing resource, and energy.

It's possible to try out each of these techniques to find out which is best for your applications using the Nordic Distance Toolbox (NDT). NDT is a proprietary technology that’s an easy-to-use development tool for measuring the distance between two Nordic short-range radios. It is included in Nordic’s nRF Connect SDK, the company’s scalable and unified software development kit. Let’s take a closer look at these various distance measuring techniques.

## Using signal intensity to estimate distance

While not able to focus a signal nor determine the direction from which it has come, a short-range radio such as a Bluetooth LE transceiver with a single antenna can measure signal strength, the frequency of the incoming signal, its phase, and its time of arrival. This information is useful for estimating the distance to the transmitter.

When transmitting, the short-range radio broadcasts a 2.402 to 2.480 GHz signal that forms a sphere expanding at the speed of light. As the sphere propagates, the intensity (power per unit area) of the signal in a vacuum and without obstructions drops off according to the formula 1/r2 (where “r” is the radius of the sphere). With knowledge of the original transmission power and incoming signal strength, the receiver can therefore work out approximately how far it is from the transmitter.

But a vacuum without obstructions is not the usual operating environment for a short-range radio. In typical use, for example, in a house or an office, the intensity drop will be greater. To compensate and improve distance measurement accuracy, engineers instead use the formula 1/rn where “n” is the “path loss factor”. For example, in a home with walls made of wood, n is around 4.5.

RSSI is a cheap and inexpensive way to estimate the distance between two transceivers. The downside is that the path loss factor introduces errors even if it has been carefully assessed for an anticipated operating scenario. Nordic conducted some tests in an office environment that compared the distance between two short-range radios measured very precisely using LIDAR with those obtained from RSSI measurements. RSSI proved precise up to a few meters, but beyond that distance estimates became increasingly inaccurate. When people were moving through the measurement area, RSSI precision deteriorated markedly, and the useable range dropped to half a meter.

## Time-of-Flight and phase measurements

A second technique that brings greater precision to distance measurement is ToF. The technique measures the time it takes for a signal to travel from the transmitter to the receiver and back, and then calculates the distance based on the speed of light. (ToF (seconds)/2 x c (meters per second) = distance to object (meters).) There is a small correction, because the receiving radio will require a short but finite time to switch from receive to transmit and “reflect” the signal back. However, such a correction is easily included in the distance calculation.

A third technique that also offers greater accuracy than RSSI is phase measurement. It’s a technique that has been used for many years in radar installations. The math is complex, but in essence the measurement relies on different radio frequencies having different wavelengths. A 2.4 GHz signal, for example, has a wavelength of 12.5 cm, whereas a 2.48 GHz signal has a slightly shorter wavelength of 12.1 cm.

Over two meters, for example, a 2.4 GHz signal will oscillate exactly (2/0.125) 16 times so its phase at the receiver will be the same as when it left the transmitter. However, a 2.48 GHz signal will oscillate (2/0.121) 16.53 times. That extra 0.53 of a cycle will mean that the received signal is (2π x 0.53) 1.06π out of phase compared with the transmitted signal.

For a given distance, phase measurements across a range of frequencies results in a linear phase variation with a measurable gradient. Changing the distance alters the gradient of the phase variation with a steeper gradient representing a greater range. With knowledge of the gradient change for a set of reference distances, in a practical situation, it is relatively simple to correlate a measured gradient to the actual distance between the two transmitters.

Nordic’s tests using the LIDAR comparison showed that both ToF and phase measurement offer reasonable accuracy and are not affected by the signal attenuation that plagues RSSI measurements. For shorter distances (up to ten meters), phase measurement offers greater precision. Over long distances (up to several hundred meters), phase measurement tends to become less precise and ToF is a better way to measure the distance between the radios. Note that both the ToF and phase change techniques require a two-way connection between transmitter and receiver, unlike RSSI.

## Greater precision but increased complexity

If the precision offered by ToF or phase measurement is still not adequate for an application, there are two more methods supported by Nordic Distance Toolbox that offer even greater accuracy. One uses Inverse Fast Fourier Transform (IFFT) techniques and the other uses an estimation of multipath channel impulse response from frequency spectrum measurements.

These techniques are complex, and both rely on sophisticated analysis of the transmitted and received signals. However, the result is a precise and repeatable measurement of the distance between the short range radios. The trade-off with both techniques is that they demand a high level of computing resources and long processing time that consumes energy and hence impacts battery life.

Nordic's tests revealed that IFFT produces a good correlation to the actual distance measured by LIDAR and is more accurate than RSSI, ToF and phase measurement, although some outlier filtering is likely to be required to get the best results. The estimation of multipath channel impulse response measurement is even better than IFFT, producing high precision results; but it also requires outlier filtering and features longer processing times than the other techniques. However, if the highest precision distance measurement is needed for the application, then the energy trade-off could be worth it.

## Nordic Distance Toolbox does all the work

The Nordic Distance Toolbox included with Nordic’s nRF Connect SDK is useful for testing various distance measurement techniques with Nordic short-range radio SoCs and includes a quality indicator to provide a degree of confidence in how accurate the measurement data is likely to be. Distance is computed based on all intensity, frequency, and phase information available to the transceiver and all calculations are completed inside the toolbox.

Nordic Distance Toolbox currently offers experimental support for nRF52833, nRF52840, and nRF5340 and includes measurement support for: RSSI; ToF; phase slope estimation; IFFT; and estimation of multipath channel impulse response from frequency spectrum measurements.

- Learn more: Measuring distance with the Nordic Distance Toolbox
- Read more: Has UWB found its killer application?