How to measure close distance between two iphone devices using bluetooth? - iphone

Can you work out if another iphone is say ~5 horizontal meters away?
This question has been asked here almost identically but a decade is a long time in tech. I have no interest in direction.
How to measure distance between two iphone devices using bluetooth?
Current solution attempts
GPS - This is too inaccurate for <10m
Bluetooth - iBeacon a potential solution for iphones. Similarly, may be too inaccurate due to BT signal interference. At least as SO claims 5 years ago. (How to measure the distance between an iPhone acting like an iBeacon and an Android device)
Have we made any progress here?

There have been no significant changes in the past 5 years. I wrote a blog post with a deep dive into the current state as of 2020. Mobile phones in 2020 have newer bluetooth chipsets than in 2015, and may support Bluetooth 5, but there are no significant new capabilities that improve the reliability distance estimates. Indeed, there are no new proximity sensors on iOS and Android phones (other than NFC, which only measures proximity of a few centimeters away), so it is inappropriate for this use case. What's more, 5 years has made things worse by adding fragmentation, especially on the iOS side. Back in 2015, there were only a few Apple handset variants in common circulation. Now there are over a dozen.
To recap the current state of affairs that is mostly unchanged: you can use one phone to transmit over BLE and another to measure the signal strength and estimate distance. For known transmitters and approximately line of sight conditions (e.g. phones are not in a pocket or purse) measuring whether two phones are 5 meters apart is possible with perhaps a 60 percent confidence interval. Where this falls apart is with three important variables:
Phones and especially Android phones are quite fragmented. Transmitter power and receiver sensitivity are quite unpredictable between models and have a large variance. Apple has much less variance between models, but you still see differences that noticeably affect results.
People often put phones in a case, a purse or a pocket. This throws things off considerably further.
When clear line of sight conditions are not present, results are unreliable as you have said.
Bluetooth 5.1 does offer Angle of Arrival and other features that may improve this, but as of October 2020, neither Android 11 nor iOS 14 support any of these features, making the features unusable with almost any mobile phone.

Related

Distance between 2 nexus 7's [duplicate]

This question already has answers here:
distance between android and iphone
(2 answers)
Closed 9 years ago.
I know nexus 7's have bluetooth 4.0 but what I was wondering if you could use bluetooth 4.0 LE to calculate the distance between two devices? I want a very accurate distance calculator between two devices. I asked earlier about an android and an iphone but I am now only concerned with 2 android devices.
No. Bluetooth LE isn't some kind of magic hi-res GPS, it's basically just bluetooth data transfer using lower-powered transmitters.
Distance to the other device affects signal strength, but so do a bunch of other things. It's like trying to use a WiFi signal analyzer to measure the distance to a wifi hotspot. (Try it. You won't have much success!)
Look at the rather over-hyped Hone Keyfinder: The only thing it can tell you is if you're getting closer or further away from your keys. The keys don't know where the phone is, and the phone doesn't know where the keys are.
iBeacon works by having beacons at fixed lat/long, with a low-power transmitter. They broadcast their lat/long, so if you're in range of one, you know where you are. If you have enough beacons near you, you can triangulate based on relative signal strength. iOS devices acting as 'beacons' only makes sense if somehow they have better GPS coverage than you do.

Indoor navigation hardware/software requirements for iOS

