Skip to content

Commit

Permalink
update modbus
Browse files Browse the repository at this point in the history
  • Loading branch information
lmtreser committed Jul 25, 2024
1 parent 4163eb5 commit 8fd8aa0
Show file tree
Hide file tree
Showing 3 changed files with 237 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dispositivos/modbus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ Frame OFF:

## Implementación con Node-RED

Mediante Node-Red se puede implementar tanto un maestro, como un esclavo. En el archivo `a` de ejemplo:
Mediante Node-Red se puede implementar tanto un maestro, como un esclavo utilizando el paquete [node-red-contrib-modbus](https://flows.nodered.org/node/node-red-contrib-modbus). En el archivo `modbus_flows.json` se implementan nodos para escribir y leer en un dispositivo esclavo.

![Flows](flows.png)

## Recursos

Expand Down
Binary file added dispositivos/modbus/flows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
234 changes: 234 additions & 0 deletions dispositivos/modbus/modbus_flows.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
[
{
"id": "ca3cc38a6e5e5a4e",
"type": "tab",
"label": "Modbus",
"disabled": false,
"info": "",
"env": []
},
{
"id": "0bafdfced0b483b4",
"type": "modbus-write",
"z": "ca3cc38a6e5e5a4e",
"name": "FC5",
"showStatusActivities": false,
"showErrors": true,
"showWarnings": true,
"unitid": "2",
"dataType": "Coil",
"adr": "1",
"quantity": "1",
"server": "e08aecb109e943be",
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"delayOnStart": false,
"startDelayTime": "",
"x": 330,
"y": 140,
"wires": [
[],
[
"909e033419126379"
]
]
},
{
"id": "909e033419126379",
"type": "debug",
"z": "ca3cc38a6e5e5a4e",
"name": "debug fc5",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 520,
"y": 120,
"wires": []
},
{
"id": "34a142da20485d1c",
"type": "modbus-read",
"z": "ca3cc38a6e5e5a4e",
"name": "FC2",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": true,
"showWarnings": true,
"unitid": "2",
"dataType": "Input",
"adr": "1",
"quantity": "1",
"rate": "5",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "e08aecb109e943be",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 330,
"y": 220,
"wires": [
[
"b314fde1e94d9d7e"
],
[]
]
},
{
"id": "b314fde1e94d9d7e",
"type": "debug",
"z": "ca3cc38a6e5e5a4e",
"name": "debug fc2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 520,
"y": 200,
"wires": []
},
{
"id": "953bf8c77c31674b",
"type": "ui_switch",
"z": "ca3cc38a6e5e5a4e",
"name": "",
"label": "LED",
"tooltip": "",
"group": "d5619656af46dda7",
"order": 4,
"width": 0,
"height": 0,
"passthru": true,
"decouple": "false",
"topic": "topic",
"topicType": "msg",
"style": "",
"onvalue": "1",
"onvalueType": "num",
"onicon": "",
"oncolor": "",
"offvalue": "0",
"offvalueType": "num",
"officon": "",
"offcolor": "",
"animate": false,
"className": "",
"x": 170,
"y": 140,
"wires": [
[
"0bafdfced0b483b4"
]
]
},
{
"id": "494e67bac6df1c25",
"type": "modbus-read",
"z": "ca3cc38a6e5e5a4e",
"name": "FC4",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": true,
"showWarnings": true,
"unitid": "2",
"dataType": "InputRegister",
"adr": "0",
"quantity": "2",
"rate": "3",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "e08aecb109e943be",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 330,
"y": 300,
"wires": [
[
"cf6e0392194c05fa"
],
[]
]
},
{
"id": "cf6e0392194c05fa",
"type": "debug",
"z": "ca3cc38a6e5e5a4e",
"name": "debug fc4",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 520,
"y": 280,
"wires": []
},
{
"id": "e08aecb109e943be",
"type": "modbus-client",
"name": "Modbus RTU Server",
"clienttype": "simpleser",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"failureLogEnabled": true,
"tcpHost": "127.0.0.1",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyUSB0",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "38400",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "0x3A",
"unit_id": "1",
"commandDelay": "1",
"clientTimeout": "1000",
"reconnectOnTimeout": true,
"reconnectTimeout": "2000",
"parallelUnitIdsAllowed": true,
"showErrors": false,
"showWarnings": true,
"showLogs": true
},
{
"id": "d5619656af46dda7",
"type": "ui_group",
"name": "Registro",
"tab": "8624a7228b97d7d6",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "8624a7228b97d7d6",
"type": "ui_tab",
"name": "Node-RED IoT Dashboard",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]

0 comments on commit 8fd8aa0

Please sign in to comment.