Post

Replies

Boosts

Views

Activity

How to Calculate the accurate distance from nearby bluetooth device like mobile phones in iOS?
I search the nearby Bluetooth devices. And using the RSSI and tx-power value (tx-power hardcoded power value Usually ranges between -59 to -65) the distance by this code.   func calculateNewDistance(txCalibratedPower: Int, rssi: Int) -> Double{     //txCalibratedPower : hard coded power value. Usually ranges between -59 to -65     if rssi == 0 { return -1 }           let ratio = Double(exactly:rssi)!/Double(txCalibratedPower)     if ratio < 1.0{       return pow(10.0, ratio)     }else{       let accuracy = 0.89976 * pow(ratio, 7.7095) + 0.111       return accuracy     }   } But didn't get that much accuracy. For android, they use the Kalman filter to remove the noise between the path and calculate the distance (80 - 85 %) accuracy. So anyone helps me out to calculate the distance. Question is already here but didn't have a solution : [https://stackoverflow.com/questions/3624945/how-to-measure-distance-between-two-iphone-devices-using-bluetooth)
1
0
3.2k
Aug ’20
Calculate the distance between two bluetooth devices using RSSI value, in swift?
I get the RSSI value from the searched bluetooth device in list. But didn't know how to Calculate the distance. We need txPower to calculate that but from where I get this txPower. I'm using this code but don't know it's correct.  func calculateNewDistance(txCalibratedPower: Int, rssi: Int) -> Double{       if rssi == 0{ return -1 }       let ratio = Double(exactly:rssi)!/Double(txCalibratedPower)       if ratio < 1.0{         return pow(10.0, ratio)       }else{         let accuracy = 0.89976 * pow(ratio, 7.7095) + 0.111         return accuracy       }     }
3
0
3.8k
Jul ’20