我正在做一个项目,旨在测量单个树莓派和附近智能手机之间的近似距离。
该项目的最终目标是检查树莓的同一个房间里是否有智能手机。
我想了两种方法来实现。第一种是利用RSSI值测量距离,第二种是首先从房间内和房间外的多个地方校准设置,并得到一个阈值RSSI值。我读到智能手机发送wi-fi数据包,即使在wi-fi被禁用的情况下,我想使用这个功能从发送的智能手机获取RSSI值(被动地使用kismet ),并检查它是否在房间里。我也可以使用蓝牙RSSI。
如何使用RSSI计算距离?
发布于 2020-05-24 20:44:14
这是一个未解决的问题。基本上,在理想状态下,根据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));
}
https://stackoverflow.com/questions/61982078
复制相似问题