Distance calculation using time of flight in DWM1001


distance between 2 dwm1001 are finding as below, and distance is showing as 1 when we keep tag and anchor in 1.10 feet apart. so in what unit the distance is calculated in below code.
and how to calibrate the distance measurement in below code?

Using the example code “ss_twr_init_int project and ss_twr_resp project” from https://github.com/Decawave/dwm1001-examples

  rtd_init = resp_rx_ts - poll_tx_ts;
  rtd_resp = resp_tx_ts - poll_rx_ts;

  tof = ((rtd_init - rtd_resp * (1.0f - clockOffsetRatio)) / 2.0f) * DWT_TIME_UNITS; 
  distance = tof * SPEED_OF_LIGHT;

Hello Varun

You can find the units by looking at the definition of DWT_TIME_UNITS (seconds/dw time unit) and SPEED_OF_LIGHT (meters/second). This would mean the result of tof will be in seconds and thus distance in meters. Both these values are floating point, meaning they are more precise.

The main thing to calibrate is the antenna delay, since this is the only thing that should really change (unless you want to use the system in space / under water / a non-typical earth atmosphere, in which case you will also need to adjust the value of SPEED_OF_LIGHT). See APS014 - DW1000 Antenna Delay Calibration for more information.

An other thing that can be calibrated is the XTAL trim value, which allows to tune the crystal frequency and reduce the crystal offset ratio. This is depended on temperature and requires special equipment (A spectrum analyzer or frequency counter capable at measuring the center frequencies), making the solution in the example a bit more achievable. AFAIK the DWM1001 modules are factory calibrated for room temperature operation.

Thank you Seppe.

now currently we implemented single anchor and single tag in DWM1001 Devkit.
How to implement multi anchor and single tag? means: tag have to be one and anchors will be many tag has to calculate the distance of all the anchors.

Hi tvarun1

We provide the PANS example for this, it can be downloaded from our website. Note that we only provide the binary that can be flashed to the DWM1001 module, but we do not provide the full source code. it can be extended with user application code though.

We also provide a detailed document explaining how the PANS example achieves co-existence of multiple UWB devices using super frames, a form of TDMA. The location engine on the tag uses triangulation to calculate it’s position based on the distance (from TWR) to the anchors and the position of the anchors.

hello seppe,

i gone through that document and understand something about superframes.
But i am not getting what changes i need to make in tag and anchor code.

i just need the tag to calculate the distance in meter of multi anchors(i dont want 3 dimensional coardinates values of anchors i just want distance)

how i need to change the existing code for this can u explain?

Hi tvarun

You should be able to do this by using the single sided initiator code on the tag and running the single sided responder code on the anchors. You can adept the initiator code so it sends out an address in the frame and adept the responder code so it only responds to a frames containing a certain address. This way the initiator can range between the different anchors one by one, preventing the responses from the anchors from interfering with each other.

This is just one approach. An other approach is to add a different, long enough delay before sending each response.

I hope this is helpful to you and others, but please note that Decawave is the vendor of UWB chips, we do not provide solutions. We do provide examples and even more advanced systems to showcase our chips, but it is really up to our customers to develop the actual RTLS solutions.