计算2部Android手机之间BLE消息的传播时间 [英] Calculate time of flight of BLE message between 2 Android phones

查看:113
本文介绍了计算2部Android手机之间BLE消息的传播时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于SO来说可能是通用的,在需要时可以随时转移到任何其他SO克隆中.

Maybe to general for SO, feel free to move to any other SO clone when needed.

我想根据通过Bluetooth Low Energy发送的消息来回传输所花费的时间来计算2台android智能手机之间的距离.

I would like calculate the distance between 2 android smartphones based on how long it takes for a message send over Bluetooth Low Energy to travel back and forth.

赞:

  1. 设备A通过BLE连接到设备B.
  2. 设备A发送消息
  3. 设备A存储当前的纳秒(T0)
  4. 设备B通过蓝牙无线电(BT0)接收消息
  5. 设备B的处理消息
  6. 设备B引发收到消息"事件(BT1)
  7. 设备B存储当前的纳秒数
  8. 设备B将值BT1-BTO的确认消息发送回A
  9. 设备A在蓝牙无线电(AT0)上接收消息
  10. 设备过程消息
  11. 设备A引发收到消息"事件(AT1)
  12. 设备A存储当前的纳秒(T1)
  1. Device A connects over BLE to device B.
  2. Device A sends message
  3. Device A stores current nanoseconds (T0)
  4. Device B receives message on bluetooth radio (BT0)
  5. Device B process message
  6. Device B raises "message received" event (BT1)
  7. Device B stores current nanoseconds
  8. Device B send acknowledge message back to A with value BT1 - BTO
  9. Device A receives message on bluetooth radio (AT0)
  10. Device A process message
  11. Device A raises "message received" event (AT1)
  12. Device A stores current nanoseconds (T1)

总旅行时间=行驶距离= T1-T0-(BT1-BT0)-(AT1-AT0)

Total travel time = distance covered = T1 - T0 - (BT1 - BT0) - (AT1 - AT0)

是否可以在Android上计算(BT1-BT0)和(AT1-AT0)?

Is it all possible to calculate (BT1 - BT0) and (AT1 - AT0) on Android?

谢谢

推荐答案

否.时钟误差允许高达50 ppm.另外,允许在4微秒的窗口内发送数据包.这些原因足以说明您的建议不起作用.

No. The clock inaccuracy is allowed to be as much as 50 ppm. Also, packets are allowed to be sent within a 4 microseconds window. These reasons are enough to say your proposal doesn't work.

一个更大的原因是消息必须由非实时操作系统(Android)中的Bluetooth堆栈处理,并且还必须通过UART传输到电话中的Bluetooth控制器,然后安排在以下时间发送消息下一个连接事件.

A bigger reason is that the messages have to be processed by a Bluetooth stack in a non-realtime OS (Android) and must also be transferred over UART to the Bluetooth controller in the phone, which then schedules to transmit the message at the next connection event.

如果您可以为通用微控制器无线电编程固件,并以16 MHz时钟的精度对无线电计时,那么您也许可以获得足够好的结果以测量更长的范围.随着BT5中引入BLE远程,现在控制器在计算接收器窗口时必须考虑距离(在BT 4中为+ -2微秒).

If you could program the firmware for a general microcontroller radio and time the radio with the accuracy of a 16 MHz clock, then you might be able to get some good enough results to measure longer ranges. With the introduction of BLE Long Range in BT5, the controller now have to take the distance into account when calculating the receiver window (which was +-2 microseconds in BT 4).

这篇关于计算2部Android手机之间BLE消息的传播时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