Delay in writing modbus

I'm having trouble writing modbus, is slowing down. Does anyone know how to leave writing in real time?
follows the project.


Im not sure why there would be a delay but one place to check is in the Modbus config
Experiment with lower ms delays for connection and queue.

I performed this configuration, but it still takes time to write in the modules.
debug information is in real time, but I don't know why writing alone is too time consuming.

  1. when you say its time consuming .. what exactly do you see that is slow ? You are trying to control some Digital out and it takes long to enable/disable it ?
  2. Do you have any devices on the same line that may be off and timing out that could cause a delay for the rest ?
  3. Is the modbus communication line TCP/ethernet or RS485/serial ?
  1. Is slow to turn a digital output on and off.
  2. I have a digital output module, a digital input module, and an analog input module. Everyone has different addresses.
  3. I'm using RS485/serial modbus.

This is the modbus configuration.

  1. From the timestamps of your msgs in the debug window i notice that the msgs are timed very close to each other. What is sending those msgs ? .. it doesnt show in the first screenshot. We just see a wire connected to a switch node. Maybe you are sending two msgs at the time to the device ?
  2. from the screenshot of you second post where you show how you construct the msg for FC16, unitid doesnt need to be a string, neither does quantity. I dont know if the modbus node parses those strings to integers.
    Also where does value-2:array(2) (in debug msg scheenshot) come from since in none of your other screenshots, show you creating such a property value-2
  3. you write FC16 which is Preset multiple registers and your value: [0,1] looks like your trying to set Coil ?
    image

There are many aspects of your flow that we dont know
I think best to test with only one device physically connected.
make sure baud rate etc are matching. and in node red use just one inject node to send the mod. msg.

Other thing to consider is the use a good shielded cable when the devices have long distance?
and terminate the last device with 120Ohm resistor (if it doesnt have an internal termination).

This problem presents with node red installed on raspbary pi4. Now I decided to carry out the same project with node red installed on windows 10, and it doesn't show any slowdowns. It works perfectly.
I found a comment saying to "Try using the Cacao virtual machine instead which JITs", but I run the command and it wasn't successful. "java -version" to "java -cacao -version".

How did you install node-red on the pi?

download the full version "Raspberry Pi OS with desktop and recommended software" already comes with node red.

That will not usually give you an up to date version of node-red or nodejs. The best way is to use the script recommended in the node-red docs. It may not make any difference but I suggest running the script to upgrade node red and try again. I presume you have already backed up your flows file, but if not then do that first, though the upgrade should not mess it up. Running on Raspberry Pi : Node-RED

also along Colin's suggestions to update NR, did you do all the updates for your Raspberry Pi OS ?
sudo apt update
sudo apt full-upgrade

and firmware updates
sudo apt install rpi-eeprom

from what i see from your Modbus config you are using USB0 port so it means you are using a USB to serial converter ? Maybe with the updates they fix some usb performance issues.

maybe if possible test a different brand of converter ?

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