简 介: 利用ESP32 MicroPython 模块中的UART1对于 雷达模块性能进行测试。验证了它的基本通信格式,能够读取对应的数据,它的数据更新速率为每秒钟4个测量数据。

关键词雷达模块ESP32

#mermaid-svg-n6f84cBwx3Vbl6Ph .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .label text{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .node rect,#mermaid-svg-n6f84cBwx3Vbl6Ph .node circle,#mermaid-svg-n6f84cBwx3Vbl6Ph .node ellipse,#mermaid-svg-n6f84cBwx3Vbl6Ph .node polygon,#mermaid-svg-n6f84cBwx3Vbl6Ph .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-n6f84cBwx3Vbl6Ph .node .label{text-align:center;fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .node.clickable{cursor:pointer}#mermaid-svg-n6f84cBwx3Vbl6Ph .arrowheadPath{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-n6f84cBwx3Vbl6Ph .flowchart-link{stroke:#333;fill:none}#mermaid-svg-n6f84cBwx3Vbl6Ph .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-n6f84cBwx3Vbl6Ph .edgeLabel rect{opacity:0.9}#mermaid-svg-n6f84cBwx3Vbl6Ph .edgeLabel span{color:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-n6f84cBwx3Vbl6Ph .cluster text{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-n6f84cBwx3Vbl6Ph .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-n6f84cBwx3Vbl6Ph text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-n6f84cBwx3Vbl6Ph .actor-line{stroke:grey}#mermaid-svg-n6f84cBwx3Vbl6Ph .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .sequenceNumber{fill:#fff}#mermaid-svg-n6f84cBwx3Vbl6Ph #sequencenumber{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph #crosshead path{fill:#333;stroke:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .messageText{fill:#333;stroke:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-n6f84cBwx3Vbl6Ph .labelText,#mermaid-svg-n6f84cBwx3Vbl6Ph .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-n6f84cBwx3Vbl6Ph .loopText,#mermaid-svg-n6f84cBwx3Vbl6Ph .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-n6f84cBwx3Vbl6Ph .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-n6f84cBwx3Vbl6Ph .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-n6f84cBwx3Vbl6Ph .noteText,#mermaid-svg-n6f84cBwx3Vbl6Ph .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-n6f84cBwx3Vbl6Ph .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-n6f84cBwx3Vbl6Ph .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-n6f84cBwx3Vbl6Ph .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-n6f84cBwx3Vbl6Ph .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph .section{stroke:none;opacity:0.2}#mermaid-svg-n6f84cBwx3Vbl6Ph .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-n6f84cBwx3Vbl6Ph .section2{fill:#fff400}#mermaid-svg-n6f84cBwx3Vbl6Ph .section1,#mermaid-svg-n6f84cBwx3Vbl6Ph .section3{fill:#fff;opacity:0.2}#mermaid-svg-n6f84cBwx3Vbl6Ph .sectionTitle0{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .sectionTitle1{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .sectionTitle2{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .sectionTitle3{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-n6f84cBwx3Vbl6Ph .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph .grid path{stroke-width:0}#mermaid-svg-n6f84cBwx3Vbl6Ph .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-n6f84cBwx3Vbl6Ph .task{stroke-width:2}#mermaid-svg-n6f84cBwx3Vbl6Ph .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph .taskText:not([font-size]){font-size:11px}#mermaid-svg-n6f84cBwx3Vbl6Ph .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-n6f84cBwx3Vbl6Ph .task.clickable{cursor:pointer}#mermaid-svg-n6f84cBwx3Vbl6Ph .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-n6f84cBwx3Vbl6Ph .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-n6f84cBwx3Vbl6Ph .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-n6f84cBwx3Vbl6Ph .taskText0,#mermaid-svg-n6f84cBwx3Vbl6Ph .taskText1,#mermaid-svg-n6f84cBwx3Vbl6Ph .taskText2,#mermaid-svg-n6f84cBwx3Vbl6Ph .taskText3{fill:#fff}#mermaid-svg-n6f84cBwx3Vbl6Ph .task0,#mermaid-svg-n6f84cBwx3Vbl6Ph .task1,#mermaid-svg-n6f84cBwx3Vbl6Ph .task2,#mermaid-svg-n6f84cBwx3Vbl6Ph .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-n6f84cBwx3Vbl6Ph .taskTextOutside0,#mermaid-svg-n6f84cBwx3Vbl6Ph .taskTextOutside2{fill:#000}#mermaid-svg-n6f84cBwx3Vbl6Ph .taskTextOutside1,#mermaid-svg-n6f84cBwx3Vbl6Ph .taskTextOutside3{fill:#000}#mermaid-svg-n6f84cBwx3Vbl6Ph .active0,#mermaid-svg-n6f84cBwx3Vbl6Ph .active1,#mermaid-svg-n6f84cBwx3Vbl6Ph .active2,#mermaid-svg-n6f84cBwx3Vbl6Ph .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-n6f84cBwx3Vbl6Ph .activeText0,#mermaid-svg-n6f84cBwx3Vbl6Ph .activeText1,#mermaid-svg-n6f84cBwx3Vbl6Ph .activeText2,#mermaid-svg-n6f84cBwx3Vbl6Ph .activeText3{fill:#000 !important}#mermaid-svg-n6f84cBwx3Vbl6Ph .done0,#mermaid-svg-n6f84cBwx3Vbl6Ph .done1,#mermaid-svg-n6f84cBwx3Vbl6Ph .done2,#mermaid-svg-n6f84cBwx3Vbl6Ph .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-n6f84cBwx3Vbl6Ph .doneText0,#mermaid-svg-n6f84cBwx3Vbl6Ph .doneText1,#mermaid-svg-n6f84cBwx3Vbl6Ph .doneText2,#mermaid-svg-n6f84cBwx3Vbl6Ph .doneText3{fill:#000 !important}#mermaid-svg-n6f84cBwx3Vbl6Ph .crit0,#mermaid-svg-n6f84cBwx3Vbl6Ph .crit1,#mermaid-svg-n6f84cBwx3Vbl6Ph .crit2,#mermaid-svg-n6f84cBwx3Vbl6Ph .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-n6f84cBwx3Vbl6Ph .activeCrit0,#mermaid-svg-n6f84cBwx3Vbl6Ph .activeCrit1,#mermaid-svg-n6f84cBwx3Vbl6Ph .activeCrit2,#mermaid-svg-n6f84cBwx3Vbl6Ph .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-n6f84cBwx3Vbl6Ph .doneCrit0,#mermaid-svg-n6f84cBwx3Vbl6Ph .doneCrit1,#mermaid-svg-n6f84cBwx3Vbl6Ph .doneCrit2,#mermaid-svg-n6f84cBwx3Vbl6Ph .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-n6f84cBwx3Vbl6Ph .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-n6f84cBwx3Vbl6Ph .milestoneText{font-style:italic}#mermaid-svg-n6f84cBwx3Vbl6Ph .doneCritText0,#mermaid-svg-n6f84cBwx3Vbl6Ph .doneCritText1,#mermaid-svg-n6f84cBwx3Vbl6Ph .doneCritText2,#mermaid-svg-n6f84cBwx3Vbl6Ph .doneCritText3{fill:#000 !important}#mermaid-svg-n6f84cBwx3Vbl6Ph .activeCritText0,#mermaid-svg-n6f84cBwx3Vbl6Ph .activeCritText1,#mermaid-svg-n6f84cBwx3Vbl6Ph .activeCritText2,#mermaid-svg-n6f84cBwx3Vbl6Ph .activeCritText3{fill:#000 !important}#mermaid-svg-n6f84cBwx3Vbl6Ph .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-n6f84cBwx3Vbl6Ph g.classGroup text .title{font-weight:bolder}#mermaid-svg-n6f84cBwx3Vbl6Ph g.clickable{cursor:pointer}#mermaid-svg-n6f84cBwx3Vbl6Ph g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-n6f84cBwx3Vbl6Ph g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-n6f84cBwx3Vbl6Ph .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-n6f84cBwx3Vbl6Ph .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-n6f84cBwx3Vbl6Ph .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-n6f84cBwx3Vbl6Ph .dashed-line{stroke-dasharray:3}#mermaid-svg-n6f84cBwx3Vbl6Ph #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-n6f84cBwx3Vbl6Ph #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-n6f84cBwx3Vbl6Ph #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-n6f84cBwx3Vbl6Ph #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-n6f84cBwx3Vbl6Ph #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-n6f84cBwx3Vbl6Ph #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-n6f84cBwx3Vbl6Ph #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-n6f84cBwx3Vbl6Ph #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-n6f84cBwx3Vbl6Ph .commit-id,#mermaid-svg-n6f84cBwx3Vbl6Ph .commit-msg,#mermaid-svg-n6f84cBwx3Vbl6Ph .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-n6f84cBwx3Vbl6Ph g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-n6f84cBwx3Vbl6Ph g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-n6f84cBwx3Vbl6Ph g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-n6f84cBwx3Vbl6Ph .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-n6f84cBwx3Vbl6Ph .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-n6f84cBwx3Vbl6Ph .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-n6f84cBwx3Vbl6Ph .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-n6f84cBwx3Vbl6Ph .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-n6f84cBwx3Vbl6Ph .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-n6f84cBwx3Vbl6Ph .edgeLabel text{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-n6f84cBwx3Vbl6Ph .node circle.state-start{fill:black;stroke:black}#mermaid-svg-n6f84cBwx3Vbl6Ph .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-n6f84cBwx3Vbl6Ph #statediagram-barbEnd{fill:#9370db}#mermaid-svg-n6f84cBwx3Vbl6Ph .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-n6f84cBwx3Vbl6Ph .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-n6f84cBwx3Vbl6Ph .statediagram-state .divider{stroke:#9370db}#mermaid-svg-n6f84cBwx3Vbl6Ph .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-n6f84cBwx3Vbl6Ph .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-n6f84cBwx3Vbl6Ph .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-n6f84cBwx3Vbl6Ph .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-n6f84cBwx3Vbl6Ph .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-n6f84cBwx3Vbl6Ph .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-n6f84cBwx3Vbl6Ph .note-edge{stroke-dasharray:5}#mermaid-svg-n6f84cBwx3Vbl6Ph .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-n6f84cBwx3Vbl6Ph .error-icon{fill:#522}#mermaid-svg-n6f84cBwx3Vbl6Ph .error-text{fill:#522;stroke:#522}#mermaid-svg-n6f84cBwx3Vbl6Ph .edge-thickness-normal{stroke-width:2px}#mermaid-svg-n6f84cBwx3Vbl6Ph .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-n6f84cBwx3Vbl6Ph .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-n6f84cBwx3Vbl6Ph .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-n6f84cBwx3Vbl6Ph .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-n6f84cBwx3Vbl6Ph .marker{fill:#333}#mermaid-svg-n6f84cBwx3Vbl6Ph .marker.cross{stroke:#333}:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}#mermaid-svg-n6f84cBwx3Vbl6Ph {color: rgba(0, 0, 0, 0.75);font: ;}

