【安信可UWB室内定位模组NodeMCU-BU01】02.AT指令测距
<div class='showpostmsg'><p>1、<span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">NodeMCU-BU01</font><font face="宋体">开发板跳帽设置</font></span></span></span></span></p><p><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">NodeMCU-BU01</font><font face="宋体">开发板板载了一颗</font><font face="Calibri">STM32 MCU</font><font face="宋体">作为主控制芯片,集成了</font><font face="Calibri">AT</font><font face="宋体">调试指令功能,方便在线实时调试;在收到开发板时,</font><font face="Calibri">BOOT</font><font face="宋体">跳帽是没有连接的,对照手册如下表所示,将</font><font face="Calibri">BT0</font><font face="宋体">和</font><font face="Calibri">BT1</font><font face="宋体">连接到</font><font face="Calibri">GND</font><font face="宋体">后,</font><font face="Calibri">STM32</font><font face="宋体">可正常从内部</font><font face="Calibri">FLASH</font><font face="宋体">启动运行:</font></span></span></span></span></p>
<p></p>
<p> </p>
<p>2、<span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">NodeMCU-BU01</font><font face="宋体">开发板上电</font></span></span></span></span></p>
<p><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">使用</font><font face="Calibri">Micro USB</font><font face="宋体">线连接开发板与电脑,打开电脑的设备管理器,并没有检测到新设备的插入;感情这个板载的</font><font face="Calibri">Micro USB</font><font face="宋体">接口只是用作供电使用的哈;看原理图是连接到</font><font face="Calibri">STM32</font><font face="宋体">的</font><font face="Calibri">USB</font><font face="宋体">接口引脚上的,程序功能并没有实现虚拟串口的功能,所以想用</font><font face="Calibri">AT</font><font face="宋体">指令进行调试,还得再加一个</font><font face="Calibri">USB</font><font face="宋体">转</font><font face="Calibri">TTL</font><font face="宋体">调试工具了。</font></span></span></span></span></p>
<p></p>
<p> </p>
<p><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">3、硬件连接</font></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">使用安信可的</font><font face="Calibri">USB</font><font face="宋体">转</font><font face="Calibri">TTL</font><font face="宋体">调试工具,将</font><font face="Calibri">RX\TX\GND</font><font face="宋体">分别与</font><font face="Calibri">NodeMCU-BU01</font><font face="宋体">开发板上的</font><font face="Calibri">U1TX\U1RX\GND</font><font face="宋体">进行连接,如下图所示;同时打开电脑端串口调试助手软件,将串口通讯参数配置为</font><font face="Calibri">115200/N/8/1</font><font face="宋体">,打开串口后按下</font><font face="Calibri">NodeMCU-BU01</font><font face="宋体">开发板上的</font><font face="Calibri">RESET</font><font face="宋体">按键,这时可以在串口调试助手软件上看到启动打印信息,此时硬件连接就完成了。</font></span></span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">4、</font><font face="Calibri">AT</font><font face="宋体">指令说明</font></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">支持的</font><font face="Calibri">AT</font><font face="宋体">指令功能表如下图所示</font><font face="Calibri">:</font></span></span></span></span></span></p>
<table class="MsoTableGrid" style="border-collapse:collapse; border:none; text-align:justify; font-family:"Times New Roman"; font-size:13px">
<tbody>
<tr>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:1px solid black; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">AT</font></span></span></span></span></span></p>
</td>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:1px solid black; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">测试指令</font></span></span></span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">AT+switchdis</font></span></span></span></span></span></p>
</td>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">设置是否开启测距</font></span></span></span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">AT+interval</font></span></span></span></span></span></p>
</td>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">设置测距间隔</font></span></span></span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">AT+version</font></span></span></span></span></span></p>
</td>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">查询版本</font></span></span></span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">AT+RST</font></span></span></span></span></span></p>
</td>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">复位</font></span></span></span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">AT+tem_hum</font></span></span></span></span></span></p>
</td>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">获取温湿度</font></span></span></span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">AT+xyz</font></span></span></span></span></span></p>
</td>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">获取三轴加速度</font></span></span></span></span></span></p>
</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">AT+anchor_tag</font></span></span></span></span></span></p>
</td>
<td style="border-bottom:1px solid black; width:284px; padding:0px 7px 0px 7px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top">
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">设置设备模式</font></span></span></span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">在发送</font><font face="Calibri">AT</font><font face="宋体">指令时,需要注意指令的大小写;具体的配置、参数设定可以参考《</font><font face="Calibri">UWB</font><font face="宋体">系列模组</font><font face="Calibri">AT</font><font face="宋体">指令集 </font><font face="Calibri">V1.0</font><font face="宋体">》。如下图是测试指令、获取温湿度、获取三轴加速度的</font><font face="Calibri">AT</font><font face="宋体">指令演示:</font></span></span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify">5、<span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">AT</font><font face="宋体">指令测距</font></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">实现</font><font face="Calibri">UWB</font><font face="宋体">测距时,最少需要</font><font face="Calibri">2</font><font face="宋体">块</font><font face="Calibri">NodeMCU-BU01</font><font face="宋体">开发板,一块开发板工作在</font><font face="Calibri">Anchor</font><font face="宋体">模式,另一块开发板工作在</font><font face="Calibri">Tag</font><font face="宋体">模式;刚拿到的</font><font face="Calibri">NodeMCU-BU01</font><font face="宋体">开发板默认工作在</font><font face="Calibri">Anchor</font><font face="宋体">模式,我们实现测距功能需要进行如下</font><font face="Calibri">AT</font><font face="宋体">指令配置步骤:设置设备模式、设置测距间隔、设置开启测距;在配置完成后,即可以通过串口调试助手软件看到测距的结果,如下图所示:</font></span></span></span></span></p>
<p style="text-align:justify"></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify">6、<span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">续</font></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="Calibri">AT+interval是设置</font><font face="宋体">测距间隔时间,最小值为5,值越小测距间隔时间越短;在测距的过程当中,所测到的结果为逐渐趋于精确的结果,所以在测距过程中不断的有移动的话,所测量的结果则会存在不精确的情况,对静态测量状态下则相对准确;</font></span></span></span></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri"><span style="font-size:10.5000pt"><span style="font-family:宋体"><font face="宋体">如果在产品上直接使用</font><font face="Calibri">NodeMCU-BU01</font><font face="宋体">开发板,当然可以直接使用</font><font face="Calibri">STM32</font><font face="宋体">带有</font><font face="Calibri">AT</font><font face="宋体">指令配置进行测距,通过解析</font><font face="Calibri">AT</font><font face="宋体">指令反馈的数据得到测距的结果,但</font><font face="Calibri">NodeMCU-BU01</font><font face="宋体">开发板显然成本相比于</font><font face="Calibri">BU01</font><font face="宋体">模组会贵不少,占用空间也很大,在实际项目中还是尽量使用</font><font face="Calibri">BU01</font><font face="宋体">结合产品选择的控制器的实现方式,不管从成本还是从结构都是最优的选择。</font></span></span></span></span></p>
<p style="text-align:justify"> </p>
</div><script> var loginstr = '<div class="locked">查看本帖全部内容,请<a href="javascript:;" style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
if(parseInt(discuz_uid)==0){
(function($){
var postHeight = getTextHeight(400);
$(".showpostmsg").html($(".showpostmsg").html());
$(".showpostmsg").after(loginstr);
$(".showpostmsg").css({height:postHeight,overflow:"hidden"});
})(jQuery);
} </script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script> <p>AT+interval测距间隔可以理解为测距频率吗?间隔越短应该越耗电吧?</p>
wangerxian 发表于 2022-2-8 09:12
AT+interval测距间隔可以理解为测距频率吗?间隔越短应该越耗电吧?
<p>是的</p>
页:
[1]