title: How to calculate the distance of beacon from beacon Receiver using rssi and tx_power
body: <p>I have RSSI and TX_Power to calculate distance of beacon,but problem is I am not getting the distance accurate.   </p>
  
  <p>I try following code to find distance using txpower and RSSI value.</p>
  
  <pre><code>import math
  rssi= -61
  txpower = -64    
  if rssi == 0:
      print(-1)
  else:
      ratio = rssi*1.0 / txpower
      if ratio &lt; 1.0:
          ans= math.pow(ratio, 10)
          print(ans)
      else:
          ans2=(0.89976  (ratio ** 7.7095)) + 0.111
          print(ans2)
  
  </code></pre>
  
  <p>Using above formula I'm getting output of distance is 0.6187m but Beacon Scanner application shows 1.40m for rssi= -61 and txpower = -64.</p>