I'm developing navigation system for my university as some kind of research activity. I'm using SVGKit to display floor plans. And now I need to provide user locationing service for navigation and tracking. So here's my questions:
1) Do I need some special hardware installed in university (Cisco MSE for example, or some cheaper analogues), or I can apply some software/technologies to our current hardware for server-side user location determining? If I do, what equipment do I need for it? I mean, it would be one unit for the whole university, or one per each floor, or what?
2)
Q: Why doesn't the Redpin iPhone client conform to the iPhone SDK
Agreement? A: Apple does not provide a public API to retrieve WiFi
data. In order to get the iPhone client working we had to use a
private API, which is disallowed by the iPhone SDK Agreement.
(c) http://redpin.org/faq.html Does it mean that RedPin is unacceptable in AppStore, so I can't use it?
3)Does Navizon I.T.S. requires some specific hardware equipment except standart routers?
Thank you all, maybe you can offer me better solutions, I hope. Thanks in advance.
Indoor positioning is a very vast field and many different solutions are available which all use a different combination of hardware/software. Some need no specific hardware to work, others need a very expensive infrastructure to be put in place. In the end, it all depends on the accuracy you are trying to achieve. Here are the most common solutions used, I ordered them by the type of technology used:
Wifi: two main techniques are used here, trilateration and fingerprinting. Both do not require specific hardware if your uni already has deployed access points (APs). Trilateration converts signal strength to distance and then intersect circles (almost exactly like GPS). In general this has poorish accuracy and you need to know the exact position of APs for it to work. Fingerprinting is a pattern matching technique where you first build a wireless map of the environment and then match the measurement against this map.
Bluetooth: same techniques as above can be used with Bluetooth nodes. Of course, there's less Bluetooth nodes than Wifi so you might need to deploy some extra nodes for it to be accurate enough. Same accuracy as Wifi (roughly 5 meters)
Dead reckoning: uses an accelerometer, gyroscope and compass to calculate the speed of heading of the user. Needs to be initialized and calibrated regularly by another absolute positioning technique. Subject to drift so accuracy degrades quickly over time. Upside is its very cheap, no extra hardware or initial survey phase are needed.
UWB: very accurate techniques based on time of flight measurements. Requires expensive hardware for both transmitter and receiver. You can achieve cm accuracy with this but it's probably not what you're after
This is still an field of research so it's not that easy to find something that just works. I suggest contacting the IT department of your university, if they run a Cisco system, I know some of them provide some sort of positioning capabilities but I don't have much details.
As for your iPhone question, any app that accesses the private API to access Wifi measurements will be rejected by the App store, so you won't be able to publish anything that relies on Wifi. You can still use it for research purpose though, you'll just have to figure out the code yourself as there's no official documentation (some unofficial doc is out there though)
Good luck!

pARK working on iPhone 3GS

I have been building on top of the iphone augmented reality framework found here
but sadly, on mobiles without gyro (namely the 3GS) it doesn't work (as it states.)
Does anyone know of a fix to make it work with the motion sensors and compass heading instead ? Or would anyone be so bounty-hungry to provide the codes to a such framework ?
I will need a way to either make the vectors work, and if it is not possible, I will need to push through and just use heading only.
CoreMotion do work in devices like 3GS. However, this Framework pARk is for devices with gyroscopes (Runtime Requirements: iPad 2 or iPhone 4 running iOS 5.0 or later)
Gyroscope is a fundamental piece of inertial navigation systems (INS) and thus without it you'll have a severe loss in precision.
Check the paper: "Usability of apple iPhones for inertial navigation systems" for a comparison of the performance of iPhone 3GS and iPhone 4. The author's conclusion is:
However, the tests show that even with the use of filters
it is challenging to build a precise INS using sensors from
common devices because of their inaccuracies and high
error rate. The results show that the iPhone 4 can provide
tolerable results for a short time, but then the deviation
becomes too high because of the error rate. Currently we are
implementing a multi-dimensional Kalman filter to examine
possible enhancements. Furthermore we try to improve the
system by using more sensors from the iPhone 4, e.g. light
sensors and camera.
I believe you should think your app to support only iPhone4 or newer.

What is the range of bluetooth and is it strictly 1:1?

