5

Yeah, I'm currently wondering about this. In my use case the devices will be 50cm to 10m apart and I'd like it to be accurate to at least 10 cm. (Therefore GPS is not an option)

2 Ways spring to mind:

Sound: I asked about this in the dev forums and I'm in contact with laanlabs, about the code of their sonar ruler.

Picture on one device + Camera on the other: Seems easier to set up, since my user case involves the user facing one device at 90 degrees anyway. But it would be more work for the user to face the camero into the direction and it would not react to a change in distance.

Now the question: Is anyone aware of any code that does something like this already? Possibly a non-iPhone general c-Project?

Bersaelor
  • 2,517
  • 34
  • 58
  • 2
    Yeah, but if it were possible I'd rather do it with sound, because then the user doesn't have to face the camero in the right direction. The remote Device will always be an iPad because an iPhone's Display is just to small for my purpose. The Input-Device can be either an iPhone or iPad, its universal anyway. – Bersaelor Dec 08 '10 at 20:06
  • You cannot use sound between two iOS device unless you know exactly the time the sound was played. – Black Frog Feb 23 '11 at 17:32
  • You want to achieve too high accuracy. It's not measuring distance between to points. Device is real-world object with own dimensions. And its length is about 10 cm (for iPhone/iPod). What point of device should be start point for measuring? @Kim Burgess suggest a good method, but it all depends on microphone position. Now it's 35 cm, but if you rotate device - 45 cm. All depends on starting point – 5hrp May 11 '11 at 09:01

3 Answers3

3

If you were to use the sound method one approach would be to have device A emit a sound, device B would then be listening for this at all times and on detection echo back a secondary sound. This would give you a round-trip time from which you could calculate distance - don't forget to compensate for latency between detection re-emission as well.

Kim Burgess
  • 467
  • 3
  • 15
  • 1
    @Sharrp brings up a good point regarding the origin of the measurements if you are requiring precise distance. I'm not an iThing developer and not sure how accurate their gyro's are but you should be able to get device orientation from this. Using a bit of math and knowledge of the device dimensions and where the speaker and mic are located you can then compensate for device orientation. – Kim Burgess May 12 '11 at 00:21
  • 1
    This data could be encoded in the echo'ed audio from *device B* so that *device A* can calculate the precise(ish) distance. – Kim Burgess May 12 '11 at 00:46
3

Method with camera: we already know size for each device. You take a picture of device, calculate it's height/width to determine type of device (iPhone/iPod or iPad), than calculate a distance.

For example - if device is iPhone you know, that its size is 115x58 mm. On picture it NxM pixels. Now you can calculate the distance. (If N & M smaller hence distance is larger)

5hrp
  • 2,230
  • 1
  • 18
  • 18
0

I am not sure about but this is what i found from one of the answers in this previous SO question How to measure distance between two iphone devices using bluetooth?

Using bluetooth for localization is a very well known research field . 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.

Community
  • 1
  • 1
visakh7
  • 26,380
  • 8
  • 55
  • 69