ModBus speed problem

I have a couple of these RS485 relay boards, connected to these Ethernet to RS485 converter.

The first problem that I see is that reading a 8 bit register every 0,1 second makes impossible to send the relay commands: when I send them, they get executed seconds later. I've tried going from 9600 to 57600 and the problem persist, even though I think (but I'm a bit ignorant in this) that 9600bps should be enough.
I'm using the nodes node-red-contrib-modbus

I'm very new to ModBus: am I missing something here?

Thanks!

You will need to show us what you are doing. For example are you flooding the serial line by polling data very fast and often?

Perhaps you have the serial server ill configured or noise in the cable due to poor shielding, incorrect shielding, incorrect termination (causing frequent disconnect/reconnect between the serial server and end device).

As a first step, disable any polling and simply executive one off operations. Is it responsive and reliable?

Hi Steve,
I'm not flooding the serial line. The code is down here.
If I read the data at 1 second frequency, I have no problem controlling the relays, if I increase the frequency ad 0,5 seconds some relays commands are not executed, if I increase it at 0,1 seconds, most of the relays commands are not executed.
The configuration of the ethernet-modbus converter is this one:

P.s. is there a way to paste code into a window with the scroll bar so that it doesn't get so long?
Thanks!

[{"id":"0d78f2721da74e0e","type":"modbus-flex-write","z":"1627634e13ee8b6c","name":"","showStatusActivities":false,"showErrors":false,"showWarnings":true,"server":"e58315cee1268341","emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"","x":570,"y":220,"wires":[["90d12c72b7340520"],["1548ca767ae3c14f"]]},{"id":"3193580a2b132298","type":"function","z":"1627634e13ee8b6c","name":"Board 2 - 5","func":"let newMsg = {};\nnewMsg.payload = {};\nnewMsg.payload.value = msg.payload;\nnewMsg.payload.fc = 5;\nnewMsg.payload.unitid = 2;\nnewMsg.payload.address = 5;\nnewMsg.payload.quantity = 1; \nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":480,"wires":[["7bd6e385e4c5b09e"]]},{"id":"3eeb7988d132e9ec","type":"inject","z":"1627634e13ee8b6c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":500,"wires":[["3193580a2b132298"]]},{"id":"9654672810b56e73","type":"inject","z":"1627634e13ee8b6c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":150,"y":460,"wires":[["3193580a2b132298"]]},{"id":"90d12c72b7340520","type":"debug","z":"1627634e13ee8b6c","name":"debug 83","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":820,"y":200,"wires":[]},{"id":"1548ca767ae3c14f","type":"debug","z":"1627634e13ee8b6c","name":"debug 84","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":820,"y":240,"wires":[]},{"id":"127e551b4e7178b4","type":"function","z":"1627634e13ee8b6c","name":"Board 4 - 5","func":"let newMsg = {};\nnewMsg.payload = {};\nnewMsg.payload.value = msg.payload;\nnewMsg.payload.fc = 5;\nnewMsg.payload.unitid = 4;\nnewMsg.payload.address = 5;\nnewMsg.payload.quantity = 1; \nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":260,"wires":[["0d78f2721da74e0e"]]},{"id":"cbff042618e3e3fa","type":"inject","z":"1627634e13ee8b6c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":280,"wires":[["127e551b4e7178b4"]]},{"id":"f68a6767fa606af8","type":"inject","z":"1627634e13ee8b6c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":150,"y":240,"wires":[["127e551b4e7178b4"]]},{"id":"02c0f0b632ca331b","type":"function","z":"1627634e13ee8b6c","name":"Board 4 - 4","func":"let newMsg = {};\nnewMsg.payload = {};\nnewMsg.payload.value = msg.payload;\nnewMsg.payload.fc = 5;\nnewMsg.payload.unitid = 4;\nnewMsg.payload.address = 4;\nnewMsg.payload.quantity = 1; \nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":160,"wires":[["0d78f2721da74e0e"]]},{"id":"6e3a2aa97b70ddf0","type":"inject","z":"1627634e13ee8b6c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":180,"wires":[["02c0f0b632ca331b"]]},{"id":"f72d66ae86653351","type":"inject","z":"1627634e13ee8b6c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":150,"y":140,"wires":[["02c0f0b632ca331b"]]},{"id":"93aaedff464a500d","type":"function","z":"1627634e13ee8b6c","name":"Board 2 - 7","func":"let newMsg = {};\nnewMsg.payload = {};\nnewMsg.payload.value = msg.payload;\nnewMsg.payload.fc = 5;\nnewMsg.payload.unitid = 2;\nnewMsg.payload.address = 7;\nnewMsg.payload.quantity = 1; \nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":380,"wires":[["7bd6e385e4c5b09e"]]},{"id":"b7717ff9f1245f94","type":"inject","z":"1627634e13ee8b6c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":400,"wires":[["93aaedff464a500d"]]},{"id":"7f18b95edaa9f761","type":"inject","z":"1627634e13ee8b6c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":150,"y":360,"wires":[["93aaedff464a500d"]]},{"id":"7bd6e385e4c5b09e","type":"modbus-flex-write","z":"1627634e13ee8b6c","name":"","showStatusActivities":false,"showErrors":false,"showWarnings":true,"server":"e58315cee1268341","emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"","x":590,"y":440,"wires":[["24a35a066faa4ef6"],["ce547338486f9223"]]},{"id":"24a35a066faa4ef6","type":"debug","z":"1627634e13ee8b6c","name":"debug 85","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":880,"y":420,"wires":[]},{"id":"ce547338486f9223","type":"debug","z":"1627634e13ee8b6c","name":"debug 86","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":880,"y":460,"wires":[]},{"id":"ed4ce15212be374c","type":"modbus-flex-getter","z":"1627634e13ee8b6c","name":"","showStatusActivities":false,"showErrors":false,"showWarnings":true,"logIOActivities":false,"server":"e58315cee1268341","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"","x":600,"y":580,"wires":[["50689523185f4db1"],["a876a77182af3f23"]]},{"id":"dca6186858c9d09a","type":"function","z":"1627634e13ee8b6c","name":"Board 4","func":"let newMsg = {};\nnewMsg.payload = {};\nnewMsg.payload.value = msg.payload;\nnewMsg.payload.fc = 3;\nnewMsg.payload.unitid = 4;\nnewMsg.payload.address = 144;\nnewMsg.payload.quantity = 1; \nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":580,"wires":[["ed4ce15212be374c"]]},{"id":"87548eae4d04bb41","type":"inject","z":"1627634e13ee8b6c","name":"","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":150,"y":580,"wires":[["dca6186858c9d09a"]]},{"id":"50689523185f4db1","type":"debug","z":"1627634e13ee8b6c","name":"debug 91","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","statusVal":"","statusType":"auto","x":1120,"y":560,"wires":[]},{"id":"a876a77182af3f23","type":"debug","z":"1627634e13ee8b6c","name":"debug 92","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1120,"y":600,"wires":[]},{"id":"e1f0725ee96f5da8","type":"modbus-flex-getter","z":"1627634e13ee8b6c","name":"","showStatusActivities":false,"showErrors":false,"showWarnings":true,"logIOActivities":false,"server":"e58315cee1268341","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"","x":600,"y":680,"wires":[["f57075728f11d6a9"],["00e98000343bc9b5"]]},{"id":"f3be4bd49d187e45","type":"function","z":"1627634e13ee8b6c","name":"Board 2","func":"let newMsg = {};\nnewMsg.payload = {};\nnewMsg.payload.value = msg.payload;\nnewMsg.payload.fc = 3;\nnewMsg.payload.unitid = 2;\nnewMsg.payload.address = 144;\nnewMsg.payload.quantity = 1; \nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":680,"wires":[["e1f0725ee96f5da8"]]},{"id":"c801070a312ccc93","type":"inject","z":"1627634e13ee8b6c","name":"","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":150,"y":680,"wires":[["f3be4bd49d187e45"]]},{"id":"f57075728f11d6a9","type":"debug","z":"1627634e13ee8b6c","name":"debug 93","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","statusVal":"","statusType":"auto","x":820,"y":660,"wires":[]},{"id":"00e98000343bc9b5","type":"debug","z":"1627634e13ee8b6c","name":"debug 94","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":820,"y":700,"wires":[]},{"id":"e58315cee1268341","type":"modbus-client","name":"ModBus - Ethernet","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"failureLogEnabled":false,"tcpHost":"192.168.0.101","tcpPort":"8887","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":"","commandDelay":1,"clientTimeout":1000,"reconnectOnTimeout":true,"reconnectTimeout":2000,"parallelUnitIdsAllowed":false}]

admin edit: wrap flow in a code block to make it importable and correctly formatted

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.