Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can iOS detect bluetooth signal strength similar to Airpods?

It seems that AirPods and iPhone can communicate on a very sensitive level. Moving AirPods physically close to the device (1 foot away) will trigger the iPhone to react.

Can the iPhone really detect bluetooth signals with such accuracy? I'm using bluetooth right now, but I can't seem to reach this level of signal sensitivity.

like image 617
TIMEX Avatar asked Jul 18 '17 17:07

TIMEX


People also ask

Can you measure Bluetooth signal strength?

To determine if a Sync Bluetooth device location has adequate signal strength, you can measure the Bluetooth signal strength at its installation location. Primex recommends using the nRF Connect for Mobile . This app allows you to scan and explore Bluetooth® low energy devices.

What is Bluetooth inspector?

Description. Discover nearby Bluetooth peripherals and inspect their services for information and characteristics. • View information and signal strength for all peripherals and devices, updating in real time as you move around.

How do I enable ble on my iPhone?

On your iOS device go into "Settings-> Bluetooth" and turn on your BLE device. You should see the device listed in your available devices.


1 Answers

They used to have some additional measures to find out the distance. As noticed by hotpaw2 in comments


Quick Answer - Swift 4.2

func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
if let power = advertisementData[CBAdvertisementDataTxPowerLevelKey] as? Double{
   print("Distance is ", pow(10, ((power - Double(truncating: RSSI))/20)))
   }
}

TL:DR;

Factors Affecting RSSI

RSSI readings are not very stable and highly depend on environment

It may also vary due to a number of factors, including both the power and sensitivity of the sensing / transmitting radios, as well as the environmental stuff (are you inside, outside? are there many people nearby? noisy wireless environment or not, and so on).

The problem, however, is that beacon signals are actually radio waves, and can be absorbed by metals, walls, water etc. Since they transmit radio signals in the commonly used 2.4GHz band, the signal strength received from a beacon varies widely because of interference.

One of the mostly used formula to find out distance is

d = 10 ^ ((TxPower - RSSI) / 20)

TxPower is typically known as transmit power


How to get TxPower From BLE advertisement Data

The txPower value will be available in BLE advertisement data (available only if the broadcaster (peripheral) provides its Tx power level).

As per apple documentation the value of CBAdvertisementDataTxPowerLevelKey in CBAdvertisementDataTx

Delegate method to access the raw advertisement data

optional func centralManager(_ central: CBCentralManager, 
                 didDiscover peripheral: CBPeripheral, 
           advertisementData: [String : Any], 
                        rssi RSSI: NSNumber)

Can be also accessed by using BlueCap API

To know more advantages of AirPlay than Classical Bluetooth

https://www.cambridgeaudio.com/blog/airplay


RSSI and Distance

According to the image below from Link

enter image description here

RSSI will go down if you cover the beacon (e.g., a person comes in between you and the beacon). That is, you're still in the same distance, but RSSI goes down—so where you to base the distance estimate on the RSSI, the distance would go up, without you moving an inch.

Many of the above explanations are taken from other sites.

I Hope it sum up to your need!

like image 121
Saranjith Avatar answered Oct 07 '22 01:10

Saranjith