# Convert Modbus RTU To Modbus TCP

**URL:** <https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326>\
**Category:** General\
**Created:** [15 September 2023 05:06 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326 "2023-09-15T05:06:34Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![shadow\_hayiia](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shadow_hayiia/32/82903_2.png) [@shadow\_hayiia](https://discourse.nodered.org/u/shadow_hayiia)\
**Post date:** [15 September 2023 05:06 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/1 "2023-09-15T05:06:34Z")

</div>

I wanna know if it's possible to turn modbus RTU to modbus tcp

---

<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:** [15 September 2023 07:01 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/2 "2023-09-15T07:01:04Z")

</div>

Pretty much anything is possible. But for assistance, you will need to provide more information.

Are you creating a modbus server? Wanting to accept serial connection and pass it straight out to a modbus TCP server? Something else?

---

<div class="post-metadata">

**Author:** ![shadow\_hayiia](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shadow_hayiia/32/82903_2.png) [@shadow\_hayiia](https://discourse.nodered.org/u/shadow_hayiia)\
**Post date:** [15 September 2023 07:29 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/3 "2023-09-15T07:29:46Z")

</div>

I have DataKom that can be read via modbus RTU and i want to convert the data read to modbus TCP To my laptop.

---

<div class="post-metadata">

**Author:** ![shadow\_hayiia](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shadow_hayiia/32/82903_2.png) [@shadow\_hayiia](https://discourse.nodered.org/u/shadow_hayiia)\
**Post date:** [15 September 2023 07:32 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/4 "2023-09-15T07:32:27Z")

</div>

WITH, Node-red on my raspberry pi

---

<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:** [15 September 2023 07:56 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/5 "2023-09-15T07:56:42Z")

</div>

Still unclear. Will the pi connect serially and permit another modbus client to access the DataKom? Is the DataKom a master/client or slave/server?

What will the modbus TCP be? master/client or slave/server?

How are devices connected?

---

<div class="post-metadata">

**Author:** ![shadow\_hayiia](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shadow_hayiia/32/82903_2.png) [@shadow\_hayiia](https://discourse.nodered.org/u/shadow_hayiia)\
**Post date:** [15 September 2023 08:30 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/6 "2023-09-15T08:30:31Z")

</div>

DataKom \> Slave  
Raspberry Pi \> Master/Converter  
My Laptop \> Receiver

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [15 September 2023 08:52 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/7 "2023-09-15T08:52:54Z")

</div>

Can you explain why you want to do that?

---

<div class="post-metadata">

**Author:** ![shadow\_hayiia](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shadow_hayiia/32/82903_2.png) [@shadow\_hayiia](https://discourse.nodered.org/u/shadow_hayiia)\
**Post date:** [16 September 2023 11:06 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/9 "2023-09-16T11:06:39Z")

</div>

My Project's are about managing incoming voltage in a home. DataKom was my solution. I handled the rest but I want to convert RTU to TCP, because incoming voltage is gonna be displayed in a Simens Green Series Display, It only has TCP.

---

<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:** [16 September 2023 12:37 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/10 "2023-09-16T12:37:01Z")

</div>

Your explanations are still unclear. Not many here will know what a DataKom is nor what a green screen display is.

What will connect to what and what protocols do each device have..

You said DataKom was a client but what about the rest of the pieces of this puzzle?

Also, what have you achieved so far? Have you managed to connect to this DataKom device? Can you read the values?

Have yo connected the screen to node-red? Can you send data to the screen (or can the screen read from node-red)?

Lastly, does the screen support other protocols?

---

<div class="post-metadata">

**Author:** ![shadow\_hayiia](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shadow_hayiia/32/82903_2.png) [@shadow\_hayiia](https://discourse.nodered.org/u/shadow_hayiia)\
**Post date:** [16 September 2023 19:39 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/11 "2023-09-16T19:39:27Z")

</div>

I was able to read “ALL OF THE DATAS” from RTU. But since the projects to read all datas from MODBUS TCP With raspberry pi, I am unsure what nodes to connect to each other to convert data from Modbus RTU to Modbus TCP.

---

<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:** [16 September 2023 23:19 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/12 "2023-09-16T23:19:55Z")

</div>

> [@shadow\_hayiia](#):
>
> But since the projects to read all datas from MODBUS TCP With raspberry pi, I am unsure what nodes to connect to each other to convert data from Modbus RTU to Modbus TCP

That is why I asked the questions above.

> [@Steve-Mcl](#):
>
> Have yo connected the screen to node-red? Can you send data to the screen (or can the screen read from node-red)?
> 
> Lastly, does the screen support other protocols?

If you answer them then we would have a better idea for you.

---

<div class="post-metadata">

**Author:** ![ptnodered](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@ptnodered](https://discourse.nodered.org/u/ptnodered)\
**Post date:** [16 September 2023 23:53 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/13 "2023-09-16T23:53:11Z")

</div>

I tested by reading Holding regsiter data by using "Modbus Read Node" which can be your serial device. and writing by using "Modbus Write Node" and passing this to "Modbus Server" which is giving modbus data over TCP at port as specified in Modbus Server. Please see attached flow.

```auto
[
    {
        "id": "7ad6a2ac79deb9e9",
        "type": "modbus-read",
        "z": "74de3ec4.23087",
        "name": "Hold_reg3",
        "topic": "",
        "showStatusActivities": true,
        "logIOActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "1",
        "dataType": "HoldingRegister",
        "adr": "0",
        "quantity": "16",
        "rate": "1",
        "rateUnit": "s",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "d3f6a446.e8ec78",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "x": 120,
        "y": 3560,
        "wires": [
            [
                "aae548568a58e734"
            ],
            []
        ]
    },
    {
        "id": "aae548568a58e734",
        "type": "modbus-write",
        "z": "74de3ec4.23087",
        "name": "",
        "showStatusActivities": true,
        "showErrors": false,
        "showWarnings": true,
        "unitid": "1",
        "dataType": "MHoldingRegisters",
        "adr": "0",
        "quantity": "16",
        "server": "61cb1a5ba65cc327",
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "delayOnStart": false,
        "startDelayTime": "",
        "x": 320,
        "y": 3540,
        "wires": [
            [
                "67325fa815e96b2c"
            ],
            []
        ]
    },
    {
        "id": "67325fa815e96b2c",
        "type": "modbus-server",
        "z": "74de3ec4.23087",
        "name": "",
        "logEnabled": false,
        "hostname": "127.0.0.1",
        "serverPort": 10502,
        "responseDelay": 100,
        "delayUnit": "ms",
        "coilsBufferSize": 10000,
        "holdingBufferSize": 10000,
        "inputBufferSize": 10000,
        "discreteBufferSize": 10000,
        "showErrors": false,
        "x": 540,
        "y": 3540,
        "wires": [
            [
                "465ba498d477d698"
            ],
            [],
            [],
            [],
            []
        ]
    },
    {
        "id": "465ba498d477d698",
        "type": "debug",
        "z": "74de3ec4.23087",
        "name": "debug 165",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 3520,
        "wires": []
    },
    {
        "id": "d3f6a446.e8ec78",
        "type": "modbus-client",
        "name": "test",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "tcpHost": "127.0.0.1",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "unit_id": 1,
        "commandDelay": 1,
        "clientTimeout": 1000,
        "reconnectOnTimeout": true,
        "reconnectTimeout": 2000,
        "parallelUnitIdsAllowed": true
    },
    {
        "id": "61cb1a5ba65cc327",
        "type": "modbus-client",
        "name": "",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "127.0.0.1",
        "tcpPort": "10502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "1",
        "commandDelay": "1",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": true,
        "showWarnings": true,
        "showLogs": true
    }
]

```

---

<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:** [15 November 2023 23:54 UTC](https://discourse.nodered.org/t/convert-modbus-rtu-to-modbus-tcp/81326/14 "2023-11-15T23:54:01Z")

</div>

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