微波雷达
目 录
Contents
1.1 接口定义.....................................
1.2 测试电路板.................................
1.3 连接ESP32与XW-HLR26-24G
1.4 通信测试.....................................
更多测试
2.1 测试手臂前后移动
测试总结

§01 微波雷达


  对于 XW-HLR26-24G毫米波测距测速雷达传感器模块移动侦测传感器可调距离TTL输出 中的微波雷达进行功能测试。

1.1 接口定义

  SW-HLR26的接口如下图所示。这是对应的2mm间距的PIN4接口。

▲ 图1.1 XW-HLR26-24G微波雷达模块

1.2 测试电路板

  利用 ESP32-S模块转接板设计与实现 中的ESP32UARTUART1XW-HLR26-24G进行测试。

▲ 图1.2.1 ESP32-S 转接板的接口定义

1.2.1 ESP32串口测试

from machine                import UART,Pin
import utimeled  = Pin(5, Pin.OUT)
uart = UART(1, 115200)while True:led.on()utime.sleep_ms(100)led.off()utime.sleep_ms(100)uart.write(b'\x55')

  下面是测TXD1输出信号。验证了:

  • 这个管脚是ESP32TXD1 输出信号;
  • 初始化的115200的波特率是正确的的;

▲ 图1.2.2 ESP32 TXD1管脚信号

