I've figured how to set parity and the number of data bits etc
This can be done by selecting Serial Expert for the modbus server.
I think the problem could also be caused by missed termination in the RS485 network, because no matter what I am trying with baud rate
, parity
, data bits
etc., I am getting errors only (data length error
or timeout). So we will check the hardware configuration there, too.
Here is the flow, but
[
{
"id": "1d730243db9feb8a",
"type": "tab",
"label": "ModBus Seriell ClampOn ",
"disabled": false,
"info": "",
"env": []
},
{
"id": "a4c9a2f40bc6910c",
"type": "modbus-flex-getter",
"z": "1d730243db9feb8a",
"name": "Serial ModBus ClampOn",
"showStatusActivities": true,
"showErrors": true,
"showWarnings": false,
"logIOActivities": false,
"server": "9918af96579ce096",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"keepMsgProperties": true,
"delayOnStart": false,
"enableDeformedMessages": false,
"startDelayTime": "2",
"x": 570,
"y": 180,
"wires": [
[
"1e69851eced5d421"
],
[
"699db3ec86531f6b"
]
]
},
{
"id": "7bb0e6a2935402b5",
"type": "inject",
"z": "1d730243db9feb8a",
"name": "trigger",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "true",
"payloadType": "bool",
"x": 110,
"y": 100,
"wires": [
[
"cdacefc17ac2b270"
]
]
},
{
"id": "cdacefc17ac2b270",
"type": "function",
"z": "1d730243db9feb8a",
"name": "FC ??? -- 4 517 [6]",
"func": "\nmsg.payload = { \n // value is true WHY ????\n // value: msg.payload,\n // https://blog.softwaretoolbox.com/opc-modbus-function-codes\n 'fc': 3,\n 'unitid': 0,\n\n 'address': 1,\n 'quantity': 1\n};\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 330,
"y": 180,
"wires": [
[
"a4c9a2f40bc6910c"
]
]
},
{
"id": "1e69851eced5d421",
"type": "debug",
"z": "1d730243db9feb8a",
"name": "debug 4",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 140,
"wires": []
},
{
"id": "699db3ec86531f6b",
"type": "debug",
"z": "1d730243db9feb8a",
"name": "debug 7",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 220,
"wires": []
},
{
"id": "9918af96579ce096",
"type": "modbus-client",
"name": "",
"clienttype": "serial",
"bufferCommands": true,
"stateLogEnabled": true,
"queueLogEnabled": false,
"failureLogEnabled": true,
"tcpHost": "127.0.0.1",
"tcpPort": 502,
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyAMA0",
"serialType": "RTU",
"serialBaudrate": "9600",
"serialDatabits": "5",
"serialStopbits": 1,
"serialParity": "none",
"serialConnectionDelay": 100,
"serialAsciiResponseStartDelimiter": "0x3A",
"unit_id": 0,
"commandDelay": 0,
"clientTimeout": 2000,
"reconnectOnTimeout": false,
"reconnectTimeout": 2000,
"parallelUnitIdsAllowed": false,
"showErrors": true,
"showWarnings": true,
"showLogs": true
},
{
"id": "2d201daaac4afbbb",
"type": "global-config",
"env": [],
"modules": {
"node-red-contrib-modbus": "5.44.1"
}
}
]
But I cannot change the value for this configuration field: "serialAsciiResponseStartDelimiter": "0x3A"
, right?