# Modbus gateway - how to?

**URL:** <https://discourse.nodered.org/t/modbus-gateway-how-to/64826>\
**Category:** General\
**Tags:** modbus\
**Created:** [8 July 2022 09:54 UTC](https://discourse.nodered.org/t/modbus-gateway-how-to/64826 "2022-07-08T09:54:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![json\_lame](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@json\_lame](https://discourse.nodered.org/u/json_lame)\
**Post date:** [8 July 2022 09:54 UTC](https://discourse.nodered.org/t/modbus-gateway-how-to/64826/1 "2022-07-08T09:54:40Z")

</div>

Hello everyone 🙂

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 🙂

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 July 2022 10:24 UTC](https://discourse.nodered.org/t/modbus-gateway-how-to/64826/2 "2022-07-08T10:24:31Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![json\_lame](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@json\_lame](https://discourse.nodered.org/u/json_lame)\
**Post date:** [8 July 2022 10:41 UTC](https://discourse.nodered.org/t/modbus-gateway-how-to/64826/3 "2022-07-08T10:41:22Z")

</div>

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 🙂 ) and I'm ashamed to ask for help again 🤪

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 July 2022 10:44 UTC](https://discourse.nodered.org/t/modbus-gateway-how-to/64826/4 "2022-07-08T10:44:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![json\_lame](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@json\_lame](https://discourse.nodered.org/u/json_lame)\
**Post date:** [8 July 2022 11:01 UTC](https://discourse.nodered.org/t/modbus-gateway-how-to/64826/5 "2022-07-08T11:01:29Z")

</div>

Yes, it must be dynamic...

Here is some preveiew from Modbus TCP request:

```auto
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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 September 2022 11:02 UTC](https://discourse.nodered.org/t/modbus-gateway-how-to/64826/6 "2022-09-06T11:02:19Z")

</div>

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