# Multiple Modbus Servers to be read

**URL:** <https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498>\
**Category:** Industrial\
**Created:** [19 October 2020 10:53 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498 "2020-10-19T10:53:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [19 October 2020 10:53 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/1 "2020-10-19T10:53:28Z")

</div>

Hi folks,

I`ve set up two modbus servers on Tia Portal.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/13fb2f92e1e7b26f5ebf533891d9f2a1bcf7feb6.png)

Each read node is set up to each Modbus server. I can`t seem to access each one simultaneously from the same devcie?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e3b8252a99935b25bcd8438b44498438588da85.png)

Each one is set up to each Modbus connect values. So I don`t quite get where I`m going wrong?

Any help would be much appreciated.

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![Cristiano](https://avatars.discourse-cdn.com/v4/letter/c/b5e925/32.png) [@Cristiano](https://discourse.nodered.org/u/Cristiano)\
**Post date:** [20 October 2020 03:06 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/2 "2020-10-20T03:06:45Z")

</div>

Hi,

why two modbus servers? what is the network or system architecture?

The node can be a client of these two servers, but they have the same IP, you have to change the remote port

---

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [20 October 2020 11:54 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/3 "2020-10-20T11:54:46Z")

</div>

One is for different data than the other and due to other reasons can`t be put on the same server.

The network is a router , a plc and a laptop wired connection all together.

How do you change the remote port? Would this be done on node red or through the Router?

---

<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:** [20 October 2020 13:30 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/4 "2020-10-20T13:30:11Z")

</div>

Provided they have different ip addresses then you shouldn't need to change the port. After configuring them do they show in the node-red editor with different ip addresses?

Please export just the nodes from the image and paste them here (use the `</>` button at the top of the forum text entry window when pasting them).  
Also tell us which modbus nodes you have installed. node-red-contrib-something probably.

---

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [21 October 2020 09:32 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/5 "2020-10-21T09:32:21Z")

</div>

```auto
[{"id":"aaffa8cb.a74e88","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"9675defc.4dfd","type":"modbus-read","z":"aaffa8cb.a74e88","name":"","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"1","dataType":"HoldingRegister","adr":"1","quantity":"10","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"76526e07.93b4f","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":330,"y":180,"wires":[["d58c080b.d153b8"],["de3785a4.64b0f8"]]},{"id":"de3785a4.64b0f8","type":"modbus-response","z":"aaffa8cb.a74e88","name":"","registerShowMax":20,"x":690,"y":280,"wires":[]},{"id":"d58c080b.d153b8","type":"debug","z":"aaffa8cb.a74e88","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":700,"y":180,"wires":[]},{"id":"a74ef96e.e6c018","type":"modbus-read","z":"aaffa8cb.a74e88","name":"","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"2","dataType":"HoldingRegister","adr":"2","quantity":"10","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"3b8ccdee.108082","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":350,"y":420,"wires":[["13f20445.c87edc"],["96d2ddb4.86fd2"]]},{"id":"96d2ddb4.86fd2","type":"modbus-response","z":"aaffa8cb.a74e88","name":"","registerShowMax":20,"x":710,"y":520,"wires":[]},{"id":"13f20445.c87edc","type":"debug","z":"aaffa8cb.a74e88","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":720,"y":420,"wires":[]},{"id":"76526e07.93b4f","type":"modbus-client","z":"","name":"Siemens S7","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.10.101","tcpPort":"503","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":"3b8ccdee.108082","type":"modbus-client","z":"","name":"Siemens S7 Modbus 2","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.10.101","tcpPort":"505","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"2","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]

```

Hi Colin,

Thank you for the response, I set up the same port as suggested yet this still doesnt work. Hopefully you might be able to see any issues in the node?

Best,

Ed

---

<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:** [21 October 2020 09:52 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/6 "2020-10-21T09:52:03Z")

</div>

So you have two servers configured with different ports (503 and 505). So exactly what symptom are you seeing?  
Start node-red in a terminal and run it long enough for the problem to be seen then copy/paste the terminal output here. Paste the text in the same way as for the flow so the forum doesn't mess with it.

---

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [21 October 2020 10:16 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/7 "2020-10-21T10:16:47Z")

</div>

Hi Colin,

Yes so both modbus servers are set up for port 503 and 505 using unit id 1 and 2 respectively.

```auto
Error: {"name":"PortNotOpenError","message":"Port Not Open","errno":"ECONNREFUSED"}

```

The above response is what I get - I`ve tried using a modscan as well to read both registers on the same laptop. It seems that the laptop only allows one read of the serve than two at the same time.

Best,

Ed

---

<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:** [21 October 2020 10:27 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/8 "2020-10-21T10:27:48Z")

</div>

That isn't the error you reported earlier, which you said was to do with the fact you have two servers. This problem is probably that you are running as a user that does not have permission to access those port numbers as numbers less than 1000 are normally reserved for system use. If you change them to ports 1503 and 1505 then that problem should go away.

---

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [21 October 2020 10:40 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/9 "2020-10-21T10:40:12Z")

</div>

I dont think thats the issue. Here is a picture, the below node is reading port 505 with unit ID 2. It still allows me to read them just not simultaneously and not via a different device.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/c/2c2b880c8abf4770836d0444a67292b2d54dec58.png)

Ideally what I`m needing is for both ports to be read at the same time. I`ve tried using a pi to read the port 503 data whilst reading the 505 port data through my laptop and again it really doesnt allow this. I`m getting the impession that only one connection can be made to the server at one time.

Any ideas?

---

<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:** [21 October 2020 10:56 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/10 "2020-10-21T10:56:36Z")

</div>

> [@edwardr](#):
>
> I' ve tried using a pi to read the port 503 data whilst reading the 505 port data through my laptop and again it really doesnt allow this. I`m getting the impession that only one connection can be made to the server at one time.

In that case the problem is nothing to do with node-red but is a problem with the modbus servers themselves.

---

<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:** [21 October 2020 10:57 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/11 "2020-10-21T10:57:50Z")

</div>

You haven't explained why you are using two modbus servers in the first place.

---

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [21 October 2020 10:57 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/12 "2020-10-21T10:57:59Z")

</div>

Well thats what I initially thought but theres nothing to suggest there is an issue with the modbus servers - if you look at the set up pictures above theres really nothing I could suggest as to the problem laying?

---

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [21 October 2020 11:00 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/13 "2020-10-21T11:00:17Z")

</div>

Okay sorry, so basically the project I`m working on relies on two systems assessing the same data via two modbus servers. They both hold the same data in their respected registers but they need to be separate.

Basically, PLC reads data from a device, its put into two register holders for two modbus servers, a raspberry pi needs to connect to one of the servers and then an external device, say a laptop needs to connect to the other modbus server.

Hope that fills you in

---

<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:** [21 October 2020 11:05 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/14 "2020-10-21T11:05:55Z")

</div>

So is the end result to have node-red running on the laptop and the pi, with one talking to one server and the other talking to the second server?

If so then configure that (not both servers on both devices). Then check they both work with the other one stopped.

---

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [21 October 2020 11:18 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/15 "2020-10-21T11:18:17Z")

</div>

Yes thats the situation.

And yes, when one isn`t being used on one device , the other can connect. What I ideally want is both to be connected to each port at the same time.

---

<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:** [21 October 2020 11:24 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/16 "2020-10-21T11:24:28Z")

</div>

Well as I said that must be a problem with the servers. The laptop and pi are not communicating in any way so they don't even know the other one is trying to talk to the other server, so it can't be a node-red issue.  
To prove it run node-red on the pi talking to one server and run a different modbus client on the laptop at the same time talking to the other server.

---

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [21 October 2020 12:13 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/17 "2020-10-21T12:13:22Z")

</div>

Well my thinking was as they were all wired together through ethernet then it maybe an issue with the multiple connections reading together? So in essence they could be talking to each other

---

<div class="post-metadata">

**Author:** ![edwardr](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@edwardr](https://discourse.nodered.org/u/edwardr)\
**Post date:** [21 October 2020 12:14 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/18 "2020-10-21T12:14:03Z")

</div>

Thats exactly what I`ve done and what I`m saying isnt working, ive run one client on the pi, and one of the laptop and neither can work at the same time

---

<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:** [21 October 2020 12:28 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/19 "2020-10-21T12:28:25Z")

</div>

> [@edwardr](#):
>
> Thats exactly what I `ve done `

Not sure what you mean by that. I meant that you use something other than node-red as a client to prove that the issue is not node-red related.

> [@edwardr](#):
>
> as they were all wired together through ethernet then it maybe an issue with the multiple connections reading together?

It isn't that since they have different port numbers and so should not be in any way related (provided the modbus server allows that). That is why you need to check it with something other than node-red to prove to yourself that it is not node-red related.

---

<div class="post-metadata">

**Author:** ![Cristiano](https://avatars.discourse-cdn.com/v4/letter/c/b5e925/32.png) [@Cristiano](https://discourse.nodered.org/u/Cristiano)\
**Post date:** [22 October 2020 01:33 UTC](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498/20 "2020-10-22T01:33:00Z")

</div>

did u try to change the remote port in your DB (plc side) , remote and local they should be the same, active connection should be true.

u are using ob123 it like ob1 or its cycle? every time o adjust the parameters of the modbus (Data block) make o reboot the plc.

this is my example to ...2 modbus devices diff. IP same Port.

 ![cewdcwec](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/d/5db389c5383840f991d6a749aadaa1114fe743a4.png)

why u don't use s7node to connect to the plc and read the data....your plc can work like a gateway

can u make a diagram of the connections/network for we understand better

[Next page](https://discourse.nodered.org/t/multiple-modbus-servers-to-be-read/34498.md?page=2)
