Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to estimate distance between two android devices? (bluetooth preferred)

Tags:

Target is not to have the real distance. It is something simpler.
Target is to check whether another device is very very close. True or false. Let's say 10 or 15 cms is close so our check is true and any device further away fails the check and it is false.

My first approach was to use api's method fetchUuidsWithSdp() but it failed!
Latency seemed the same whether the devices where a couple of cms away or at the other end of a large room!

Any solution even without bluetooth is acceptable. For instance, I am totally unfamiliar with the wifi direct p2p protocol. Maybe there could be something in there useful to have a rough estimation of distance.

Edit: I am reading about Received Signal Strength Indicator(RSSI). This could be used for our particular case, a rough estimation of distance between devices. But maybe there could be something to combine in order to improve the accuracy.

Edit: I put Ralgha's answer to the test. I did established a connection and had a minor protocol to ping-pong among devices.
When ping-ponged with 1 byte average latency was 22.6000 msec when very close and 22.6087 msec when on the other corner of the room.
When ping-ponged with 1024 bytes average latency was 40.3173 msec when very close and even smaller, 32.3138 msec, when on the other corner of the room.
After all, indeed, latency does not carry any information about distance!

Thanks!

like image 781
George Pligoropoulos Avatar asked Dec 23 '12 22:12

George Pligoropoulos


People also ask

Can Bluetooth measure distance between devices?

Beacon technology generally estimates the distance between devices using the received signal strength (RSSI). Localization of Bluetooth devices is done by combining the distance estimate to several beacons, mounted at fixed and known locations, using triangulation with at least 3 anchors.

How does Bluetooth calculate distance?

The signal strength depends on distance and Broadcasting Power value. Bluetooth works with broadcasting signals and that broadcasting power value is around 2–4 dBm — and due to that, the signal RSSI strength will be around -26 (a few inches) to -100 (40–50 m distance).

How can I measure the distance between two phones?

The 'WifiNanScan app lets you measure distance with a precision of about one metre with phones up to 15 metres apart. Google has launched a new WifiNanScan app for developers on the Google Play store.


1 Answers

You can measure distance with sound.

like image 90
Kornel Avatar answered Sep 22 '22 15:09

Kornel