Trilateration with DWM1001C

Hi all,
I used 3 anchors and 1 Tag based on DWM1001c module. for now, I have the range from the tag to each anchor and the know positions of the three anchors in a backend server with flask.
I would like to compute the estimated value of the tag. I found this in wikipedia

I would like to know if it’is working well ?
what is the difference between this method and least square method ?

yes, that is the most appropriate for the use case of exactly three anchors.

least square is an optimisation method that requires an initial estimate, and the iteration count depend on that, it is also way more calculations compared to the cartesian method. You need optimisation method if you have more than three anchors, because then, you no longer have a single possible solution but need to take an average.

Remember that you can take many measures of each range to improve accuracy, and you can also average across time, or sliding window filter

I recently posted a survey of range to position techniques

https://homesmartmesh.discourse.group/t/survey-of-uwb-range-to-position-techniques/54/4

I’ll be working on an automated method selection depending on the number of visible anchors.

This is a good answer by the way, although he did not stress on the higher processing time, which of course you can ignore if you’re not under real time or low capacity uC constraint

Thank you a lot @wassfila
I appreciate a lot your help

1 Like

You should start with reading “APS011 Sources of error in two way ranging scheme” and then “APS014 Antenna Delay Calibration”

  • Did you apply a “RANGE BIAS CORRECTION FACTOR” ?
  • did you apply “CALIBRATION DISTANCE FOR CHANNELS AND PRF” ?

The simple samples do not have that. I’m also not sure is a per device antenna calibration is configured on the modules or if it is being used, that’s something you can check.

it seems accurate without referring to what you mentioned ? isn’t ? it is less than 30 cm
is it worth to dive into those concepts ?

That depends on your needs, I thought you asked for enhancements to improve the error.

  • one way is to dive in calibration
  • another is to increase the number od measures and average over time
  • or an additional is increading number of anchors, but then you need another algo

What you can do to check the precision and accuracy of your measures is to sample 100 or 1000 and draw a histogram of the error

so for th idea of increasing numbers of anchors, how can I implement it ? let’s say I will add one more anchor so we will have 4 anchors in total

The way i would do triangulation for 4 points is like this. So the distance from each anchor (red) to the tag (blue) u have: r1, r2, r3, and r4. and u know the xy coordinate for each anchor. U can write out the equation for the circular path for each anchor. and then compute for x and y. this example is for 2d only.

(x+x1)^2 + (y+y1)^2 = r1^2
(x+x2)^2 + (y+y2)^2 = r2^2
(x+x3)^2 + (y+y3)^2 = r3^2
(x+x4)^2 + (y+y4)2 = r4^2

fourPointsTriangulation(1)

if u want more optimized approach, maybe u need methods like this, which t i dont understand it fully.

my question has always been that, the way u guys are doing it now, does the tag itself computes it’s location or the anchors report their distance to the tag to a centralized system that does the computation?

I did not work on a ready implementation yet for 4 or generic case.

For 4 or more, Least square makes sense, at worst, you implement both, and compare for the same number of samples which one needs more cpu time and provide better result. In case multilateration only works with 3 and you have 4 that’s how AndyA explained in the forum, you repeat 4 times with different set of 3, not ideal.

@uni it depends on the architecture you need to implement.
for me, it is not a perfect architecture to compute the location on the tag becauz it will consume a lot of power which is not perfect specially when your tag is powered with a battery, so I just send the data from anchor to a backend server which is my pc and did the trilateration there.
if you don’t care about the energy consumption, you can add a report msg if u use DS-twr and do the trilateration on the tag and if you use SS-twr you already have the ranging on the initiator (tag) itself so just do the trilateration on it.

ok, that’s what i thought. although at first, i thought if the tag doesn’t hav to send the pulse signals, it would consume less energy just by listening. bc transmitting would consume more power. it’s possible if the calculation is simple, it would consume less energy computing it on the tag. but u are right its depends on the architecture bc it would make sense to do something like this on a mobile phone instead of a low battery power operating device.

ok, it occurs to me that if the anchors do some of the computations themselves. as edge devices, they can off load the central device and may produce better outputs. bc with uwb rf, devices can operates as much higher throughput. u cant transmit that much data on regular 2.4ghz band. so it maybe better to do the averaging on the anchors. bc even if the central device has more than enough computing power to compute the raw throughput, it cannot receive data as fast as the anchors do. it would create a lot of stress on the network.

@wassfila do you know how to plot sthg like this ?

Depending on your framework or target publishing media

  • printable and pdf, you can use latex
  • or you can use any tool then export svg for web or pdf

  • in scientific programming, matplotlib is the most common and powerful

https://matplotlib.org/stable/gallery/index.html

That’s what I use for example for histograms here mesh_position/ranging_square.ipynb at main · HomeSmartMesh/mesh_position · GitHub

There are alternatives just search for scientific data visualization as example

https://www.originlab.com/

i would do it with google sheet if u just want a quick glare at the data. save me lot of time. it does get kinda laggy with large dataset (about 5000 records or more)

@uni I plot them using seaborn libraries.

how did u log the data?

from csv file that I put into into it 1000 observations for each range (30m, 20m, …) between the initiator and the responder