# Custom board antenna delay calibration

Hello,

I am working on a school project with custom DW1000 boards. Until now everything worked great. At the moment I use the TREK demo example with 4 Boards on which I changed some hardware things to get it to work with my board. Later I would like to implement my own software but at the moment the demo example covers my requirements.

But to continue the project I now need to calibrate the antenna delay to get an accurate position. I found the APS014 which explains how to calculate the antenna delays. At point 2.2.1. I tried to follow the instructions, but I have difficulties understanding it.
I set up 3 devices in a triangle like it is described in the APS014 with a distance of 4 meters. I set the delays on all three devices to zero and started to measure the distance between them. From device 1 to device 2, from 2 to 1, from 1 to 3, from 3 to 1 and so on. I did 6 measurements.

Then I tried my best to implement an algorithm in matlab to calculate the antenna delays. But there are a lot of things I don’t know how to do (or how to calculate).
Until the point “Convert measured EDM-Measured and EDM-Actual to times (ToFmeasured and ToFactual)“ everything is ok, after that I’m not really sure what to do.
I created a loop with 100 iterations. In the first iteration I created two delay sets from 507ns-513ns with a step size of 0.2ns, then shuffled them around. (I don’t know if the delay sets should consist of a single value or if it is a matrix and I also don’t know if I need one delay set or three.)

Then I calculated in another loop the tof_candiate(with the formula of APS014) with different delays from the delay sets. For each tof_candiate I calculated the norm and saved the two delay values and the norm value in a new array. (Do I need to different values (or matrices) for 2Delchip1 and 2Delchip2 ?)

After that I sorted the the tof_candites in relation to the lowest norm.
In the next run I selected the first 25% from the tof_candites array and put them in a new array.

From there on out, I don’t know what to do. I don’t understand “Randomly perturb the initial 25% within the perturbation limits and add them to the set.” I don’t know what the initial 25% are.
I just tried to perturb the two delay sets from the array with the best 25% (with the 2 delay sets) three times and added them to the array. The results don’t make sense and I’m sure this is wrong.

And I’m not sure where to get the delay values for each device from this algorithm.

Can some please explain how it works and say a few words about how I could realise this? I’ve been working on that for quite some time and scoured the whole forum but didn’t find any answers. I can upload my matlab file if this would help.