1、准备工作
1-1、T3000-云腾边缘一体机
商品图片待上传:
商品详情待替换:
1-2、RS232-温湿度传感器及其转接头
设备1:USB转232串口线DB9 :公头螺母款
设备2:DB9黑胶母头+螺杆(HL-MHHJ9F01)
设备3:卡轨温度湿度气压变送器三合一传感器RS232
温湿度气压传感器信息(一般在配套的文档中)
温湿度气压传感器中温度湿度寄存器(保持寄存器)地址:
通信示例(在文末更改Node-Red配置的时候可能会用到):
2、接线说明
注意:232产品接线时,需注意RXD与TXD交叉,并且需要接地。
【+】:电源正,【-】:电源负,A/T:TXD,B/R:RXD。
连接线DB9母头(DB9芯号 信号)
A/T——DB9(2RXD)
B/R——DB9(3TXD)
【-】电源地 ——DB9(5GND)
3、使用官方提供的软件对传感器进行测试
上电、USB插入电脑,找到串口号:
右击“我的电脑”;——》“管理”——》“设备管理器”
打开厂家,所提供的Demo程序
4、RS232设备连接T3000RS485-1接口接线图
5、进入Node-red实例中,进行节点配置
节点接线图
232-请求(Modbus-请求节点)配置:
串口节点配置:
232解析(Modbus-解析节点)配置:
视频演示
此处为语雀视频卡片,点击链接查看:AIoTedge-RS232串口节点+Modbus请求解析.mp4
Node-red完整流程代码
[{"id":"db4fd0aa06ddb90b","type":"modbus_in","z":"3b774d88fe28e4ca","name":"232的解析","outputs":3,"modbusOut":"modbus请求232","func":"3","uid":"1","regAddr":"40001","regNum":"3","nodeID":"1a99419ad6792e16","props":[{"addr":40001,"num":1,"dataType":"u16AB","byteAddr":0},{"addr":40002,"num":1,"dataType":"u16AB","byteAddr":1},{"addr":40003,"num":1,"dataType":"u16AB","byteAddr":2}],"x":550,"y":300,"wires":[["d36d2bb0f3e4ebe6"],["5544270c1e1a5eed"],["b6c2e07373ef4972"]]},{"id":"2ff9d1c0f40ed28a","type":"serial port","z":"3b774d88fe28e4ca","name":"串口232","serial":"dcb6d9cd8e65d669","x":400,"y":300,"wires":[["db4fd0aa06ddb90b"]]},{"id":"1a99419ad6792e16","type":"modbus_out","z":"3b774d88fe28e4ca","name":"232请求","uid":"1","func":"3","regAddr":"40001","regNum":"3","props":[{"addr":40001,"num":1,"dataType":"u16AB","byteAddr":0},{"addr":40002,"num":1,"dataType":"u16AB","byteAddr":1},{"addr":40003,"num":1,"dataType":"u16AB","byteAddr":2}],"x":260,"y":300,"wires":[["2ff9d1c0f40ed28a"]]},{"id":"25f99f2af0c5298f","type":"inject","z":"3b774d88fe28e4ca","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":300,"wires":[["1a99419ad6792e16"]]},{"id":"5544270c1e1a5eed","type":"change","z":"3b774d88fe28e4ca","name":"修改湿度值","rules":[{"t":"set","p":"topic","pt":"msg","to":"shidu","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload/100","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":300,"wires":[["e4745aa7ee2e78ea"]]},{"id":"b6c2e07373ef4972","type":"change","z":"3b774d88fe28e4ca","name":"修改气压值","rules":[{"t":"set","p":"topic","pt":"msg","to":"qiya","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload/10","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":340,"wires":[["e4745aa7ee2e78ea"]]},{"id":"d36d2bb0f3e4ebe6","type":"change","z":"3b774d88fe28e4ca","name":"修改温度值","rules":[{"t":"set","p":"topic","pt":"msg","to":"wendu","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"(payload/100)-42","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":260,"wires":[["e4745aa7ee2e78ea"]]},{"id":"e4745aa7ee2e78ea","type":"join","z":"3b774d88fe28e4ca","name":"合并","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\n","joinerType":"str","useparts":false,"accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":900,"y":300,"wires":[["9108f9a5d82a117c"]]},{"id":"9108f9a5d82a117c","type":"debug","z":"3b774d88fe28e4ca","name":"debug 16","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1040,"y":300,"wires":[]},{"id":"1d0e13c6d6a4c9bc","type":"comment","z":"3b774d88fe28e4ca","name":"双击打开查看RS232设备接入【官方使用文档】","info":"官方使用文档 (ctrl+单击打开连接):nhttps://yunteng.yuque.com/avshoi/aiotedge-v1xdocs/iyq9ttq892puri1f#jnl9lnn","x":240,"y":240,"wires":[]},{"id":"dcb6d9cd8e65d669","type":"serial config","name":"","serialport":"/dev/ttyS6","baudrate":"9600","databits":"8","stopbits":"1","parity":"none","timeout":"50","reqtimeout":"1000"}]