Hi every one , i want to connect and control multiple (two) devices through my rs485 to usb converter in my node red flow , but it seems node red can control one at the same time , and when it connects to one device it can not communicate with another device while its communicating with that device . once one of them connect another one disconnect. of cource is not logically to use two separate converter and separate COM ports.
Welcome to the forum @MHNYZ
Using rs485 you can only directly communicate with one at any moment, as rs485 is a simple serial bus. However, if you make sure you only talk to one at a time it should work. What exactly are you trying to do?
Of course I've a simple monitoring dashboard that monitoring multiple parameters such as motor rpm from vfd and line parameters such as voltage and current from a multifunction meter. and also sending some commands to them.
And as you know this problem dose not refer to the modbus protocol and serial bus.
In PLCs we can connect multiple devices on a line at the same time, but idk on PCs or maybe industrial edge PCs it's possible to communicate with only one device over modbus?
There is no way with a serial bus that you can talk to two devices at the same instant. The device sending a message streams a sequence of bits along the wire, it cannot send a stream of bits to one device and a stream to another at the same time. It is, of course, possible to send a message to one modbus device and get a reply, and then send a message to another modbus device, and then one to a third device, and so on.
Of course it is possible to communicate with more than one, but each transaction must be complete before the next is started.
Please describe exactly how you are trying to communicate with two devices. Select the nodes that do the communication (only a few nodes, we do not need the whole flow), use the menu Export facility to export to the clipboard, then paste the export here. In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```
)
```
code goes here
```
See this post for more details - How to share code or flow json
here is a part of my code which contains modbus read node from two different devices over modbus and send these datas to influxdb and after thet to grafana to draw usefull charts . finally i use mbed link of grafana in node-red .
also ive tested "Queue delay (ms)" in device setting but didnt find it usefull to this problem.
[
{
"id": "558562422f7952bb",
"type": "influxdb out",
"z": "0b7aac83ab52313e",
"influxdb": "63835a05aac5a6b5",
"name": "output power",
"measurement": "VFD output power",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "etesal",
"bucket": "exhibition_db",
"x": 690,
"y": 1340,
"wires": []
},
{
"id": "3c47e29f91177b4f",
"type": "debug",
"z": "0b7aac83ab52313e",
"name": "debug 4",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 700,
"y": 1260,
"wires": []
},
{
"id": "b3a20ec2c7e572ed",
"type": "modbus-read",
"z": "0b7aac83ab52313e",
"name": "read output power",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"showWarnings": true,
"unitid": "2",
"dataType": "HoldingRegister",
"adr": "12294",
"quantity": "1",
"rate": "500",
"rateUnit": "ms",
"delayOnStart": false,
"startDelayTime": "",
"server": "c471b864e6477ce8",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 150,
"y": 1260,
"wires": [
[
"e18e332ecdb6316b"
],
[]
]
},
{
"id": "e18e332ecdb6316b",
"type": "function",
"z": "0b7aac83ab52313e",
"name": "devide by 100",
"func": "// Assuming the Modbus read node provides the data in msg.payload\nlet rawData = msg.payload;\n\n// Divide the read data by 100 and convert to 2 decimal places\nlet processedData = (rawData / 100).toFixed(2);\n\n// Convert the processedData back to a number for further use in charts\nmsg.payload = parseFloat(processedData);\n\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 1260,
"wires": [
[
"3c47e29f91177b4f",
"558562422f7952bb"
]
]
},
{
"id": "a51be65001287954",
"type": "debug",
"z": "0b7aac83ab52313e",
"name": "debug 5",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 680,
"y": 1460,
"wires": []
},
{
"id": "0cecbb7b66132ab5",
"type": "modbus-read",
"z": "0b7aac83ab52313e",
"name": "read mccb voltage RST",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"showWarnings": true,
"unitid": "3",
"dataType": "HoldingRegister",
"adr": "8",
"quantity": "1",
"rate": "600",
"rateUnit": "ms",
"delayOnStart": false,
"startDelayTime": "",
"server": "aa208220b7715c99",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 220,
"y": 1460,
"wires": [
[
"a51be65001287954"
],
[]
]
},
{
"id": "023197b423695232",
"type": "ui_template",
"z": "0b7aac83ab52313e",
"group": "f62c6d8f1f947782",
"name": "MCCB column Title",
"order": 2,
"width": 0,
"height": 0,
"format": "<style>\n .column-title-ribbon {\n position: relative;\n background: #FFA500; /* Orange background */\n color: white; /* Text color */\n padding: 5px 10px; /* Reduced padding */\n text-align: center; /* Center the text */\n font-size: 2vw; /* Responsive font size based on viewport width */\n line-height: 1; /* Line height for better spacing */\n border-radius: 10px; /* Rounded corners */\n display: inline-block; /* Allow width and height to adjust */\n overflow: hidden; /* Hide overflow */\n margin: 0; /* Removed margin to eliminate extra space */\n vertical-align: top; /* Align to the top to reduce space */\n }\n\n .column-title-ribbon:before,\n .column-title-ribbon:after {\n content: \"\";\n position: absolute;\n top: 100%; /* Start from the bottom */\n width: 0; /* Width will expand */\n height: 0; /* Height will expand */\n border-left: 20px solid transparent; /* Triangle left */\n border-right: 20px solid transparent; /* Triangle right */\n z-index: -1; /* Behind the text */\n }\n\n .column-title-ribbon:before {\n border-top: 20px solid #FFA500; /* Top triangle */\n left: 0;\n }\n\n .column-title-ribbon:after {\n border-top: 20px solid #FFA500; /* Bottom triangle */\n right: 0;\n }\n</style>\n\n<div class=\"column-title-ribbon\">MCCB Section</div>\n",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 210,
"y": 1420,
"wires": [
[]
]
},
{
"id": "63835a05aac5a6b5",
"type": "influxdb",
"hostname": "127.0.0.1",
"port": "8086",
"protocol": "http",
"database": "database",
"name": "local influx db",
"usetls": false,
"tls": "",
"influxdbVersion": "2.0",
"url": "http://localhost:8086",
"timeout": "10",
"rejectUnauthorized": true
},
{
"id": "c471b864e6477ce8",
"type": "modbus-client",
"name": "VFD",
"clienttype": "simpleser",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"failureLogEnabled": true,
"tcpHost": "127.0.0.1",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "COM3",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "0x3A",
"unit_id": "3",
"commandDelay": "1",
"clientTimeout": "1000",
"reconnectOnTimeout": true,
"reconnectTimeout": "2000",
"parallelUnitIdsAllowed": true,
"showErrors": false,
"showWarnings": true,
"showLogs": true
},
{
"id": "aa208220b7715c99",
"type": "modbus-client",
"name": "MCCB",
"clienttype": "simpleser",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"failureLogEnabled": false,
"tcpHost": "127.0.0.1",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "COM6",
"serialType": "RTU",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "0x3A",
"unit_id": "3",
"commandDelay": "1",
"clientTimeout": "2000",
"reconnectOnTimeout": true,
"reconnectTimeout": "200",
"parallelUnitIdsAllowed": true,
"showErrors": false,
"showWarnings": false,
"showLogs": false
},
{
"id": "f62c6d8f1f947782",
"type": "ui_group",
"name": "Control Center",
"tab": "b39e4aabfc8b821f",
"order": 1,
"disp": false,
"width": "8",
"collapse": false,
"className": ""
},
{
"id": "b39e4aabfc8b821f",
"type": "ui_tab",
"name": "نظارت بر سیستم",
"icon": "fa-desktop",
"order": 2,
"disabled": false,
"hidden": false
}
]```