1.3 连接ESP32与XW-HLR26-24G

1.3.1 信号连接

  将XW-HLR26ESP32连接。由于ESP32工作电压为3.3V。所以需要另外增加+5V的工作电源。

▲ 图1.3.1 测试XW-HLR26模块的ESP32测试电路板

  XW-HLR26 的串口具有 3.3V/5V兼容的信号。

▲ 图1.3.2 XWS-HLR26 接口定义

1.3.2 初步测试

  该模块施加+5V工作电源。模块工作流大约:84mA

(1)模块上电信息

  根据XW-HLR26的使用手册可以知道模块上电后主动上报模块的版本号。使用示波器检测模块的TX管脚,在上电后并没有看到任何发送的数据信号。同样在RX管教也没有发送数据信号信息。

(2)读数信息

uart.write(b'\x55\x5a\x02\xD3\x84')
utime.sleep_ms(50)readb = uart.read(uart.any())
print(readb)
Test XW-HLR26.
5
b'U\xa5\n\xd3\xff\xff\x00\x00\x00\x00\x00\x00\xd5'

1.4 通信测试

1.4.1 读取测试信息

def readXW():uart.write(b'\x55\x5a\x02\xD3\x84')utime.sleep_ms(10)readb = uart.read(uart.any())distance = 0speed = 0gesture = 0intensity = 0if readb[0:3] != b'\x55\xa5\n':return distance,speed,gesture,intensityprint(readb)distance = int.from_bytes(readb[4:6], 0)speed = int.from_bytes(readb[6:8], 0)intensity = int.from_bytes(readb[8:10], 0)gesture = readb[10]return distance,speed,intensity,gestured,s,i,g = readXW()
print(d,s,i,g)

