用于接近检测 iOS 的蓝牙 LE RSSI

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15687332/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 22:55:24  来源:igfitidea点击:

Bluetooth LE RSSI for proximity detection iOS

iphoneiosipadcore-bluetoothbluetooth-lowenergy

提问by Tom Bates

I'll start with the question.

我将从这个问题开始。

Is the BTLE RSSI a good way to indicate two devices proximity to each other or not? does it only work with small devices like fobs etc?

BTLE RSSI 是否是指示两个设备彼此接近的好方法?它只适用于遥控钥匙等小型设备吗?

The Issue:

问题:

I am currently looking at making an app that will use BTLE and allow connections based on proximity. In this regard it is much like the demo app that apple show in the Advanced Core Bluetooth keynote (When two devices are almost touching they then connect).

我目前正在考虑制作一个应用程序,该应用程序将使用 BTLE 并允许基于接近度的连接。在这方面,它很像苹果在 Advanced Core 蓝牙主题演讲中展示的演示应用程序(当两个设备几乎接触时,它们就会连接)。

As I understand it the proximity is determined based on the RSSI value when the central discovers the peripheral. When I try this however with two iPads the signal seems too strong for this it is also too inconsistent to have an accurate stab at the proximity as it doesn't show very much correlation to the devices proximity.

据我了解,当中央发现外围设备时,接近度是根据 RSSI 值确定的。然而,当我用两台 iPad 尝试这个时,信号似乎太强了,它也太不一致而无法准确地刺入接近度,因为它与设备接近度没有太大的相关性。

I have tried the Apple sample code and that is similar in that the devices don't have to be close at all for the information to pass from one to another.

我已经尝试了 Apple 示例代码,它的相似之处在于设备根本不必靠近就可以将信息从一个传递到另一个。

If only there was a way to reduce the signal strength of the peripheral devices advertisement....

如果只有一种方法可以降低外围设备广告的信号强度....

Thanks in advance for any help.

在此先感谢您的帮助。

采纳答案by Dirk-Willem van Gulik

The experience of Matthew Griffin matches mine. However - when we can measure for a fair period of time two things have helped us calibrate this better.

马修·格里芬的经历与我的相符。但是 - 当我们可以测量一段相当长的时间时,有两件事帮助我们更好地校准它。

We did have to wrap a simple (kalman) filter on the antenna orientation and the IMU to get a rough running commentary though - and this is not very CPU or battery light.

我们确实必须在天线方向和 IMU 上包裹一个简单的(卡尔曼)滤波器才能获得粗略的运行评论 - 这不是很 CPU 或电池灯。

  • Using the IMU you get a fair idea of the distance/direction of travel - and if this is over a short period of time - we assume the other 'side' is stationary. This helps a lot to get a value for 'current' orientation and 'callibrate current environment noise.
  • Likewise - do the same for rotations/position changes.
  • 使用 IMU,您可以清楚地了解行进的距离/方向 - 如果这是在很短的时间内 - 我们假设另一“侧”是静止的。这有助于获得“当前”方向和“校准当前环境噪声”的值。
  • 同样 - 对旋转/位置更改执行相同操作。

We've found that in general a re-orientation of the device is a better way to get direction; and that distance is only reliable some up to some 30 to 600 seconds after a 'move' calibration' and only if the device is not too much rotated. And in practice once needs some 4-5 'other' devices; ideally not too mobile, to keep oneself dynamically calibrated.

我们发现,一般来说,重新定向设备是获得方向的更好方法;并且该距离仅在“移动”校准后的大约 30 到 600 秒内是可靠的,并且仅当设备没有旋转太多时。实际上,曾经需要 4-5 个“其他”设备;理想情况下不要太移动,以保持自己动态校准。

However the converse is quite reliable - i.e. we know when not to measure. And the net result is that one can fairly well ascertain things like 'at the keyboard' and 'relocated'/moved away through a specific door/openning or direction. Likewise measuring a field by randomly dancing through the room; changing orientation a lot - does work well once the receiver antenna lobes got somewhat worked out after a stationary period.

