简体   繁体   English

查找两个蓝牙设备之间的方向(本地化)

[英]Finding the direction between two bluetooth devices (localization)

I have an app that scans for a specific UUID that another phone is broadcasting and measures the signal strength between them and tells you whether you're getting closer or further away from them. 我有一个应用程序可以扫描另一个电话正在广播的特定UUID,并测量它们之间的信号强度,并告诉您您是离它们越来越近还是更远。 I want to add an arrow for direction. 我想添加一个方向箭头。 I know you can use triangulation if you have 3 points but I want to get something somewhat accurate with 2 points. 我知道如果您有3分,就可以使用三角剖分,但是我想得到2分有点准确。

Any algorithm or suggestion that would help? 有什么算法或建议会有所帮助吗?

My current idea (since for this app's use case one node will be relatively still) is to have some algorithm learning as you walk. 我当前的想法(因为对于该应用程序的用例,一个节点将相对静止)是在您行走时进行一些算法学习。 Like if you get further away the arrow knows to disregard this direction and keep refining itself as you walk different directions. 就像您走得更远一样,箭头知道您会忽略该方向,并且在您沿着不同的方向行走时会不断完善自己。

I found a bunch of research papers on the topic but I'm not an electrical engineer so it's easy to get lost. 我找到了很多与此主题相关的研究论文,但我不是电气工程师,因此很容易迷路。 Also I read this post and understand the many pitfalls How to measure distance between two iphone devices using bluetooth? 我也阅读了这篇文章,并了解了许多陷阱如何使用蓝牙测量两个iPhone设备之间的距离?

Thanks! 谢谢!

Such a solution is extremely convoluted. 这样的解决方案非常复杂。

Getting the direction of the signal requires far more data than normal app usage can provide. 获取信号的方向所需的数据远远超过正常应用程序所能提供的数据。 The user would have to slowly rotate the phone while taking many samples of all directions. 用户必须在采集所有方向的许多样本的同时缓慢旋转手机。

Getting the relative distance, as you said like "getting closer" or "going farther away" is kinda possible within a 12 meter range using the formula posted below. 您可以使用以下公式在12米范围内获得相对距离,如您所说的“靠近”或“走得更远”。 Above 12 meters it gets very buggy. 超过12米时,越野车非常容易。 But it's quite complex and requires you to use a moving average solution with a length that you consider adequate. 但这很复杂,需要您使用长度合适的移动平均解。

You can calculate the relation between RSSI and distance using the following formula: 您可以使用以下公式计算RSSI与距离之间的关系:

RSSI = -(10*n*log10(d) + A)

In this case, n = path loss exponent, since you don't want an exact distance, just a way to check if it's closer or further, you can use 2 as a value, I found this the most realistic one in most cases. 在这种情况下,n =路径损耗指数,因为您不希望确切的距离,而只是一种检查距离是否更近的方法,因此可以使用2作为值,我发现这在大多数情况下是最现实的一个。 A = the measured RSSI value at 1 meter distance, you need to measure this in advance to do your calculations, but since this varies a lot, just use a value like -60dB. A =在1米距离处测得的RSSI值,您需要事先对其进行测量以进行计算,但是由于变化很大,因此请使用-60dB之类的值。 Also this one is about average in most situations. 而且,在大多数情况下,这大约是平均水平。

So getting a crudely guessed distance in meters can be achieved by the formula: 因此,可以通过以下公式获得以米为单位的粗略猜测的距离:

distance = 10 ^ ((-RSSI - 60) / (10 * 2));

This isn't very exact but will be sufficient to tell you if it is closer/farther within a limited range. 这不是很精确,但是足以告诉您它是否在有限范围内更近/更远。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM