Search code examples
linuxtwincatethercat

EtherCat module :How to communicate with linux


I'am going to communicate EtherCAT master(CX2020) with Linux OS PC(ubuntu) for storing value from PLC on server and writing also.

By EthearCAT network protcol, it should be availave to communicate with windows plc installed twincat.

But I couldn't find the way for Linux.

Is there any solution?


Solution

  • There are various ways for you to communicate with a CX2020 from Linux, it all depends on your requirements and what the usage is for.

    Without knowing anything about those, one option is to use the Beckhoff ADS protocol. All Beckhoff PLCs have by default ADS installed on them and you can (with the right credentials setup for ADS) communicate with the ADS-library. The good thing about ADS is that it is open-source, and thus it's possible to get the code for Linux.

    The ADS sourcecode is available at: https://github.com/Beckhoff/ADS

    You basically need to:

    1. Compile/Install the library on your Linux machine
    2. Create an ADS/AMS-route to your CX2020
    3. Create a program that uses this route to communicate with the PLC With ADS you can access the variables directly in the CX2020 memory (both read and write!).

    There are many finished wrapper libraries available for all common programming languages that you can use directly in Linux. If you're up to Python, I would recommend checking out PyADS (https://github.com/stlehmann/pyads), which has a good user base and many examples available all around the net.