1.4.2 测量范围

(1)查询雷达测量范围

def readRange():uart.write(b'\x55\x5a\x02\xD5\x86')utime.sleep_ms(10)readb = uart.read(uart.any())print(readb)readRange()
b'U\xa5\x0c\xd5\x00\x01\x00\xc8\x00\xb4\x00d\x00\xa0\\'
  • 注意: 在上面的返回中,数据为12个,但在使用说明中,返回的数据应该是6个。

§02 更多测试


2.1 测试手臂前后移动

2.1.1 测量代码

from machine                import UART,Pin
import utimeled  = Pin(5, Pin.OUT)
uart = UART(1, 115200)def readXW():uart.write(b'\x55\x5a\x02\xD3\x84')utime.sleep_ms(10)readb = uart.read(uart.any())distance = 0speed = 0gesture = 0intensity = 0if readb[0:3] != b'\x55\xa5\n':return distance,speed,gesture,intensitydistance = int.from_bytes(readb[4:6], 0)speed = int.from_bytes(readb[6:8], 0)intensity = int.from_bytes(readb[8:10], 0)gesture = readb[10]return distance,speed,intensity,gesturedef readRange():readb = uart.read(uart.any())uart.write(b'\x55\x5a\x02\xD5\x86')utime.sleep_ms(2)readb = uart.read(uart.any())def setMaxRange():uart.write(b'\x55\x5a\x04\xD6\x01\x00\x8a')utime.sleep_ms(10)readb = uart.read(uart.any())NUMBER = 256
dist = [0]*NUMBERfor ii in range(NUMBER):d,s,i,g=readXW()dist[ii] = dprint(dist)while True:led.on()utime.sleep_ms(500)led.off()utime.sleep_ms(500)

2.1.2 测量结果

from headm import *
from tsmodule.tsstm32       import *stm32cmd('COPY')
time.sleep(.1)
strall = [s for s in clipboard.paste().split('\r\n') if len(s) > 0]
strnum = array([int(s) for s in strall[-1].replace('[','').replace(']','').split(',')])
strnum[where(strnum == 65535)] = 100printf(strnum)plt.plot(strnum)
plt.xlabel("n")
plt.ylabel("Distance")
plt.grid(True)
plt.tight_layout()
plt.show()

