T3000-串口RS485拓展IO接入_物联网平台_边缘计算网关

1.准备工作

1-1、T3000-云腾边缘一体机

商品图片待上传:

商品详情待替换:

1-2、ET1010

ET1010信息(一般在配套的文档中)

ET1010寄存器(触电DI、线圈DO)地址:

PS-1:十六进制的地址码转化为十进制需要进行转化后+1,如DO1的=十六进制地址码0000H转化为十进制后需要加1,等于0001表示其十进制寄存器地址码。

PS-2:ET1010设备出厂默认设备地址码为0

1-3、ET1010连接T3000一体机RS485-2串口接线图

2、进入Node-red实例进行编程

节点接线图

演示视频

此处为语雀视频卡片,点击链接查看:AIoTedge-串口节点+Modbus请求解析(读写多个线圈).mp4

node-red完整流程代码

[{"id":"98dd60edc854956a","type":"serial port","z":"65e54bc73a653e5d","name":"","serial":"04ca5f965fd5cccd","x":710,"y":380,"wires":[["e81e9c570e740f46","837f7928f52bb4e2"]]},{"id":"470a38080bcd1167","type":"modbus_out","z":"65e54bc73a653e5d","name":"读取DO1~DO4开关状态(读线圈)","uid":"0","func":"1","regAddr":"10001","regNum":"4","props":[{"addr":10001,"num":1,"dataType":"bit","byteAddr":0},{"addr":10002,"num":1,"dataType":"bit","byteAddr":1},{"addr":10003,"num":1,"dataType":"bit","byteAddr":2},{"addr":10004,"num":1,"dataType":"bit","byteAddr":3}],"x":400,"y":440,"wires":[["98dd60edc854956a","d51be66a79d7d3ef"]]},{"id":"b84a5851c920586a","type":"inject","z":"65e54bc73a653e5d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":440,"wires":[["470a38080bcd1167"]]},{"id":"e81e9c570e740f46","type":"modbus_in","z":"65e54bc73a653e5d","name":"解析DO1~DO4开关状态","outputs":4,"modbusOut":"读取DO1~DO4开关状态(读线圈)","func":"1","uid":"0","regAddr":"10001","regNum":"4","nodeID":"470a38080bcd1167","props":[{"addr":10001,"num":1,"dataType":"bit","byteAddr":0},{"addr":10002,"num":1,"dataType":"bit","byteAddr":1},{"addr":10003,"num":1,"dataType":"bit","byteAddr":2},{"addr":10004,"num":1,"dataType":"bit","byteAddr":3}],"x":970,"y":380,"wires":[["3e9a38d3aea7d4ba"],["203b9de05e2cf429"],["e92839a53e984a81"],["b3e37f645cab7674"]]},{"id":"187e2b7105cfc97f","type":"modbus_out","z":"65e54bc73a653e5d","name":"控制DO1开关(写单个线圈)","uid":"0","func":"5","regAddr":"00004","regNum":"1","props":[{"addr":10001,"num":1,"dataType":"u16AB","byteAddr":9997}],"x":420,"y":380,"wires":[["98dd60edc854956a","e32235e78f1bf732"]]},{"id":"413d6a229d24354c","type":"inject","z":"65e54bc73a653e5d","name":"打开","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":150,"y":360,"wires":[["187e2b7105cfc97f"]]},{"id":"3a5bfa9e2a8f95f5","type":"inject","z":"65e54bc73a653e5d","name":"关闭","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":400,"wires":[["187e2b7105cfc97f"]]},{"id":"e32235e78f1bf732","type":"debug","z":"65e54bc73a653e5d","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":380,"y":340,"wires":[]},{"id":"3e9a38d3aea7d4ba","type":"change","z":"65e54bc73a653e5d","name":"DO1","rules":[{"t":"set","p":"topic","pt":"msg","to":"DO1","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":500,"wires":[["331821ba09565ab2"]]},{"id":"203b9de05e2cf429","type":"change","z":"65e54bc73a653e5d","name":"DO2","rules":[{"t":"set","p":"topic","pt":"msg","to":"DO2","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":540,"wires":[["331821ba09565ab2"]]},{"id":"e92839a53e984a81","type":"change","z":"65e54bc73a653e5d","name":"DO3","rules":[{"t":"set","p":"topic","pt":"msg","to":"DO3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":580,"wires":[["331821ba09565ab2"]]},{"id":"b3e37f645cab7674","type":"change","z":"65e54bc73a653e5d","name":"DO4","rules":[{"t":"set","p":"topic","pt":"msg","to":"DO4","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":620,"wires":[["331821ba09565ab2"]]},{"id":"331821ba09565ab2","type":"join","z":"65e54bc73a653e5d","name":"合并四个DO线圈开关状态","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"4","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":900,"y":560,"wires":[["8e4354b5956a9967"]]},{"id":"8e4354b5956a9967","type":"debug","z":"65e54bc73a653e5d","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1100,"y":560,"wires":[]},{"id":"b927f782553e82d7","type":"comment","z":"65e54bc73a653e5d","name":"双击打开查看Modbus-请求/解析【官方使用文档】","info":"官方使用文档 (ctrl+单击打开连接):nhttps://yunteng.yuque.com/avshoi/aiotedge-v1xdocs/frdwwgyi90min1kgnnn","x":260,"y":280,"wires":[]},{"id":"b25a47338bb1c92c","type":"modbus_out","z":"65e54bc73a653e5d","name":"控制DO1~DO4开关(写多个线圈)","uid":"0","func":"15","regAddr":"00001","regNum":"3","props":[{"addr":10001,"num":1,"dataType":"u16AB","byteAddr":10000}],"x":380,"y":560,"wires":[["05463c69a4f415e3","98dd60edc854956a"]]},{"id":"fd5efc2a67af8d8c","type":"inject","z":"65e54bc73a653e5d","name":"[15]打开DO1~DO4","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[15]","payloadType":"jsonata","x":190,"y":500,"wires":[["b25a47338bb1c92c"]]},{"id":"05463c69a4f415e3","type":"debug","z":"65e54bc73a653e5d","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":380,"y":520,"wires":[]},{"id":"837f7928f52bb4e2","type":"debug","z":"65e54bc73a653e5d","name":"debug 8","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":700,"y":340,"wires":[]},{"id":"d51be66a79d7d3ef","type":"debug","z":"65e54bc73a653e5d","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":700,"y":440,"wires":[]},{"id":"44d191ed5c2d4ec5","type":"inject","z":"65e54bc73a653e5d","name":"[0]关闭DO1~DO4","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[0]","payloadType":"jsonata","x":180,"y":620,"wires":[["b25a47338bb1c92c"]]},{"id":"04ca5f965fd5cccd","type":"serial config","name":"","serialport":"/dev/ttyS1","baudrate":"9600","databits":"8","stopbits":"1","parity":"none","timeout":"50","reqtimeout":"1000"}]
本文通过 YUQUE WORDPRESS 同步自语雀
云腾五洲-AI助理