Ranging Core

Introduction

The SPARK Ranging Core is the piece of software used by ranging applications to estimate the distance between two radios based on time-of-flight measurements. The Ranging Core will be used in conjunction with the SPARK Wireless Core which buffers and generates precise packet exchange timing information.

The Ranging Core features are demonstrated using an application example found in the SPARK SDK. That is the best place to start learning about how to use the Ranging Core while reading through this documentation. This documentation presents the ranging concepts, how this feature works, and how to use it.

Note

A ranging application example is available in the SDK. It is worth mentioning that to keep the ranging example simple, this application is limited to two devices. However, the principle remains the same if there is a need to monitor the distance between an array of devices and build a real time locating system (RTLS).

Concepts

Roles

At least two devices are necessary to make ranging possible. The first device’s role is called the Initiator (Coordinator) and the other is called the Responder (Node). The Initiator, as its name suggests, initiates the ranging request and waits for the Responder’s reply. It then calculates the distance between itself and the Responder based on fine-grained timing information gathered at both sides.

The Responder is always listening and waiting for a ranging request from the Initiator. Once it receives the request, it auto-replies with its ranging data. The Responder is unable to determine the distance measurement by itself.

Note

The Initiator cannot broadcast a ranging request to multiple Responders. This is to prevent every Responder from answering at the same time when using the Auto-Reply feature. Ranging requests need to be done with each Responder one at a time.

Distance Calculation

The distance between two devices is calculated using time-of-flight (ToF). The Initiator counts the time it takes to receive a packet from the Responder. This is referred to as Initiator’s Receiver Wait Time. Its precision can be greatly improved by interpreting the preamble phase correlation metrics provided by the SPARK transceiver to obtain an additional fine-tuning delay. The ranging packet exchange sequence is illustrated below and the following sections will provide more details about this process.

figure not found: Basic Ranging Packet Exchange Sequence

Initiator’s Receiver Wait Time

This is the time an Initiator has been actively waiting before receiving a frame. More specifically, it represents the amount of time spent in symbol clock periods waiting in reception for a payload to decode before detecting a synchronization word and after sending a packet waiting for the auto-reply reception as illustrated in the previous figure. The symbol clock period is 48.82 ns, which represents 14.6 meters at the speed of light, yielding a default precision of ±7.3 meters for one-way ToF. The next section explains how this precision is improved.

Preamble Phase Correlation Metrics

Like the Initiator’s Receiver Wait Time, Preamble Phase Correlation metrics are automatically made available by the transceiver each time a new frame is received. The Initiator updates them upon reception of a frame from the Responder and the Responder does so upon the reception of a frame from the Initiator. The Wireless Core takes care of gathering Preamble Phase Correlation metrics and, in the case of the Responder, automatically inserts them in the header field of the auto-reply packet for transmission to the Initiator. Once the Wireless Core has gathered enough data, they can be recovered by the user and directly passed on to the Ranging Core to convert them into an additional fine-tuning delay using a proprietary algorithm. Visit the Wireless Core documentation for more details on the gathering of these metrics.

Preamble Phase Correlation Metrics Exchange Sequence

The illustration below shows a simplified ranging data exchange sequence.

figure not found: Basic Ranging Data Exchange

The content of the Initiator’s payload is irrelevant for the ranging operation. Since the Initiator needs both the Responder and its own preamble phase correlation metrics for range calculation, the Responder must send its data back to the Initiator. Once the Initiator has a complete data set it can calculate the distance.

Improving Precision

In most situations, a single data set (or “sample”) will produce a measurement which is not very precise for a variety of reasons. For example, it can be affected by a slight offset in the preamble phase correlation metrics or skewed by RF multi-path. Therefore, post-processing should be carried out to reduce the standard deviation. By using multiple samples, the received values can be filtered and averaged to get better accuracy and precision.

figure not found: Average Size vs Standard Deviation

The illustration above shows the relation between the sample count used in a distance calculation and the standard deviation in centimeters. Increasing the number of samples improves precision, but it also increases processing costs. Generally, using 64 samples will provide most of the benefits while going above that amount will have a marginal effect on the result.