Modbus gateway - how to?

Hello everyone :slight_smile:

I'm forced to ask you for help, because I don't know how to solve it
Our newest SCADA system is not able to communicate by serial port (RS485) and we have some devices that have only RS485 ports. So we need to convert Modbus TCP to Modbus RTU and I think node-red could help with that. Of course there are some converters on market, but in our case delivery time is about 3-6 months.
I've tried to build some nodes by myself, but it was not working as I want.

I used example Modbus Slave from Biancoroyal and adapt it for me, but I've got to precisely describe what register I want to read from RTU slave and redirect it to TCP Slave register. Also some registers was inverted, so this solution is not perfect.

The best way is that the Node-Red could capture Modbus TCP frame, customize it for RTU and pass it away.
The answer should work opposite. Important thing is that we don't have to write registers on slaves. Only function thet we are intrested in is Holding Registers.

Thanks for your help in advance :slight_smile:

What protocols does your SCADA support?

for example, if it does MQTT, then this is a very simple task of collecting data from the RS485 devices and sending their values to the MQTT broker. I.E. No need to generate a ModBus TCP Server to support conversion from RTU to TCP

PS: You mention capturing frames and modifying them for RTU - this is (IMO) going too far when there are contrib nodes (e.g. node-red-contrib-modbus) that can (graphically) read from a RTU client and act as a TCP server - therefore making this an (almost) drag and drop (low-code) conversion if you must go down that route.

Lastly, to answer the burning question, yes, node-red can do this (and much more)

Unfornatelly, I'm in that position that only protocol to use is Modbus TCP, so i need real-time converter protocol

Generally with easier projects I can handle myself and many projects I've done already, but this task is harder, that's why I ask for help. In addition you helped me some time ago (once again big thank you :slight_smile: ) and I'm ashamed to ask for help again :crazy_face:

Does this need to be dynamic? I.e. will the SCADA ask for values from differing addresses, at various times in various sizes - OR - is the SCADA poling 1 particular area regularly and unchanging?

Yes, it must be dynamic...

Here is some preveiew from Modbus TCP request:

2E 8C 00 00 00 06 01 03 1B 68 00 04
2E 8D 00 00 00 06 01 03 1B 74 00 08
2E 8E 00 00 00 06 01 03 1B 7C 00 08
2E 8F 00 00 00 06 01 03 13 88 00 04
2E 90 00 00 00 06 01 03 13 E8 00 08
2E 91 00 00 00 06 01 03 1B 58 00 08
2E 92 00 00 00 06 01 03 13 88 00 04
2E 93 00 00 00 06 01 03 13 E8 00 08
2E 94 00 00 00 06 01 03 1B 58 00 08
2E 95 00 00 00 06 01 03 1B 68 00 04
2E 96 00 00 00 06 01 03 1B 74 00 08
2E 97 00 00 00 06 01 03 1B 7C 00 08
2E 98 00 00 00 06 01 03 13 88 00 04
2E 99 00 00 00 06 01 03 13 E8 00 08
2E 9A 00 00 00 06 01 03 1B 58 00 08
2E 9B 00 00 00 06 01 03 1B 68 00 04
2E 9C 00 00 00 06 01 03 1B 74 00 08
2E 9D 00 00 00 06 01 03 1B 7C 00 08

The same registers are for device with ID 2