RadBeacon Tag distance calculating

539 views Asked by At

i am using iBeacon from Radius Networks. At the moment I am trying to calculate the distance between android device and RadBeacon Tag by using RSSI. Like David Young mentioned here the android devices have got different antenna. My experience with the following forumla is not very good in combination with my Nexus 7.

protected static double calculateAccuracy(int txPower, double rssi) {
  if (rssi == 0) {
    return -1.0; // if we cannot determine accuracy, return -1.
  }

  double ratio = rssi*1.0/txPower;
  if (ratio < 1.0) {
    return Math.pow(ratio,10);
  }
  else {
    double accuracy =  (0.89976)*Math.pow(ratio,7.7095) + 0.111;    
    return accuracy;
  }
}   

Can anybody provide me a different formula for the distance calculation or some data of a RSSI / distance measurement for different distances?

2

There are 2 answers

0
davidgyoung On

You can get the best results for a specific device by measuring RSSI at various distances and doing a regression against the above formula to find coefficients for the best fit. You can read an explanation of the recommended distances here:

http://altbeacon.github.io/android-beacon-library/distance-calculations.html

You can then import the data into R (the free statistical computing software) and use the nls function (non-linear least squares) to fit the data with a power curve. Here is the power curve equation: function(x, b0, b1, b2) {b0 + b1*(x^b2)}

The nls function solves for the coefficients b0, b1, and b2 which are used in the formula for A, B, and C.

Here's a tutorial on curve fitting in R for more information:

http://www.walkingrandomly.com/?p=5254

0
Cao Minh Vu On

This application can help you get coefficients for the distance formula directly or collect all necessary data to calculate by yourself https://play.google.com/store/apps/details?id=com.msl.ibeaconchef