I would like to build a system for a school project where I need to get the distance and direction from an object to my phone inside a room, so UWB would be best suited for this case.
It’s my first time using this technology so everything isn’t clear at the moment, I think I got the basis but I have a question.
As I understood, TWR only gives you the distance between the two objects, if you want the direction you would need to use PDoA/TDoA (I don’t know which one would be best in my case) and thus, 2 antennas. I found the DWM1000 module to be suited for my project (we are on a cost constraint), but it only have 1 antenna, since I plan to use it with my phone (iPhone 15 Pro), I wondered if the phone had the 2 antennas, and if I could do the angle of attack computation from there instead of the module. If it isn’t possible, what solutions would you recommend ?
To get things clear, PDoA (Phase Difference of Arrival) is used to describe the angle that a signal got received from. This is done by using two antennas next to each other.
TDoA on the other hand is the difference in time between two received signals. Let’s say you have two stationary beacons (lets call them anchors) that are synchronized to each other. Each second, they send a blink message at exactly the same time.
A moving device (tag) could now receive both messages after each other and calculate the relative time difference between the two. Do that with a third device and you can map two curves that collide with each other at one point. That’s your tags position.
You can find more information on this here.
In your case, you’d want to use ToA (Time of Arrival). TDoA is quite complex todo as the synchronization needs to be very accurate (e.g. different cable lengths of the synchronization line already lead to inaccuracy). With ToA, you (your phone) sends a message to one of your anchors. You note down the timestamp of when you sent your message (lets call it TSs).
The anchor receives the message, processes it (causing a delay if D) and sends an answer. Simply speaking, by noting down the receiving timestamp of the answer message (now called TSa), you can get the time it took the frame to go from sender to receiver with the following formula:
ToF=(TSa-TSs-D)/2
That’s the easiest approach you can do.
There was a discussion in this forum a few weeks ago that newer iPhones don’t have the second UWB antenna anymore (the creator of the discussion speaks about AoA which is Angle of Arrival - basically what results from your PDoA data).
You could either try using an older phone or using a different board than the DWM1000. A good alternative with two antennas would be the QM33120WDK1 (great name lol).
You can find an overview of kits and their use-cases on this page under the chapter “Ultra-Wideband Development Boards & Kits”.
If you feel more comfortable with Arduino programming, the ESP32-DW3000 by makerfabs might be for you. I published a library for it here.
Thanks for the detailed answer,
Sadly the 2 antennas board is a bit out of my price range lol, I could find another older phone and try with it.
About the TDoA/PDoA confusion thanks for the clarification, if I understood that well I should 100% go for the PDoA approach along with TWR for the distance.
So for this approach should I consider the phone as the anchor and the object as the tag ?
Another question I just thought about, is there any documentations on how to use the UWB on iPhones ? I’m guessing apple isn’t that open about such things
Bit of a nitpick; while this the ideal way to do it, it’s how GPS works, it doesn’t work with UWB (at least not with this version of UWB). The time differences will be far smaller than the packet duration which means they are both arriving at the receiver at the same time.The receiver can only receive one packet at a time and so will only receive one or no data. *(see below)
What you can do is have the moving item send out a blink. All of the anchors around the room receive it and then send to a central computer the time at which they received the message. That computer then calculates the time differences and calculates the location for the tag.
This does still require very good time synchronisation between the anchors but makes for a simple tag since it doesn’t need any significant processing power.
This is how most warehouse style UWB tracking systems work. You put the cost and complexity in the building and keep the items you’re tracking as simple as possible.
(*) I have implemented an anchors are the transmitters, tags are the receivers style TDoA using the decawave devices. It avoids packet collisions by having the the anchors not all transmit at the same time, they transmit with a know pause between each device. The tag then subtracts this pause from the received time to give the time differences. However it was certainly not a simple system to get working. You have a lot of different clock rates that you need to compensate for and installation requires a lot more calibration steps to get the delays correct. Once you have the transmits all set up correctly you still need to allow for any motion by the tag during the measurement time. Position accuracies ended up being in the 7-8 cm region rather than the 3-4 cm I can get using DS-TWR on the same hardware. But since the tags become receive only it removes all limits on number of simultaneous tags. Well other than budget.
@AndyA that’s a fair point, just wanted to point out how it generally worked
Exactly, as Andy pointed out TDoA isn’t really going to work with UWB, at least not as easy as it seems like.
You can, but you don’t have to. If you just want to have distance and AoA (pretty much what the AirTag does as well) you don’t really have an anchor and tag. These terms are used when you want a location, as you need some stationary objects to “anker” your distances to.
If you choose to use an older phone (I really didn’t think the evaluation kit for the 2 antennas would be that expansive) you’d have to do the calculations of AoA on the phone side.
Luckily, Apple is actually quite open about it, as they encourage developers to use uwb in their apps. You can find a documentation of UWB from Apple here.
You’d have to get into programming apps tho, which (as far as I know) is limited to Mac’s and MacBooks because xCode only works on those - could be wrong here tho.
On the flipside, if you are going to use xCode for App programming, they probably do a lot of the maths and correction algorithms in the background, so you could be lucky to get all the AoA information out without much calculation of your own.