首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用RSSI计算近似距离

使用RSSI计算近似距离
EN

Stack Overflow用户
提问于 2020-05-24 13:41:59
回答 1查看 932关注 0票数 1

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

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

我想了两种方法来实现。第一种是利用RSSI值测量距离,第二种是首先从房间内和房间外的多个地方校准设置,并得到一个阈值RSSI值。我读到智能手机发送wi-fi数据包,即使在wi-fi被禁用的情况下,我想使用这个功能从发送的智能手机获取RSSI值(被动地使用kismet ),并检查它是否在房间里。我也可以使用蓝牙RSSI。

如何使用RSSI计算距离?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-24 20:44:14

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

代码语言:javascript
运行
复制
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));
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61982078

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档