▲ 图2.1.1 测量结果

  从测量结果来看,可以看到XW-HLR26反馈测量值的更新具有一定的周期。在连续读取数值的时候,大约2个数据之后才有更新。这对应的大约022秒。

▲ 图2.1.2 另外一次测量结果

  测量 512个数据,消耗 5.515秒,对应每个数据大约时间10.77ms。对应22数据,大约消耗:237ms。由此可以估计出雷达模块大约每秒钟更新 4个数据。

※ 测试总结 ※


  利用ESP32 MicroPython 模块中的UART1对于 雷达模块性能进行测试。验证了它的基本通信格式,能够读取对应的数据,它的数据更新速率为每秒钟4个测量数据。


■ 相关文献链接:

  • XW-HLR26-24G毫米波测距测速雷达传感器模块移动侦测传感器可调距离TTL输出
  • ESP32-S模块转接板设计与实现

● 相关图表链接:

  • 图1.1 XW-HLR26-24G微波雷达模块
  • 图1.2.1 ESP32-S 转接板的接口定义
  • 图1.2.2 ESP32 TXD1管脚信号
  • 图1.3.1 测试XW-HLR26模块的ESP32测试电路板
  • 图1.3.2 XWS-HLR26 接口定义
  • 图2.1.1 测量结果
  • 图2.1.2 另外一次测量结果
from machine                import UART,Pin
import utimeled  = Pin(5, Pin.OUT)
uart = UART(1, 115200)def readXW():uart.write(b'\x55\x5a\x02\xD3\x84')utime.sleep_ms(10)readb = uart.read(uart.any())distance = 0speed = 0gesture = 0intensity = 0if readb[0:3] != b'\x55\xa5\n':return distance,speed,gesture,intensitydistance = int.from_bytes(readb[4:6], 0)speed = int.from_bytes(readb[6:8], 0)intensity = int.from_bytes(readb[8:10], 0)gesture = readb[10]return distance,speed,intensity,gesturedef readRange():readb = uart.read(uart.any())uart.write(b'\x55\x5a\x02\xD5\x86')utime.sleep_ms(2)readb = uart.read(uart.any())def setMaxRange():uart.write(b'\x55\x5a\x04\xD6\x01\x00\x8a')utime.sleep_ms(10)readb = uart.read(uart.any())NUMBER = 512
dist = [0]*NUMBERstarttime = utime.ticks_ms()
for ii in range(NUMBER):for j in range(100):d,s,i,g=readXW()if d != 65535: breakdist[ii] = dprint(utime.ticks_ms() - starttime)print(dist)while True:led.on()utime.sleep_ms(500)led.off()utime.sleep_ms(500)

