invanos
Hi Thiago,
Please let me express my appreciation and gratitude to your successful OpenPLC Project. I have been using this for my teaching facilities on PLC programing. I have installed them on several VMS, which the students enjoy connecting their Factory IO to them via Modbus protocol. This VM machines are sit at the back of router, which all the IPs are forwarded through this router. Using this port forwarding, every OpenPLC may be accessed using the same IP (router’s IP), but on a different port.

In the next move, I need to connect several ESP8266s as a slaves (remote IO) to this OpenPLC. It is unfortunate that the port setting of ESP8266 in the OpenPLC is fixed at 502. My case is that every ESP8266 has to be connected to the same router’s IP with a different port.

Is there any chance to change the port number in OpenPLC setting?
If it is the case, how should I do it?

Thank you for your kind response, it is highly appreciated.
Regard,
Invanos
Reply 0 0
thiagoralves
Hi @invanos,
In this case you have two options:
1. Connect all ESPs to the same network as the OpenPLC VMs (in front of the router) so that each ESP can connect directly to its own OpenPLC instance. No modification is necessary on OpenPLC code in this case.
2. Modify OpenPLC firmware for the ESP so that it will accept connections from different ports. This would be a much harder job. Firmware files are located in /editor/arduino/src

I guess there is also a third option you might consider:
3. Use ESPs as the PLC, instead as slave devices. I don't know the approach you're using to teach, but ESP has a very capable hardware and should be able to connect to Factory IO the same way as your OpenPLC VMs. This would give a more realistic view of a PLC as a device with limited amounts of RAM and processing.

In any case, I'm happy to know that OpenPLC is being so useful for you and your students. Thank you for your kind words. You can always help OpenPLC improve by joining our Patreon here: https://www.patreon.com/openplc
Reply 0 0
invanos
Hi Thiago,
Thank you for your immediate reply.
In order to make the network simpler, I have changed the scenario, which I put ESP8266 in the same IP segment as the OpenPLC server. In this case, it does not need any IP port forwarding, in such away that is possible to use IP port 502.

It works fine!

On the other hand, a problem was occurred at ESP8266 GPIO D4-D7 Input port. I have difficulty of reading them. There was no problem with GPIO D0-D3 output port. This output could be read by a widget of Modbus in the Node-red. The address was set at the 800, as it was at %QX100.0 - %QX100.7

I assume that the address of GPIO input port, which is %IX100.0 - %IX100.7, uses the same address as the GPIO output port at 800. Or otherwise, I made a wrong assumption.

Do you have any suggestion regarding the above problem?

Again, your response is highly appreciated
Reply 0 0
thiagoralves
If you set up your slave device correctly, you should be able to read the inputs at address 800. Just make sure you use read input status, not read coils, as coils are always mapped to the QX address space.
Reply 0 0
invanos
Wow…!
What a silly me…🙈
Now I have changed the FC code from FC5 (read coil ) to FC6 (read input status). Everything is working..!
Thank you for your advise .
Reply 0 0
Reply