Two Way Ranging Distance Calibration

Hi,

I am using the ss_twr code from the decawave github:

When reading the values printed through UART on the init side, I am getting distance values of about 1.8-2.3 M (fluctuating) when the measured distance is 1.5 M. Is there any way to adjust the code so the distance is both more consistent and more accurate?
Thanks!

Hi Vik,

You must calibrate the antenna delay values in the code at a given distance. So for example set the distance to 2meters, and modify those value until measured distance is correct.

Hope it helps,
Yes

Hi, thanks for responding. Do you know where I can find these antenna delay values in the code?

Hi Vik,

They are easy to find in main.c with a bit of research:

/Should be accurately calculated during calibration/
#define TX_ANT_DLY 16300
#define RX_ANT_DLY 16456

Hope it helps,
Yves

1 Like

Forgive me for intrusion,Yves, is this weak delay difference important?
I’v got reference/measured diff about 3-5 cm at 10 meter base.

It depends how accurate you want things to be.

Hi,
I am a little confused because of the antenna delay values. I have a RTLS already up and running but did not make use of any external C code. I only use the stock PANS firmware image version 2.
I wonder if it a) made sense for me to alter the delays and b) if it was actually possible to do so. Or is that only important when using the TWR example? But what delay values does the stock firmware provide then?

Regards, Max

Hello, may I know how should I do the calibration without using any external code? I am using bluetooth BLE API to read the position information of the tag.

@maxbauer Did you figure out how to do that?

Hey there.
Well if you pretend to use PANS firmware you cannot change the code…So not possible to define antenna delay’s values like that. The only way is you correcting the values on a post processing program after receiving the range or use your own firmware and then do that. Just remember that the devices (if you have a development board) already have a value from fabrication stored on OTP but they come with a positive error (real - measure => 0).
Cheerz.

Yes I am using decawave 1001 dev board. Do you mean if I want to calibrate my board, I need to compile the C language code from decawave example and change the following two lines ([link](https://github.com/Decawave/dwm1001-examples/blob/1b2a46e14546d8f24cf08ff3d64d802e109cd2d3/examples/ss_twr_init_int/main.c#L64)) until I get good TWR accuracy.

Currently I try to use two device which one anchor and one tag. However there is ±20cm error from actual distance. Is it possible to increase the accuracy?

Hi there.

“Do you mean if I want to calibrate my board, I need to compile the C language code from decawave example and change the following two lines ( [link](https://github.com/Decawave/dwm1001-examples/blob/1b2a46e14546d8f24cf08ff3d64d802e109cd2d3/examples/ss_twr_init_int/main.c#L64) ) until I get good TWR accuracy.”

Yes correct. Well i dont know how is the handling of PANS code about ranges.

What im gona tell you is about my experience using my code because i want to have control on it and not using a “black box” where i dont know if the ranges are raw or not.

So with the mdek1001 (my case) the antenna delay comes with a positive error value of antenna delay, so all the devices that loads the calibration values from the OTP will have it. Then that error could be summed (from device A plus the device B error) and then you have that error of 20cm. In my case was something like that actuyally. If you have another devices and use it you should see some different errors maybe (if they have different antenna delay value).

Currently I try to use two device which one anchor and one tag. However there is ±20cm error from actual distance. Is it possible to increase the accuracy?

So what i did is just put them on a distance recommened (my case was channel 5 (128 preamble and 1024 preamble) - 5010mm) and then trying to find a “better” value for antenna delay. Remenber that this will be a improvement on LOS but in a case of NLOS could make the errors greater. Keep in mind that this calibration has to be on statistics measures like 99% of measure inside you measure and std.

Dont forget too about two important aspects! First the trim of crystal - that you have on OTP value too and secound the range bias correction that you could make it too. In this case you have documentation to help too on this task Decawave application notes. Keep in mind that for all of this there are a lot of “problems” like physical antenna rotation and reflection and so on…

I hope i could help.

Cheers.