Does anyone know what kind of range can you get from the iPhone
bluetooth? Also, would the connection be strictly one to one? I know you
can choose from a number of peers to connect to but once the connection
is established, it seems you can only transfer data between one peer? So
basically, is it possible to create some kind of "multiplayer" experience?
Just answering the range part of your question...
The 10 meter figure for class 2 devices (of which the iPhone is an example) is very much a guideline.
The range of a Bluetooth device is limited by many real world factors. The 2.4 GHz radio frequency used by Bluetooth is strongly absorbed by water. For example, consider an iPhone connected to a Bluetooth mono headset. If the headset is in one ear and the iPhone is in your trouser pocket on the opposite side of your body, then there's a lot of water between the two devices. This will often cause a significant amount of packet loss in practice (you can hear this in the audio being carried). So, in this case, the range is about one meter.
At the opposite extreme, two class 2 devices separated by nothing more than clear air can get ranges of hundreds of meters.
Other factors that influence things are:
Interference - Lots of things use 2.4 GHz. WiFi, for example can cause problems.
Antenna design - Space and cost constraints often mean that the antenna design is sub-optimal. I don't know how good the iPhone is in this respect.
Walls - Generally walls attenuate Bluetooth signals. However, sometimes they are useful reflectors.
Quality of hardware - Some chips work better than others. Even different firmware revisions of the same chip may perform differently. Different versions of the iPhone probably have (or will have) different chips in them.
Protocol - It is possible to work around poor signal quality with error correction and retransmission. Even if the iPhone SDK forces you to use a particular protocol, careful design of your application can make a difference.
So, in summary, you should probably do some real world tests.
The connection is one-to-one, but you can create an adhoc network with one of the phones acting as the master/coordinator. The other phones would route all their communication through the master/coordinator.
One device can theoretically connect to 7 devices. according to the master-slave role, the device can multiplex between each of them giving the user an impression that you are connected to all of them simultaneously. Bluetooth specification does not stop you from doing that.This is theory.
Now for the iphone, whether it can connect to to more than one device can only be answered by apple or someone who knows the iphone bluetooth API. But I am pretty sure the bluetooth chip inside iphone should be able to connect to more than one device.
Range is essentially going to be good enough for a normal sized room to be covered. It can be longer or shorter depending on environmental circumstances, but remember that bluetooth was created to implement short range connections.
A bluetooth device can be part of a piconet of eight devices, one master and up to seven slaves. The slaves cannot communicate with each other, they must talk through the master, think of a star topology with the master in the center. The iPhone SDK has a GameKit framework that can be used to create the network for multiplayer games. Go to developer.apple.com at look at the GKTank and GKRocket sample code to see how it's used. These games only support two players, but the GameKit framework supports more. Look at the app store and you will see games that have four or more players.
Hope this helps to get started.
Apple iPhone 3G has a Class 2 bluetooth module. Class 2 Bluetooth devices have a communication range of 10 meters.
At a given instance a device can connect to just one device because it follows a master/slave communication model. But still we can perform a multiplexing. So we can virtually connect to more than 1 device and by rapidly changing the connected device.
I found a good article here. It explains bluetooth very well.
According to the my knowledge, multicasting is not impossible with bluetooth. So gaining a multiplayer experience is NOT impossible.
The bluetooth in the iPhone is Class-2, with a 10-meter range, approximately.
Unfortunately I can't answer the other parts of your question.
One device can be connected up to 8 others. It all depends on the iPhone bluetooth API (which I don't know anything about), but with Bluetooth itself you could then send data to multiple devices.
I tether my iPhone to my laptop over bluetooth every day, and I seem to remember having done that at the same time as using a bluetooth headset. YMMV.
It’s the latest incarnation of Bluetooth, the wireless device-to-device technology that allows your phone to talk to headsets, car stereos, keyboards and other devices directly, without the need for a router or shared wireless network.

How accurate is the triangulated GPS of the non-3G iPhone?

Does anyone have any experience with the triangulated GPS used by the non-3G iPhone? How does it compare with 3G positioning? Does the iPhone 3G use triangulation in the event that there is no GPS signal available? Is there anyway to determine the accuracy of the non 3G coordinates? Thanks.
I have done a lot of mobile software with a bunch of different devices including 3G iphones and 3G blackberry's and here is what I have found.
The blackberry and iPhone GPS is really good when you have clear line of sight and at least 9 satellites present. In some dense residential or urban areas you might only get 5-6 satellites which can take a while to converge.
If you do not have a signal, GSM phones like the iPhone will try and find your position using cell tower signal strength but it is NOT as accurate as GPS... not by a long shot.
I have heard, though this has not been confirmed that the iPhone also uses some server side machine learning when it can't find a GPS lock meaning that it takes the average all of the cell towers, plus the average of all the users who have used GPS in your area to try and find your best position. This is sometimes called AGPS or assisted GPS where the GPS information and cell tower strength are used together.
Also, the only thing I can think of for finding the accuracy of the non 3G coordinates would be to programmaticly switch providers in your code, or simply go into preferences and turn off 3G and write an application that does some tests.
The Pragmatic Programmers have a great iPhone SDK book that just added a chapter on using the Location API, so that might be a great place to start.
Hope this helps.
The CLLocation class has the properties 'horizontalAccuracy' (for latitude/longitude) and 'verticalAccuracy' (for elevation).
In addition to cell towers and GPS, locations may also determined by Skyhook Wireless, which has a database of Wi-Fi base station MAC addresses and locations.
When using only GSM towers, it's +/- 500m (it varies greatly, sometimes it's more precise).
If it finds known Wi-Fi network, then it's down to +/- 50m.