然而,反过来是非常可靠的——即我们知道何时不测量。最终的结果是,人们可以很好地确定诸如“在键盘上”和“重新定位”/通过特定门/开口或方向离开之类的事情。同样通过在房间中随机跳舞来测量场;经常改变方向 - 一旦接收器天线波瓣在静止期后得到一定程度的解决,效果就会很好。

回答by Tommy Devoy

You are entirely correct about RSSI jumping wildly and randomly. You should retrieve your RSSI values every two seconds (any faster and you get a bunch of errors). Throw out the RSSI values that are more than a ~-40 decibel spike and use an aggregate of the past values before you declare your approximate range to the user.

你对 RSSI 疯狂和随机跳跃的看法是完全正确的。您应该每两秒检索一次您的 RSSI 值(速度越快,您就会收到一堆错误)。在向用户声明您的大致范围之前,丢弃超过 ~-40 分贝峰值的 RSSI 值并使用过去值的聚合。

As for your following statement, you are in luck.

至于你下面的说法,你很幸运。

If only there was a way to reduce the signal strength of the peripheral devices advertisement....

如果只有一种方法可以降低外围设备广告的信号强度....

The service you are looking for is called the TX Power Service. Implementing this service on your peripheral will allow you to decrease the transmit power of the device. That way you can throttle down the range that the advertisement data is visible from. We unfortunately do not however, have access to this service on an iOS device. But if you are writing your own firmware for a BLE peripheral, this is the service you want.

您正在寻找的服务称为TX Power Service。在您的外围设备上实施此服务将允许您降低设备的传输功率。这样您就可以缩小广告数据可见的范围。遗憾的是,我们无法在 iOS 设备上访问此服务。但是,如果您正在为 BLE 外设编写自己的固件,这就是您想要的服务。

回答by Matthew Griffin

I've spent the last week dealing strictly with RSSI, trying to use Wifi and Bluetooth LE sensors for location triangulation and for distance conversion.

上周我一直在严格处理 RSSI,尝试使用 Wifi 和蓝牙 LE 传感器进行位置三角测量和距离转换。

Unfortunately, what I have found is that RSSI is just too finicky and unreliable to consistently use to determine distance. In theory, the RSSI and distance behave according to the inverse square law (double the distance, and the RSSI will go down a fixed number of decibels), but in practice the RSSI is affected by uncontrollable factors such as weather (dry weather allows RF fields to travel better) and obstacles (any metal objects or humans in the path from one sensor to another will cause attenuation, and any metal objects closely positioned by one of the sensors will cause gain in the signal strength).

不幸的是,我发现 RSSI 过于挑剔且不可靠,无法始终如一地用于确定距离。理论上,RSSI 和距离按照平方反比定律(距离加倍,RSSI 会下降固定的分贝数),但实际上 RSSI 受到天气等不可控因素的影响(干燥天气允许 RF场更好地传播)和障碍物(从一个传感器到另一个传感器的路径中的任何金属物体或人都会导致衰减,并且靠近其中一个传感器的任何金属物体都会导致信号强度增加)。

There are ways to try to compensate for this. This paperis one of the best papers I read on how to get accurate results, but the bottom line is that is an unreliable method unless you just want a general idea of where the device is.

有一些方法可以尝试弥补这一点。这篇论文是我读过的关于如何获得准确结果的最好的论文之一,但最重要的是,这是一种不可靠的方法,除非您只想大致了解设备的位置。

回答by allprog

If I understand well, you are trying to implement similar functionality that to what seen in the WWDC demo and what apps like Bumpimplement. For that RSSI will be adequate. Test for appopriate threshold values (e.g. >-30) and you will be fine.

如果我理解得很好,您正在尝试实现与 WWDC 演示中看到的功能以及Bump 之类的应用程序实现的功能类似的功能。为此,RSSI 就足够了。测试适当的阈值(例如 >-30),你会没事的。