# Siemens 1200 plc to node red (TCP)

**URL:** <https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949>\
**Category:** Industrial\
**Created:** [9 December 2022 23:08 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949 "2022-12-09T23:08:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![htsimp](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@htsimp](https://discourse.nodered.org/u/htsimp)\
**Post date:** [9 December 2022 23:08 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949/1 "2022-12-09T23:08:49Z")

</div>

I am trying to communicate with a Siemens 1212 PLC using the open TCP blocks. On the node red side I have a TCP in (Port 2000) tied to a debug node. Additionally I have an inject tied to the TCP out node on port 2001.  
On the PLC side I have it set to "active" communication to node red (port 2000). The receive from Node red is a passive connection (port 2001).  
In my flow I have a "connect" indication and can send data from the PLC to node red. On the node red side, on the send (NR -\> PLC) it shows a red box and "disconnected".

Is there something I am missing with the TCP out node that would otherwise force it to create an "active" connection with the PLC? Ive tried the same flow to another VM running a separate flow. All connected fine in both directions. This has been driving me crazy for a week and a half now. Ive tried every conceivable adjustment on the PLC side. Any suggestions on the NR side of things? I need to be able to do this as straight TCP and not with something like Modbus, S7, or MQTT.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [10 December 2022 15:03 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949/2 "2022-12-10T15:03:20Z")

</div>

Why not use the [`node-red-contrib-s7`](https://www.npmjs.com/package/node-red-contrib-s7) which works great?

---

<div class="post-metadata">

**Author:** ![htsimp](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@htsimp](https://discourse.nodered.org/u/htsimp)\
**Post date:** [10 December 2022 16:45 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949/3 "2022-12-10T16:45:06Z")

</div>

Eventually I must communicate with a DB (in or out of Node red). Because of this I need to figure out straight open TCP comms. I already tested MQTT and Im sure that S7 or Modbus would work but I will need straight TCP.

---

<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:** [10 December 2022 17:04 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949/4 "2022-12-10T17:04:39Z")

</div>

> [@htsimp](#):
>
> Eventually I must communicate with a DB (in or out of Node red). Because of this I need to figure out straight open TCP comms.

What db type is it that needs TCP?

---

<div class="post-metadata">

**Author:** ![htsimp](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@htsimp](https://discourse.nodered.org/u/htsimp)\
**Post date:** [12 December 2022 01:34 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949/5 "2022-12-12T01:34:34Z")

</div>

I should have been clearer. DB = Data Base not an S7 data block. Preformed telegrams to the data base interface.

---

<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:** [12 December 2022 09:37 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949/6 "2022-12-12T09:37:28Z")

</div>

> [@htsimp](#):
>
> DB = Data Base

I assumed that is what you meant. Most databases types have node-red nodes to drive them, and those that don't should not require dropping down to the TCP level.

---

<div class="post-metadata">

**Author:** ![htsimp](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@htsimp](https://discourse.nodered.org/u/htsimp)\
**Post date:** [12 December 2022 18:30 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949/7 "2022-12-12T18:30:28Z")

</div>

Finally found the problem on the Siemens side. Wrong connection structure is given for TCON in the help file. Now communicating open TCP in both directions.

---

<div class="post-metadata">

**Author:** ![KarolisL](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@KarolisL](https://discourse.nodered.org/u/KarolisL)\
**Post date:** [11 January 2023 11:36 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949/8 "2023-01-11T11:36:25Z")

</div>

Can you share a link to the Siemens forum which helped you and share your flows?

---

<div class="post-metadata">

**Author:** ![htsimp](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@htsimp](https://discourse.nodered.org/u/htsimp)\
**Post date:** [11 January 2023 14:24 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949/9 "2023-01-11T14:24:13Z")

</div>

> **[S7-1200 Open TCP problem (TCON) - 291808 - Industry Support Siemens](https://support.industry.siemens.com/forum/WW/en/posts/s7-1200-open-tcp-problem-tcon/291808?page=1&pageSize=10)**
>
> Duris,Thank you but what you sent also did not work. Again it seemed as if I hit some sort of firewall trying to come in to the other PLC. For the time being I abandoned trying to communicate between the 2 PLC's as my real goal is 1200 - Node Red.

Here is the thread I ran on the Siemens forum to find the answer from that end. I found the problem was the wrong system data type for TCON.

I dont know how to export / import a flow (but would welcome an explanation). In light of that here is the graphical view.

As a side note, I also had MQTT working at one point between 1200 and NR

 ![tcp flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/c/8c295ea1c83179e9ca29ebff4f4c97ead82f6612.png)

---

<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:** [12 March 2023 14:25 UTC](https://discourse.nodered.org/t/siemens-1200-plc-to-node-red-tcp/71949/10 "2023-03-12T14:25:01Z")

</div>

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