在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
請問誰有好的解決方案?歡迎留言。謝謝!
總結
以上是生活随笔為你收集整理的在Arduino和ESP32-s2环境下,测试WiFi Fine Time Measurement (FTM) Round Trip Time (RTT) 的定位和测距的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 客户成功的起源——SaaS(软件即服务)
- 下一篇: 「暑期训练」「基础DP」 Monkey