When connecting to another phone using bluetooth, is there any way to know how far away the other phone is (would be better if it can tell me the exact distance even though a estimated distance is fine with me)?


No more precisely than you already know: if it's connected with Bluetooth, it's probably less than ten metres away. It might theoretically be possible to use the round-trip-time between the two devices, and the finite speed of radio waves, to compute the distance, but in practice at these small scales the travel time is less than the latency in the Bluetooth stack. Radio waves take about 3 ns to travel a metre, which is about the time it takes a 2 GHz processor to execute one instruction.

You can get a reasonable approximation using the received signal strength indicator (RSSI) that the Bluetooth stack tells you. This number is available to apps, and it tells you how "loud" the remote endpoint's radio signal appears from the phone. A more positive number means the devices are close together; a more negative number means they are far apart. Some apps use this number when offering a list of devices to connect to: sorting the list by RSSI puts the closest devices at the top.

However, this is only an approximation. The RSSI doesn't simply vary with distance: it's affected by other factors. Reflections from other surfaces and objects can make it increase or decrease, and having objects in between the two phones makes it decrease. For example, if you're holding your phone, and the other device you're connecting to is behind you, so that your body is in between them, it will appear further away. Similarly, if the device is in your pocket or bag, it will appear further away. Even if you stay in the same place and nothing moves, the RSSI will still fluctuate a lot, because of interference from other radio sources.

Bluetooth LE beacons such as iBeacons use the RSSI to present an approximate distance, but it's only to categorise as "far", "near", or "immediate" (nearly touching), because you can't really get more accurate than that with RSSI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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