bluetooth - 使用 RSSI 计算近似距离

标签 bluetooth raspberry-pi wifi rssi

我正在从事一个项目,旨在测量单个 Raspberry PI 与附近智能手机之间的近似距离。

该项目的最终目标是检查 Raspberry 的同一个房间内是否有智能手机。

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

如何使用 RSSI 计算距离?

最佳答案

这是一个悬而未决的问题。基本上,在理想状态下根据 RSSI 测量距离是很容易的,主要的挑战是减少由于多径和反射 RF 信号及其干扰而产生的噪声。无论如何,您可以通过以下代码将 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));
}

关于bluetooth - 使用 RSSI 计算近似距离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61982078/

相关文章:

javascript - 很难理解 Javascript 中的 "Probably Equals"

objective-c - 如何通过 WiFi 连接 iPhone 应用程序上的多个对等点?

linux - 如何读取 iw wlan0 站输出

ios - 通过蓝牙命令控制AVAudioRecorder

android - 如何获取蓝牙耳机电池电量?

android - 检测定位的 "Bluetooth scanning"是否开启

android - 使 READ、WRITE 和 NOTIFY 在 Android BLE(版本 21 及更高版本)上工作

c++ - GPSD 在 libgpsmm 中给出模式 0

c - 如何避免在 MPI 中将可执行文件从主节点复制到从节点?

java - 维护Arduino和Java程序之间的通信