cyberdrag

Control Melsec-FX-5U over internet in realtime

9 posts in this topic

Hi All,

I'm new to using PLC, and my background is majorly programming.

I am learning how to control a PLC over the internet using HTTP or TCP/IP.

I have a Mitsubishi PLC Melsec FX-5U 32MR and my requirement is, I want to send create a setup where the PLC works more like a Client on the network and reads values from the server (which is a computer). The outputs on the PLC are controlled by the values on the database in server. 

So, lets assume I have a value like this on the server "1,0,0,1,0,1", it should translate like below:

  1. Y0 = 1
  2. Y1 = 0
  3. Y2 = 0
  4. Y3 = 1
  5. Y4 = 0
  6. Y5 = 1

Is there any guidance where I can read through and learn how to do this. I would prefer doing it by ST programming and not Ladder.

Share this post


Link to post
Share on other sites

There's nothing you can do in ST you cannot also do in ladder.  Both have the same capabilities.

That being said, I am not familiar with a way to talk to FX5 over HTTP.  Sounds like what you really want is Ethernet based I/O you can control from a PC, not a PLC.

Share this post


Link to post
Share on other sites

If it is not in the environment of the Internet, Kepserver can be used as the middleware, and the PC can read and write data to PLC in OPCUA protocol, but OPCUA is not suitable for Internet.

If the HTTP protocol is used, the communication middleware LECPServer is recommended, and the usage method is as follows.

http://www.lecpserver.com:3001/#/node_read_write

The key code is as follows

$.post("http://lecpserver_url:port",{"action":"plc_read_node", "node":"NODES.PanMC.X0000"}, function(success, rtval){
   // return the data of node address X0000
	console.log(success, rtval);
});

 

Edited by xeden3

Share this post


Link to post
Share on other sites
9 hours ago, xeden3 said:

but OPCUA is not suitable for Internet.

Simply not true.  OPC/UA supports high-quality encryption and authentication, and its report-by-exception architecture is bandwidth efficient.

Some OPC server implementations may skimp on these features, but the ones from major brands certainly have them, including Kepware.

The only real weakness in the OPC/UA model for internet use is the need for subscribers to be able to route to servers to make the connections.  NAT-friendly reverse connections are not in the OPC/UA specification.  But then, all of the base protocols for PLC suffer from this, and it appears that LECPServer doesn't solve it, either.  MQTT and similar brokered protocols exist for this reason.

Or that problem can be solved with VPN techologies, for all of the above.

Share this post


Link to post
Share on other sites

Pturmel thank you very much for your reply .. :P:-)

What you stated is very correct. I would like to make up three points for the problems I encountered in the project.

1. OPCUA needs to verify each connection

2. OPCUA is based on long connection, and it is likely to be abnormal when the network is unstable. (When using Kepserver 6.6/6.5/6.4, the short connection can easily crash Kepserver. This has been confirmed by the official. Of course, this problem has been fixed in version 6.9.)

3. OPCUA protocol packet is much larger than HTTP 

We have a project that uses LECPServer as a gateway, and then the LECPServer server is directly connected to the external network, other remote browser can directly read and write PLC data under the LECPServer through the Internet environment.

Edited by xeden3

Share this post


Link to post
Share on other sites

Mr. Pturmel

Thank you very much for your evaluation of LECPServer.

If you have any suggestions for LECPServer, I hope to hear that.

THX :-D

Share this post


Link to post
Share on other sites
2 hours ago, xeden3 said:

you have any suggestions

Start a new topic in the appropriate category.  I'll be happy to offer my 2¢.

Share this post


Link to post
Share on other sites

Basically, you want a remote access to your PLC through internet?

Try go search for MCWorks and MXConfigurator.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now