# Given PDOA how to calculate the Angle from tag to anchor

Hi，

The PDOA has been obtained through dwt_readpdoa()，how to calculate the Angle from tag to anchor.

Thanks
KK

The PDOA (Phase Difference of Arrival) can be used to estimate the angle between a tag and an anchor in a wireless ranging system based on time-of-flight measurements. To calculate the angle from the tag to the anchor, you will need to know the location of the anchor and the time-of-flight measurement for the radio signal transmitted between the tag and the anchor. Here is a general outline of the steps you can follow to calculate the angle:

1. Determine the location of the anchor: You will need to know the coordinates (x,y) of the anchor in order to calculate the angle. This information should be provided to you by the system or by the manufacturer of the anchor.
2. Determine the time-of-flight measurement: The time-of-flight measurement is the time it takes for the radio signal to travel from the tag to the anchor and back. You can obtain this measurement using the dwt_readpdoa() function.
3. Calculate the distance between the tag and the anchor: The time-of-flight measurement can be used to calculate the distance between the tag and the anchor using the speed of light. The speed of light is approximately 299,792,458 meters per second, so you can use the following formula to calculate the distance:

distance = time-of-flight * speed of light / 2

1. Use trigonometry to calculate the angle: Once you have the distance between the tag and the anchor, you can use trigonometry to calculate the angle. Specifically, you can use the inverse tangent function to calculate the angle based on the coordinates (x,y) of the anchor and the distance between the tag and the anchor. Here is the general formula:

angle = atan2(y, x)

I hope this helps! Let me know if you have any questions or if you would like further clarification.

Please don’t pay any attention to Keonte45s answer, it (like most of his answers seem to be) is wrong in almost all of the key details.

You calculate the angle independently of the distance by using the phase difference of the signal between the two antennas.

If you put two antennas close to each other then the signal will arrive at both antennas at roughly the same time. There will be a very slight difference in the time that depends on the angle of the signal. If it’s square on then there will be no difference, if it’s at 90 degrees then the difference in time will be the speed of light multiplied by the antenna separation.

Unless the antennas are a long way apart this time difference is too small to directly measure accurately enough to be of much use. But what you can do fairly accurately is compare the two signals and measure the difference in the phase of the signals. This doesn’t give you any absolute time measurement but does give you the relative time difference between the two as a proportion of a cycle of the RF centre frequency. As long as the antenna separation is less than half a wavelength then this time difference can unambiguously* be converted into an arrival angle.

This is completely independent of any locations or distances. You can also use TDoA or TWR to calculate ranges and then combine both the distance and the independently measured angle into your position calculation. This extra information allows either positioning with less anchors or better / more confident positioning with the same number of anchors.

So to answer the original question - You use the phase difference and the antenna separation to calculate the angle of arrival. Distance is calculated using conventional TWR or TDoA methods. The user manual and application notes give more information on exactly how to do this and the relevant equations.

*There is still ambiguity as to whether the angle it’s in front or behind the pair of antennas but antenna design and placement and other positioning methods can normally eliminate one of those two options.

I apologize for giving a wrong answer. Thank you for pointing that out.