Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate the distance to a beacon based on tx, rssi and accuracy

I am using petermetz/cordova-plugin-ibeacon to detect beacons around my mobile device. And I can see that plugins provides following informations about the beacon, such as

uuid, major, minor, rssi, tx, accuracy

What I want to know is what is actually rssi, tx and accuracy? How can I use these three values(rssi, tx and accuracy) to calculate the distance to beacon?

I have gone through this documentation : What are Broadcasting Power, RSSI and other characteristics of beacon's signal?, but didn't got the information I was looking for OR its too high-level for me to understand.

Many many thanks for all your feedback.

like image 570
Dipak Avatar asked Mar 13 '23 15:03

Dipak


1 Answers

The cordova-plugin-ibeacon is a wrapper around the CoreLocation framework on iOS and the Android Beacon Library on that platform. Both platforms use RSSI (the received signal strength indicator) to estimate distance to a beacon. In CoreLocation, the term accuracy is used to indicate this estimated distance in meters. With the Android Beacon Library, the equivalent field is called distance, also providing an estimate in meters.

A summary of these fields meanings is as follows:

Cordova    iOS        Android    Description
-------    --------   --------   ---------------
accuracy   accuracy   distance   Estimated distance in meters
tx         N/A        txPower    Calibrated measured transmitter power at 1 meter in dBm
rssi       rssi       rssi       Received signal strength in dBm

On iOS, the txPower field is used internally, but is not available in the beacon readings.

Because the distance estimate is directly available, there is no reason to calculate it yourself. If curious, however, read on.

The actual calculation used to make the distance differs between iOS and Android, but uses the variables in the table. The iOS calculation is closed source and unpublished. The Androd Beacon Library uses the calculation described in a blog post I wrote here.

Full disclosure: I am the lead developer on the Android Beacon Library project.

like image 93
davidgyoung Avatar answered Apr 30 '23 00:04

davidgyoung