How to detect the relative direction of two mobile devices?

When a mobile device (i.e. a modern smartphone) is taken near to a second mobile device, it is possible to detect inter-device proximity distance using proximity sensors, UWB or even NFC and so on. Now, how to detect the directions of the first mobile device relative to the second mobile device? I mean, how to detect which of the directions among left, right, up, down, front & back the first device is located of the second device? Any paper work reference would be appreciated.

  • 1
    @All if you think there is other better SE site for this type of question please let me know by comment before you downvote. I will move the question in proper place. Commented Dec 22, 2021 at 19:21
  • 1
    Do you mean using phones currently available in the market, or if you designed and built your own devices? Do you mean anywhere without any prior equipment, or can it be restricted to a room with reference beacons/anchors? What kind of distances? What kind of accuracy? Do you mean relative to one phone’s own frame of reference (e.g. 1 m to the left of the screen) or in an absolute frame of reference (e.g. 1 m north of the first phone)?
    – jcaron
    Commented Dec 22, 2021 at 23:14
  • Depending on your answers it could range from relatively straightforward to completely impossible, with a lot of options in between…
    – jcaron
    Commented Dec 22, 2021 at 23:15
  • @jcaron lets say for phones currently available on the market and also ongoing researches, within proximity of 10/50 cm, relative/absolute. Any article or reference would be helpful for the feasibility. Commented Dec 23, 2021 at 4:56

2 Answers 2


Direction detection is one of the selling points for UWB (Ultra Wide Band) and Bluetooth 5.0 when combined with multiple antenna arrays.

This allows for AoA (Angle Of Arrival) to be calculated which will give you a relative direction to another device.

But given the form factor of the a phone it only really allows for the antenna separation in a single plan which means angle direction is similarly constrained (left/right, not up/down).

  • If more than two antennas are used, cant it cover all direction? Also any article or any idea how much closer distance modern devices can reliably detect? Commented Dec 29, 2021 at 5:00

This problem can't easily be solved without being able to install software on both devices. Devices usually have screen on front, and camera on front and back. So if you were to use screen to show a QR code, and both cameras on other device to look for that QR code, you'd be able to determinate relative position (based on angle and size of QR code seen on camera). You can use screen on both devices and all 4 cameras to cover almost all positions. This can also be improved by using compass and acceleration data. Another solution would be to take photos with both cameras on both devices at the same time, and look for repeated patterns in pictures (positioning based on idea that environment is constant and shared). Also, sound can be used to determinate distance if environment is fairly quiet.

BTW. If you can change hardware on both devices then solution would be quite simple to implement with directed IR transmitters and IR receivers on all sides.

  • How about using AoA (Angle of Arrival) of BT or UWB? Commented Dec 28, 2021 at 19:32
  • As I understand BT5.0 directional features are used for much bigger distances (meters not cm), and at bigger distances should be able to detect single angle, so you'd need 2 orthogonal angle readings and a distance reading to get a position. This is still a new technology so I really can't tell about the realistic precision expectation for this. Commented Dec 28, 2021 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.