I just got two-way ranging working.  It was a struggle because I had to mess around with some of the timings.

The original code, designed to run on an M3 waits for 2600 units before responding to the ranging packet.  The M0+ won’t work at all with any value less than 6000.   Equally, the “no-response” timeouts have to be extended from 3300 to 7500 to make it listen long enough.  I can probably fine-tune these a bit.   I assume this is mostly down to the processor speed, but I can’t tell for sure.

One important thing is that the transceiver code must not be interrupted while it is constructing the response packet, or its peer transceiver will time out.

Measurements are OK, but not great.   You can just about see the laser dot on the wall below the far (anchor) TS06.3, and the laser rangefinder, and ranging TS06.3 in the foreground.  I think they are roughly on par with the BeSpoon unit.

Setup

Laser rangefinder
(The length of the rangefinder is included in it’s measurement,
so we should subtract about 6cms to the antenna = 3.2m)
DW Measurements

Some of the inaccuracy could be down to the antenna delay calibration – there’s none!

The maximum range is not great.   I can just about get through the wall and into the kitchen, a distance of about 4.5 meters.  The TS seems quite sensitive to antenna orientation.

Sensitive to antenna orientation

I ran the same code on the TS06.2 units, and the range estimates were similarly inaccurate, though better when close.  The maximum range was about the same as the 03 units, and they too were sensitive to orientation.

Calibration

I’m not sure if I did this quite right, but I think I calibrated the antenna delay.   I did it by using identical types i.e. TS06.2 to TS06.2  and jiggled the antenna delay parameters until I could plot a straight line and figure out the equation.  Then I used the equation to find a better calibration parameter.   I did it for both TS06.2 and TS06.3 and got results that settle to within about 10cms.   I only calibrated it over a short physical distance so I expect it probably isn’t good for longer distances.
After calibration, the test I showed at the top of the page settled at about 3.06 meters, or about 14cms short.



Leave a Reply