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)
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)