测量 XW-HLR26-24G 微波雷达模块的性能测试相关推荐

  1. RCWL-0516微波雷达模块检测人体移动(发光二极管)

    首先,介绍一下RCWL-0516的主要引脚: 其次是RCWL-0516与UNO和LED灯的连接示意图及实际连接图: VIN-5V OUT-D2 GND-GND D3.电阻.二极管串联 当微波雷达模块检 ...

  2. FMK24微波雷达测距模块的使用

    应客户要求,使用一款名为FMK24的微波雷达模块测量距离并解算速度,之前小打小闹从未用过这么高大上的距离传感器,某宝上一查居然300多块大洋,略略肉疼,决心好好搞一下子. 附上官方给出的模块说明书 链 ...

  3. 微波雷达生命体征检测,人体呼吸心跳感应雷达模块,雷达传感器技术应用

    生命体征参数是人体健康与否的重要表征,实时地检测生命体征信号有着很大的研究价值.现在市场中的生命体征检测装置不仅在价格.体积上难以满足普通用户的要求,装置本身还受制于线缆连接,且传统的常规检测方法大多 ...

  4. 5.8GHz雷达感应模块应用,智能家居照明技术,微波雷达传感器

    5.8GHz的雷达感应模块有何妙用呢? 非5.8GHz的雷达感应模块,在一些家居环境使用感应信号频率难控制,用于智能家居方面的效果会有局限性.5.8GHz的雷达感应模块感应信号频率精准,稳定,感应灵敏 ...

  5. 智能家居领域技术应用,微波雷达人体感应模块,雷达传感器方案

    雷达感知是一种无线感知技术,通过分析接收到的目标回波特性,提取并发现目标的位置.形状.运动特性和运动轨迹,作用类似于人类的眼睛和耳朵. 与其它传感器相比,雷达模块感应具有许多独特的优势.例如,与视觉传 ...

  6. 微波雷达技术发展应用,存在感应雷达模块,物联网雷达传感器技术

    想必大家都知道传感器有着微型化.数字化.智能化.多功能化.系统化.网络化的特点,而且它还是实现自动检测和自动控制的重要手段.微波传感器的存在和发展,让物体有了感应性能,让物体变得活起来了. FR58L ...

  7. 智能坐便器雷达感应技术,微波雷达感应模组应用,雷达传感器方案

    近距离移动物体检测是基于无线监测技术开发的.超声波.激光和雷达是常用的无线测量方法.近年来,由于调频连续波雷达的研究和技术发展,具有体积小.发射功率小.测量精度高等优点. 调频连续波雷达主要通过数字信 ...

  8. 5.8G存在感应雷达模块,雷达智能感应灯应用,多普勒雷达技术发展

    微波雷达感应也叫雷达感应,是运用多普勒效应,在人和物运动前后的波长和频率发生改变,通过感应检测这种变化来达到控制的功能,从而实现自动开和关的功能. 雷达感应模块是一款自动感应控制产品,灵敏度高,感应距 ...

  9. 基于微波雷达传感器的智能安全车门锁,微波雷达感应模组技术

    基于微波雷达传感器的智能安全车门锁,为了解决由于人们的粗心而不正当的使用车门所造成的事故问题,通过微波雷达感应模组对周围物体进行感应检测. 在危险发生前做出判断,通过蜂鸣器的鸣叫声对车内人员进行提醒和 ...

最新文章

  1. linux默认文件大小,Linux 改变文件大小的方法
  2. Hadoop自学笔记(七)Hadoop环境配置和优化
  3. 软件工程与项目管理的关系_软件工程:软件工程概述13个问题解答?
  4. 如何理解Minor/Major/Full GC
  5. C# 向Com口发送数据
  6. java 命名参数动态替换_使用Kettle的命名参数动态执行作业
  7. 【挖坑系列】关于浏览器の缓存机制
  8. 软件构造 git 图形界面看Object Graph
  9. Fluent 安装过程
  10. 360图片搜索操作使用说明
  11. 如何进行ERP、CRM实施时的流程梳理?
  12. linux 发送at指令,AT指令发送短信流程
  13. ERROR: Cannot uninstall ‘PyYAML’. It is a distutils installed project and thus we cannot accurately
  14. 定时任务调度框架Quartz
  15. android设置自动亮度,Android亮度调节的几种实现方法
  16. Three.js样条曲线、贝赛尔曲线
  17. 127_不同国家的手机号,除去国家代码后,有可能相同吗?
  18. 月薪2w运营人必备的120款运营神器
  19. 链接无线路由器后局域网无法连接服务器,局域网部分电脑连接路由器(交换机)后无法上网该怎么解决?...
  20. 西门子1200 PLC CRC效验程序功能块

热门文章

  1. Vue 子父组件通信小问题
  2. Service 之间如何通信?- 每天5分钟玩转 Docker 容器技术(101)
  3. ASP.NET弹出模态对话框
  4. linux命令学习——file
  5. SharePoint 2007 SDK 有了1.1版本
  6. 35岁的程序员是“都挺好”还是“都挺惨”?\n
  7. 有趣而又被忽略的Unity技巧
  8. IIS的应用程序池优化方法
  9. codeforces Gargari and Permutations(DAG+BFS)
  10. B2c商城图片尺寸设定研究 尺寸应该多大合适