08/19/2022
How-to | Nürni | 10.08.2022

Set up IO-Link Master and IO-Link Sensor and connect it to ctrlX CORE using EtherCAT

Introduction

This guide shows how to operate an IO-Link Master to read acylic process data using ADS over EtherCAT (AoE) and cyclic procress data from an IO-Link sensor with the EtherCAT interface on a real ctrlX CORE.  This application note leads step by step through the whole process, from hardware setup through engineering until testing.

ctrlX AUTOMATION has been designed as an open system. In context of IO-Link this means that it supports any IO-Link master which fulfills the requirements of the EtherCAT specification (ETG.5001) and provides a suitable ESI file.

ctrlX I/O Engineering does not support IO-Link configuration using IO-Link Device Description (IODD) files. Configuration is done via EtherCAT Modular Device Profile (MDP) mechanisms.

In our example we have chosen devices from ifm, but others can be used accordingly.

Prerequisites

Hardware

Following devices will be used in this application note:

  • ctrlX CORE hardware
  • IO-Link Master (ifm AL1930)
  • IO-Link Temperature Sensor (ifm TS2289)
  • IO-Link Signal Converter (ifm TP3231)

Software

Following software must be installed:

  • Rexroth PLC app on the ctrlX CORE
  • Rexroth EtherCAT Master app on the ctrlX CORE
  • ctrlX I/O Engineering and PLC Engineering (parts of ctrlX WORKS)

For operation of Rexroth PLC app and Rexroth EtherCAT Master an adequate software license is required!

Set up a ctrlX I/O Engineering

  1. Open the web based engineering of the ctrlX CORE either via your network folder of Microsoft Windows, from ctrlX WORKS or directly by entering the IP in a web browser and login.
    Open the web based engineering of the ctrlX CORE
     

  2. Open the home bar and start to configure the EtherCAT Master. 
    Open the home bar and start to configure the EtherCAT Master


  3. Add a new EtherCAT Master configuration.
    Add a new EtherCAT Master configuration
     

  4. Select the correct port for the EtherCAT Master at XF 50. In this example the name is “ethercatmaster”.
    Select the port for the EtherCAT Master
     

  5. The system will create the EtherCAT Master. When this is successful, open the ctrlX I/O Engineering by clicking on the corresponding link.
    Open the ctrlX I/O Engineering with the corresponding link
     

  6. Right click on the ethercatmaster and scan for new devices.
    Click on the EtherCAT Master and scan for new devices

  7. The ctrlX CORE will find the ifm IO-Link Master, but the device is unkown, because the ESI File isn´t installed in the device repository of IO Engineering. As long as a slave device is unkown, it can´t be insert to the fieldbus configuration. 
  8. The ESI File can be downloaded from the offical website of the IO-Link Master supplier. 
  9. To install the ESI-File into the the device repository, click in the menu bar on tools and open the device repository.
  10.  Click on Install to add the current IO-Link Master - ESI-File to the device repository.
  11.  Once the installation is completed, the installed device descriptions will be displayed and the device repository can be closed.
    Close device repository after installation is completed


  12.  Scan for new devices again, now the ifm IO-Link Master AL1930 should been detected.
  13.  Click on the “insert all newly scanned devices”-button in order to copy all EtherCAT devices from the control to the project.
    Copy all EtherCAT devices from the control to the project


  14.  Click apply and OK to create the device in the I/O-Project.
    Click apply and OK to create the device in the I/O-Project


  15.  In this example, there is only one sensor connected to channel one of ifm AL1930. Therefore channel one has to be activated by selection of the appropriate process data size. Remaining channels must be deactivated. The process data length and layout can be found in the corresponding data sheet. In case of ifm Signal Converter TP3231, the length is two Bytes.
    If the appropriate process data size can not be found in the selection, the next best fitting (larger) process data size has to be chosen.

  16.  The IO-Link Master channels need to be configured, because in this application only one sensor input is used.
     
    Configure the IO-Link Master channels


  17.  The temperature sensor is connected to channel one. The input process data length is set to 4 bytes. 
    Connect the Temperature Sensor to Channel 1


  18.  The remaining channels will be set to "Deactivate Slot". 
  19.  Once the configuration is completed, click on the “download the fieldbus configuration” button. 
    Download the Fieldbus Configuration


  20.  After the fieldbus configuration is downloaded successfully to the ctrlX CORE, the EtherCAT status should be switched to “OP”. To validate this, you can click on the “EtherCAT” bar to see the current state of the EtherCAT Master and all connected slaves. The fieldbus configuration can now also be seen in the ctrlX CORE Data Layer. 
    Current state of the EtherCAT Master and all connected slaves


  21.  To get the signal from the connected temperature sensor to the PLC, the IO-Link Master must be configured as an IO-Link user, which using the AoE (ADS over EtherCAT) Protocol.  In order to see the AoE-address, open ctrlX I/O Engineering and double left click on ifm IO-Link Master to open the settings. Now activate the expert settings to get access to all adjustments of the IO-Link Master. 
    Activate the expert settings to get access to all adjustments of the IO-Link Master


  22.  Open the AoE tab and automatically AoE is enabled. When AoE is activated, then save the I/O-project and download the configuration to the control and accept the upcoming wizard. The NetID will be important for reading acyclic data with the upcoming PLC program.
    The NetID will be important for reading acyclic data with the upcoming PLC program



