Bluetooth 使用RSSI计算近似距离

Bluetooth 使用RSSI计算近似距离,bluetooth,raspberry-pi,wifi,rssi,Bluetooth,Raspberry Pi,Wifi,Rssi,我正在做一个项目,旨在测量单个树莓圆周率和附近智能手机之间的近似距离 该项目的最终目标是检查树莓的同一个房间里是否有智能手机 我考虑了两种实施方法。第一种方法是使用RSSI值测量距离,第二种方法是第一次从室内和室外的多个位置校准设置,并获得阈值RSSI值。 我读到智能手机即使在禁用wi-fi时也会发送wi-fi数据包,我想使用此功能从发送智能手机获取RSSI值(被动使用kismet)并检查其是否在房间内。我也可以使用蓝牙RSSI 如何使用RSSI计算距离?这是一个悬而未决的问题。基本上,根据理想

我正在做一个项目,旨在测量单个树莓圆周率和附近智能手机之间的近似距离

该项目的最终目标是检查树莓的同一个房间里是否有智能手机

我考虑了两种实施方法。第一种方法是使用RSSI值测量距离,第二种方法是第一次从室内和室外的多个位置校准设置,并获得阈值RSSI值。 我读到智能手机即使在禁用wi-fi时也会发送wi-fi数据包,我想使用此功能从发送智能手机获取RSSI值(被动使用kismet)并检查其是否在房间内。我也可以使用蓝牙RSSI


如何使用RSSI计算距离?

这是一个悬而未决的问题。基本上,根据理想状态下的RSSI测量距离是很容易的,主要的挑战是减少由于多径和反射射频信号及其干扰而产生的噪声。无论如何,您可以通过以下代码将RSSI转换为距离:

double rssiToDistance(int RSSI, int txPower) {
   /* 
    * RSSI in dBm
    * txPower is a transmitter parameter that calculated according to its physic layer and antenna in dBm
    * Return value in meter
    *
    * You should calculate "PL0" in calibration stage:
    * PL0 = txPower - RSSI; // When distance is distance0 (distance0 = 1m or more)
    * 
    * SO, RSSI will be calculated by below formula:
    * RSSI = txPower - PL0 - 10 * n * log(distance/distance0) - G(t)
    * G(t) ~= 0 //This parameter is the main challenge in achiving to more accuracy.
    * n = 2 (Path Loss Exponent, in the free space is 2)
    * distance0 = 1 (m)
    * distance = 10 ^ ((txPower - RSSI - PL0 ) / (10 * n))
    *
    * Read more details:
    *   https://en.wikipedia.org/wiki/Log-distance_path_loss_model
    */
   return pow(10, ((double) (txPower - RSSI - PL0)) / (10 * 2));
}