# How to inject a payload using a PLC

**URL:** <https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160>\
**Category:** General\
**Created:** [8 August 2018 15:38 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160 "2018-08-08T15:38:15Z")\
**Posts on this page:** 11\
**Page:** 2

<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 August 2018 10:02 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/21 "2018-08-10T10:02:26Z")

</div>

Do you know why that did not work? If it should work but doesn't then I would first find out why it doesn't work. First I suggest trying it running node-red on a PC to communicate with the PLC. Then when you have got that going move it to the concentrator.

---

<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 August 2018 10:06 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/22 "2018-08-10T10:06:16Z")

</div>

> [@AlxOndahidr](#):
>
> I connected the PLC to the concentrator via Ethernet

I assume by that that you mean you connected them both to the router on our local network. Not that you connected an ethernet cable between them.

---

<div class="post-metadata">

**Author:** ![AlxOndahidr](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AlxOndahidr](https://discourse.nodered.org/u/AlxOndahidr)\
**Post date:** [10 August 2018 14:02 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/23 "2018-08-10T14:02:25Z")

</div>

Hi @Colin,

I've tried first running the NodeRed from the PC and triying to communicate with a TCP/IP emulator working as an slave. Since I have Nodered in the PC I can install more blocks and I tried with Modbusplc blocks. reading from the configuration of the plc emulator and is not working.

I've checked the ip's and all the configuration several times and it can't read anything.

I've tried also sending from nodered to the PLC.

I attach some pictures

 ![pic1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1a957d16c3e30312f5391a0287fe324fbe8b47ee.png)

---

<div class="post-metadata">

**Author:** ![AlxOndahidr](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AlxOndahidr](https://discourse.nodered.org/u/AlxOndahidr)\
**Post date:** [10 August 2018 14:02 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/24 "2018-08-10T14:02:57Z")

</div>

And here goes the configuration of the readings

 ![pic2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3019c3b5ad20b37ae75aa126791dc03e8c8a3db7.png)

---

<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 August 2018 14:58 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/25 "2018-08-10T14:58:46Z")

</div>

You should have the IP address of the PLC as the server.

---

<div class="post-metadata">

**Author:** ![AlxOndahidr](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AlxOndahidr](https://discourse.nodered.org/u/AlxOndahidr)\
**Post date:** [10 August 2018 15:09 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/26 "2018-08-10T15:09:30Z")

</div>

Yes, I am using the IP of the PLC I got in the emulator

![PlcConfig](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e26ed1880aa6d36fa3c93214bf1bad4365c8219d.png)

---

<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 August 2018 15:29 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/27 "2018-08-10T15:29:43Z")

</div>

I don't know why you are bothering with an emulator, why not just get it going in the PLC?

However, show us the config of the server in node red (click on the pen next to the server field).

---

<div class="post-metadata">

**Author:** ![AlxOndahidr](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AlxOndahidr](https://discourse.nodered.org/u/AlxOndahidr)\
**Post date:** [10 August 2018 15:35 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/28 "2018-08-10T15:35:45Z")

</div>

![Captura](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/214208e5b798fa1a1f3da0f130cc5a2a4481aa12.png)

---

<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 August 2018 15:57 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/29 "2018-08-10T15:57:27Z")

</div>

Presumably your simulator has some sort of log that may show why it is not connecting. Also look in the node red log to see if there is anything there.

But as I said, personally I wouldn't worry about trying to debug the simulator.

---

<div class="post-metadata">

**Author:** ![AlxOndahidr](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@AlxOndahidr](https://discourse.nodered.org/u/AlxOndahidr)\
**Post date:** [24 August 2018 05:22 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/30 "2018-08-24T05:22:27Z")

</div>

Hi everyone.

Thank you for your responses. I could make it work. I connect my Conduit via Ethernet and I made a bridge on it pointing to my LAN. My PLC and my Weintek are also connected to that LAN

In the NodeRed part I used the module TCP using the port 4000 (below 1000 didn't work)

Regards

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [24 August 2018 08:32 UTC](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160/31 "2018-08-24T08:32:07Z")

</div>

> [@AlxOndahidr](#):
>
> I used the module TCP using the port 4000 (below 1000 didn't work)

Port numbers below 1024 are usually reserved and unusable for us normal folk.

[Previous page](https://discourse.nodered.org/t/how-to-inject-a-payload-using-a-plc/2160.md?page=1)