Set up a ctrlX PLC Engineering

  1. Open the “Home” bar and click on the “Configure PLC applications” link.

    Open the Home bar and click on the Configure PLC applications link

  2. Initially, there is no PLC program on the ctrlX Core. To create a PLC program, open the ctrlX PLC Engineering via the "Start ctrlX PLC Engineering" button. 

    Start ctrlX PLC Engineering to create a PLC program

  3. In the ctrlX PLC Engineering click in the menu bar on file, then on new project and select standard project. 
  4. When a new standard project is selected, the program will ask you for which device you want to create the project and which programming language for your PLC program should be used. In this example, the device is a real ctrlX Core and structured text (ST) is selected. 
    Create a new standard project


  5. Now the startup project tree looks like in the following picture. 
    Startup Project Tree


  6. To configure the ctrlX CORE Realtime Data right click on DataLayer_Realtime, Edit and then "Online from ctrlX Core".
     
    Configure the ctrlX CORE Realtime Data via DataLayer Realtime


  7. Add the fieldbus realtime data and apply changes. 
    Add the Fieldbus Realtime Data and apply changes


  8. Add the ifm Master AL1930 to the realtime data. 
    Add the ifm Master AL1930 to the Realtime Data


  9.  Add IO-Link channel one and apply changes.
     
    Add IO-Link channel one and apply changes


  10.  The converter unit only provides two bytes of process data. Select channel TxPDO.input_byte_0, TxPDO.input_byte_1 and apply changes.
     
    Select channel TxPDO input byte 0 and input byte 1 and apply changes


  11.  Now the IO-Link Master channel one only shows the configured bytes.
     
    The IO-Link Master channel one only shows the configured bytes


  12.  To be able to publish variables to the ctrlX CORE Data Layer, two things need to be insert to the project. Add a symbol configuration and a global variable list to your application.
     
    Add a Symbol Configuration and a Global Variable List to your Application


  13.  Insert the variables to the GVL and delete the preinsert first line. In this example, one boolean variable "bAcylicExecute", two bytes "ByInputByte0" and "ByInputByte1", one word "PDV1" and one real variable "Temperature" are defined. 
    Insert the variables to the GVL


  14.  The two bytes of the cyclic process data will be divided into two spearated bytes "ByInputByte0" and "ByInputByte1". This two bytes will be joined to an word and then converted into an integer value. The following code will be used to evalutate the acutal temperature and store it in the variable "Temperature". 
    This code will be used to evaluate the actual temperature and store it in the variable Temperature


  15.  At this point of the example, it is possible to get the actual temperature from the sensor. 
    At this point get the actual Temperature from the Sensor


  16.  The variable “bAcyclicExecute” will be used to start the acyclic read of the vendor and the product ID. Set up an example program in the "PLC_PRG" where “strVendor” shows the vendor of the converter unit and "strProductID" shows the Product ID. 

  17.  To run the code on the ctrlX CORE, open the library manager. Press the “Add Library” button. Search for CXA_EthercatMaster and double left click on the “CXA_EthercatMaster” library or press the OK button to add the library to the PLC project. 
    Add the CXA EtherCAT Master Library to the PLC project to run the code on ctrlX CORE


  18.  After integration of the CXA_EthercatMaster library, you can add the program code to read inputs over AoE. In the declaration part of the PLC_PRG some new variables must be added, like in the picture below. 
    Add the program code to read inputs over AoE


  19.  Now the function block needs to be inserted in the PLC program. For easier implementation, the input assistant can be used here.
     
    Use the Input Assistant to insert the Function Block to the PLC Program


  20.  If the user wants to see all IO's of the function block, the check box “insert with arguments” needs to be checked. 
    Check mark the Insert with Arguments box to see all IOs of the Function Block


  21.   This is how it looks like, when all arguments are be insert and the variables are allocated to the IOs.
    • Read vendor of the converter unit 
      Read Vendor of the Converter Unit
    • Read the product ID 
      Read the Product ID
  22.  There are two ways to add these variables to the symbol configuration:
    • Execute a “Build” and tick the variables you like
    • Add a pragma to the global variable list that causes all variables in this list to be published 
      Add Variables to the Symbol Configuration
  23.  The communication settings are set automatically by default, so it is possible to directly log into the control. In order to inspect the settings, double click on the target on the left hand side.

  24.  A security warning will be displayed because the certificate for the communication is self-signed and thus not provided by an official certificate authority. Please go on logging in with your user and password available on the control and download the created project.

  25.  The application is started via the play button in the top menu bar or alternatively by right clicking on "Application" and press "Start".
    Start Application


  26.  Now variables can be manipulated in your program PLC_PRG. To manipulate the the value of bAcyclicExecute double left click on it in the PLC_PRG and then press "CTRL + F7" or alternatively use the "Write Values" in the "Debug" menu bar to change between true and false.

    Use the Write Values in the Debug menu bar to change the Variables between true and false


  27.  To check the data in the ctrlX Data Layer, open the viewer via the link in the "Settings" bar in the web interface of your ctrlX CORE. There the variables are visible and changeable. Please refresh the view with the small button on right if the values are static. 

    Open Settings in the Web Interface of ctrlX CORE to view ctrlX Data Layer

3

Latest published/updated articles

Types
How-to
Categories
IO
PLC