How to measure distance between two iphone devices using bluetooth? [closed]
Asked Answered
M

7

43

I'd like to do something in the following using bluetooth.

  1. Measure and display how far my iPhone is from another iPhone.
  2. Display direction of my iPhone.

For example,

I'd like to display something in the following on my iPhone application.

My iPhone is connected to another iPhone:Harry's iPhone.

In this case,

  • Distance : 3m 45.3cm (Accuracy:milimeter)
  • Direction : North East(one of 8 available directions)

Does anyone know how to do this?

Mantellone answered 2/9, 2010 at 8:16 Comment(1)
In order to calculate the distance between two devices, wouldn't it be possible to perform a sort of ping and calculate the time required to get a response?Rountree
J
37

Using bluetooth for localization is a very well known research field (ref.). The short answer is: you can't. Signal strength isn't a good indicator of distance between two connected bluetooth devices, because it is too much subject to environment condition (is there a person between the devices? How is the owner holding his/her device? Is there a wall? Are there any RF reflecting surfaces?). Using bluetooth you can at best obtain a distance resolution of few meters, but you can't calculate the direction, not even roughly.

You may obtain better results by using multiple bluetooth devices and triangulating the various signal strength, but even in this case it's hard to be more accurate than few meters in your estimates.

Jody answered 2/9, 2010 at 8:33 Comment(0)
B
9

You could use sound and knowledge of speed sound to calculate the distance between the iphones.

Bustup answered 28/8, 2011 at 21:21 Comment(0)
L
8

In iOS7 Apple introduced iBeacons. This will give you the distance between 1 phone and another. It is simple to setup, check out the WWDC sample AirLocate.

Lm answered 24/9, 2013 at 10:27 Comment(2)
Like any RF-power-based distance measurement, it's also not going to be very accurate.Phosphene
I've found it to be very accurate. Where it would return the location within 0.1/0.2m of where I was.Lm
C
4

You can't do this with bluetooth. You could meassure the distance between two BT devices by analysing the BT reception quality - but this will strongly differ in every new environment (e.g. simply a new room or in the open air). For direction: here is exactly the same problem, especially inside buildings. A lot of BT signal echos will make it almost impossible to receive useful direction data. There are ways to determine distance and directions via wireless connections (doesn't matter if BT, WLAN or ZigBee or something else) - not with standard customer devices, but with real-hitech laboratory equipment.

Consort answered 2/9, 2010 at 8:34 Comment(2)
If we assume that there is no wall or obstacle between devices. Then is it possible to calculate the distance?Mantellone
No, as the BT antenna is not directed to a specific direction it doesn't matter if there are walls in direct view between the two devices. It could work if the antenne is directional (similar to an ultrasonic distance measuring tool), but the antennas in the iphone have a to wide angle of beam.Consort
S
0

For direction, you would have to hold the phone away from you and spin in a circle allowing the phone to measure the increase/decrease in signal strength. Not sure how good the iPhone signal reception will be.

You could estimate the distance by looking at the signal receive strength. You will have to perform many tests, in different environments in order to get some half decent metrics to use within your app.

Snowmobile answered 2/9, 2010 at 8:26 Comment(2)
Hello Simon, Thanks for your reply. As you know, iPhone SDK doesn't support any utility to calculate the distance between iPhone devices. It does support only connectivity and data transmission. Speaking of signal strength, I don't know how to get the strength of signal. Could you tell me more detail? Thanks.Mantellone
I can't tell you any more detail sorry. If the iPhone only supports connectivity and data transmission, then you cannot calculate a distance or a bearing. I have to agree with heb and Guiseppe here. It might be possible with the right equipment, but not with a simple consumer device.Snowmobile
S
0

You can't do it against only one Bluetooth device, but you might with 2. Assuming the 2 remote devices are in static location (speakers), and you move your mobile (pun intended) Bluetooth device. You should be able to derive your angle based on speed of distance change from the 2 devices. Only problem is that the solution has 2 values, but that might be doable if you know which side of the plane you're on.

Seaweed answered 17/11, 2019 at 5:39 Comment(1)
But the accuracy of the angle will still be very limited by the accuracy of measuring the distance to the fixed outside beacons, which in itself is a very challenging task unless measured in very specific environment with exact known parameters. Considering everyday modern environments this would create highly incarcerate readings to often to be useful as a measurement tool.Folksy
E
-1

As what Giuseppe Cardone has mentioned, using the signal strength wont work. However, I would suggest requesting the location information of the other device (let's say that, you install an app on the other device that replies to location requests.). Once you get the location information from the other device you may compare it with your device's location and calculate the distance and the direction.

Enkindle answered 4/6, 2012 at 22:4 Comment(1)
This might work outdoors by using GPS in the application. With bluetooth only it is probably difficult given IPhone's weak BT support outside preimplemented profiles.Jumbala

© 2022 - 2024 — McMap. All rights reserved.