在Arduino和ESP32-s2环境下,测试WiFi Fine Time Measurement (FTM) Round Trip Time (RTT) 的定位和测距

1. 原理

http://people.csail.mit.edu/bkph/ftmrtt_intro

 

优点是AP和phone不需要是同步。

The round trip time measurements are not perfectly accurate, being subject to various types of measurement error, RF interference as well as the positions and motions of objects in the environment. Repeated measurements may improve the quality a bit.

The agreed upon IEEE 802.11mc (a.k.a. IEEE 802.11-2016) WiFi standard provides methods for performing such measurements (with an expected accuracy of perhaps a meter or two). Android Pie (Android 9.0) and later support such IEEE 802.11mc based RTT measurements (API level 28 or later).

2. 环境

2.1硬件:

ESP32-S2-Saola-1

 

测距至少需要2个(一个AP,一个STA)

定位至少需要4个(三个AP,一个STA)

 

 

https://item.taobao.com/item.htm?spm=a1z10.5-c-s.w4002-22443450244.14.17fc27e6u5ebuE&id=612711016956

https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf

https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html

2.2软件:

Arduino

https://www.arduino.cc/en/software

安装espressif库文件

参考

https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html

Currently, the support for new chips (ESP32-S2 and ESP32-C3) is in the development release. Consider installing the development release if you need to test the new supported SoC in beta.

设置第三方开发板的源,

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json

黏贴到:

 

中的

 更新开发板:

 

搜索esp32,选择2.0.0-rc1

 

安装过程比较长,如果超时,重试。

配置硬件

选择ESP32S2 Dev Module

 

通过microUSB连接PC,生成COMX端口

 

找到例程

 

编译下载程序

 

运行监控程序(串口速率115200)

 

3. 测试程序

参考:

C:\Users\XXX\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.0-rc1\libraries\WiFi\examples\FTM\FTM_Initiator\README.md

3.1 信道不匹配问题

首次运行示例代码中会发现信道不匹配

 

3.2 Wi-Fi FTM Initiator(STA) 

 

在C:\Users\XXX\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.0-rc1\libraries\WiFi\src\WiFiGeneric.h中

 channel Primary channel of the FTM Responder 

信道默认为0,FTM_Initiator.ino中使用默认值

3.3 Wi-Fi FTM Responder(AP)

 

https://docs.espressif.com/projects/arduino-esp32/en/latest/api/wifi.html?highlight=ftm#softap

bool softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0, int max_connection = 4, bool ftm_responder = false);

在FTM_Initiator.ino的initiateFTM中设置信道为1

 

3.4 正常运行结果

Responder

 

Initiator

 

3.4 关于CONF_REJECTED

在运行一定事件后会出现:FTM Error: CONF_REJECTED

请问谁有好的解决方案?欢迎留言。谢谢!

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值