Skip to content

EtherNet/IP

Introduction

EtherNet/IP (Ethernet Industrial Protocol) is a widely used industrial network protocol designed for real-time control and information exchange in automation systems. It is based on the standard Ethernet and TCP/IP protocols, providing seamless integration with existing IT infrastructure. EtherNet/IP enables devices such as programmable logic controllers (PLCs), sensors, actuators, and human-machine interfaces (HMIs) to communicate efficiently and reliably in industrial environments.

Ethernet/IP connector enables communication with EthernetIP devices. It reads values from these devices and posts them to Coreflux Central, an MQTT broker. Additionally, it can receive data from Coreflux Central and relay it back to the EthernetIP devices, facilitating a bidirectional data flow.

Features and Benefits

  • Seamless Communication: Facilitates smooth and efficient data exchange between EthernetIP PLCs and your data hub;
  • Real-time Monitoring: Provides instant visibility into the status and performance of EthernetIP PLCs;
  • Easy Integration: Simplifies the process of incorporating EthernetIP PLCs into your IIoT projects;
  • Bidirectional data flow: This feature enables users to access and modify all readable and writable values on the device, ensuring seamless interaction and control over device data;
  • Explicit Communication Support: This connector only supports explicit communication, ensuring reliable and controlled data exchange with EthernetIP devices.

Prerequisites

Before you install and configure the connector, make sure you have the following prerequisites:

  • Basic understanding of the MQTT protocol;
  • Basic undertstanding of EthernetIP protocol;
  • Coreflux account;
  • Coreflux 1.3 MQTT broker;
  • MQTT Client (such as MQTT Explorer);
  • An EthernetIP device (PLC for example).

Connector installation

Using Coreflux HUB

Please refer to the general docs for connector installation through the Coreflux HUB.

Using Coreflux HUBLESS

Connector management and control are conducted using the MQTT protocol. Commands (payload) are sent to the $SYS/Coreflux/Command topic. The results of these commands are published to $SYS/Coreflux/Command/Output. The following steps will focus solely on the payload that needs to be sent.

  1. Connect to the Coreflux MQTT Broker using your preferred client.
  2. Login using your coreflux account:
    -L myname@mydomain.com password`
    
  3. Check your available connectors:
    -l
    
  4. Install connector:
    -I coreflux_ethernetipmqtt
    
  5. If there were no issues during the installation you should receive a message on the $SYS/Coreflux/Command/Output:
    Your coreflux_ethernetipmqtt was installed with version <version> with the <asset_guid>. Let the magic begin! 
    

Connector configuration

Before using the connector, it must be properly configured. This configuration process entails adjusting various parameters that affect its functionality, the setup of the device, and how they interact with each other. This involves specifying the device's IP address and selecting the class, instance, and attribute to be manipulated, among other settings. The configuration is detailed in a JSON file, divided into three main sections: MQTT Parameters, EthernetIP Parameters and Tags Parameters.
The instructions below will guide you through configuring each section.
By the end, you will have a comprehensive example configuration that can be tailored to your specific needs.

⚠ Warning: If a parameter is not included in your connector's configuration and it is not required, a default value will be applied. Incorrect configuration may cause the connector to not work as intended.

ℹ : This configuration is presented using a hubless setup as an example. The key takeaway is the understanding of the parameters and their significance. If you are configuring the connector via Coreflux Hub, the same parameters and configurations apply.

MQTT Parameters

The MQTTParameters in the JSON configuration define how to connect to an MQTT broker, specifying the communication details. The Address and Port indicate the broker's network location (in this case, 127.0.0.1 on port 1883), which is where the data will be sent to or received from. The parameters also detail authentication methods and the use of TLS for secure communication. This setup determines the pathway for data exchange between the device and the MQTT broker, facilitating the monitoring or control of device operations.

Parameter Description Required Example Default Value
Port Port number on which the MQTT broker is running. Yes 1883 1883
Address IP address or hostname of the MQTT broker. Yes "127.0.0.1" "127.0.0.1"
IsAnonymous Indicates if the connection is anonymous (no username/password required). Yes true true
Username Username for authentication, if not anonymous. No "" ""
Password Password for authentication, if not anonymous. No "" ""
EnableTLS Specifies whether TLS encryption is enabled for secure communication. No true false

Example:

{
  "MQTTParameters": {
    "Port": 1883,
    "Address": "127.0.0.1",
    "IsAnonymous": true,
    "Username": "",
    "Password": "",
    "EnableTLS": false
  }
}

EthernetIP Parameters

The EthernetIPParameters in the JSON configuration specify the setup for Ethernet/IP communication between a local system and a target device. These parameters are essential for facilitating data exchange using the Ethernet/IP protocol. The configuration includes the target device's IP address and port for establishing the connection. The PollingMs parameter defines the frequency of data polling, ensuring timely updates.

Parameter Description Required Example Default Value
Ip Specify the IP address of the EthernetIP device. Yes "192.168.0.52" "127.0.0.1"
PortEthernet Define a port for the EthernetIP device. No 44818 44818
PollingMs Set the polling rate for reading in milliseconds. Yes 750 500

Example:

{
  "MQTTParameters": {
    "Port": 1883,
    "Address": "127.0.0.1",
    "IsAnonymous": true,
    "Username": "",
    "Password": "",
    "EnableTLS": false
  },
  "EthernetIPParameters": {
    "Ip": "192.168.0.52",
    "PortEthernet": 44818,
    "PollingMs": 750
  }
}

Tags

Tags serve as the bridge between the Ethernet IP devices variables and the MQTT topics within your system. Each Tag represents a specific connection point, linking a data element in Class/Instance/Attribute to a topic on the MQTT broker. Each Tag in your array of Tags encapsulates the necessary details for this data exchange, including parameters related to both the PLC device (such as the data type and trigger conditions) and the MQTT protocol (such as the topic, quality of service, and retain flag).

ℹ : Tags array is not required in the configuration, if it is not included in the configuration, the connector will still run.

Parameter Description Required Example Default Value
Name Unique Tag Identifier Yes "RoomTemperature" "TagName"
Route Specifies the direction of data flow within the system.
Acceptable values are: 'ToSubscribers' (0), 'ToOther' (1).
Yes 0 1
Publish Choose how data is sent.
Acceptable values are: 'Update' (0), 'Cyclic' (1), 'Once' (2)
Yes 0 2
PublishCycle Specifies the interval for publishing messages when 'publish' is set to 'Cyclic'.
Must be a value between 1 and 86,400 seconds (24 hours).
No 500 1
MqttTopic Unique Topic connecting with the specified Register Yes "room/temp" "mqtt/topic"
MqttRetain Defines if the message should be retained.
Options are: true or false.
Yes true false
QualityOfService Defines the level of delivery assurance for MQTT messages.
The options are: 'AtMostOnce' (0), 'AtLeastOnce' (1), 'ExactlyOnce' (1).
Yes 2 2
DataType Defines data type to read/write. Options are: 0 - 10 (Check the table) Yes 6 0
ClassID Represents the class or type of an object in the Ethernet/IP network. It specifies the category or group to which the object belongs. Yes 4 0
InstanceID A unique identifier that specifies an individual instance of an object within a particular class in the Ethernet/IP network. Yes 100 0
AttributeID A numerical value that represents a specific attribute or property associated with an object in the Ethernet/IP network. Yes 1 0
AttributeIndex Define the Attribute index where values must be written or read. Range (0-127) Yes 0 0
EnableJoinAttribute Concatenate the attributes defined by “AttributeID” and “JoinAttributeID”. Options are: true or false. No true false
Length Define the length in bytes to be written to or read from the Ethernet/IP device.
⚠️ Use this only for string data type and if Join is enable.
No 10 1
Bit When using the Boolean data type, this specifies the bit from the AttributeIndex to be written to or read from the Ethernet/IP device. Options to send/receive values are: 0 (false) or 1 (true). No 2 (LSB order) 0
JoinClassID Class or type of the second object in the Ethernet/IP network. It specifies the category or group to which the object belongs. No 120 0
JoinInstanceID A unique identifier that specifies the individual instance of the second object within a particular class in the Ethernet/IP network. No 100 0
JoinAttributeID Specific attribute or property associated with the second object in the Ethernet/IP network. No 3 0
JoinIndex Specify the Join index for reading or writing values. No 50 0
JoinLength Specify the byte length for reading from or writing to the Ethernet/IP device. ⚠️ This is mandatory when using Join. Ensure the total length (Length + JoinLength) matches the byte count of the selected data type. No 4 1
ClearNull When reading string data types, display or remove 'null' characters in the MQTT Client from the string No true false

Example:

{
  "MQTTParameters": {
    "Port": 1883,
    "Address": "127.0.0.1",
    "IsAnonymous": true,
    "Username": "",
    "Password": "",
    "EnableTLS": false
  },
  "EthernetIPParameters": {
    "IP": "192.168.0.52",
    "PortEthernet": 44818,
    "PollingMs": 750
  },
  "Tags": [
    {
      "Name": "outputExample",
      "Route": 1,
      "MqttTopic": "Send/to/MasterEthernetIP",
      "QualityOfService": 0,
      "Publish" : 2,
      "MqttRetain": false,
      "DataType": 0,
      "ClassID": 4,
      "InstanceID": 100,
      "AttributeID": 3,
      "AttributeIndex": 7,
      "Bit": 0,
      "EnableJoinAttribute": false
    },
    {
      "Name": "inputExample",
      "Route": 0,
      "MqttTopic": "Received/from/MasterEthernetIP",
      "QualityOfService": 0,
      "Publish" : 2,
      "MqttRetain": false,
      "DataType": 11,
      "ClassID": 4,
      "InstanceID": 100,
      "AttributeID": 3,
      "AttributeIndex": 11,
      "Length": 5,
      "EnableJoinAttribute": false,
      "ClearNull": true
    },
    {
      "Name": "JoinExample",
      "Route": 0,
      "MqttTopic": "Send2/to/MasterEthernetIP",
      "QualityOfService": 0,
      "Publish" : 2,
      "MqttRetain": false,
      "DataType": 6, 
      "ClassID": 4,
      "InstanceID": 100,
      "AttributeID": 3,
      "AttributeIndex": 50,
      "Length": 3,
      "EnableJoinAttribute": true,
      "JoinClassID": 15,
      "JoinInstanceID": 125 ,
      "JoinAttributeID": 3,
      "JoinIndex": 0,
      "JoinLength": 5
    }
  ]
}

Tag Data Types

This section outlines the various data types used within the system, which are named and structured to mirror the data types found in the corresponding devices. This naming convention ensures a more intuitive and direct mapping of data types from the devices to our system, facilitating easier data handling and integration. Understanding these data types is crucial for effective communication and data manipulation in the system.

Data Type - Integer Value Description Memory Space Lower Bound Upper Bound
Boolean - 0 Set a specific Bit to: 0 (false) or 1 (true). 1 bits FALSE (0) TRUE (1)
Byte - 1 The value to be read from or written to the AttributeIndex must be a valid byte. 8 0 255
INT16 - 2 Signed 16-bit integer. 16 bits -32768 32767
UINT16 - 3 Unsigned 16-bit integer. 16 bits 0 65535
INT32 - 4 Signed 32-bit integer. 32 bits -2147483648 2147483647
UINT32 - 5 Unsigned 32-bit integer. 32 bits 0 4294967295
INT64 - 6 Signed 64-bit integer. 64 bits -2^63 2^63-1
UINT64 - 7 Unsigned 64-bit integer. 64 bits 0 2^64-1
Float32 - 8 32-bit floating point number. 32 -3.402823e+38 3.402823e+38
Float64 - 9 64-bit floating point number (double). 64 bits -1.7976931348623158e+308 1.7976931348623158e+308
ASCII - 10 Will convert the AttributeIndex value to an ASCII character. 1 bit 0 255
String - 11 Strings of characters. In the Tag configuration must set the Length of the string. Variable N/A N/A

Saving the configuration

Connector management and control are conducted using the MQTT protocol. Commands (MQTT payload) are sent to the $SYS/Coreflux/Command topic. The results of these commands are published to $SYS/Coreflux/Command/Output. The following steps will focus solely on the payload that needs to be sent.

ℹ : Configuration requires the user to be logged in and have a connector installed. If these requirements are not met, please refer to the installation section.

  1. Save configuration:
    -assetConfigSave <asset_guid or assetName> <configuration>`
    

    ℹ : The connector's asset_guid can be obtained by consulting the $SYS/Coreflux/Assets topic.

Example:

-assetConfigSave assetName {
    "MQTTParameters": {
      "Port": 1883,
      "Address": "127.0.0.1",
      "IsAnonymous": true,
      "Username": "",
      "Password": "",
      "EnableTLS": false
  },
  "EthernetIPParameters": {
    "IP": "192.168.0.52",
    "PortEthernet": 44818,
    "PollingMs": 750
  },
  "Tags": [
      {
      "Name": "outputExample",
      "Route": 0,
      "MqttTopic": "Send/to/MasterEthernetIP",
      "QualityOfService": 0,
      "Publish" : 2,
      "MqttRetain": false,
      "DataType": 0,
      "ClassID": 4,
      "InstanceID": 100,
      "AttributeID": 3,
      "AttributeIndex": 7,
      "Bit": 0,
      "EnableJoinAttribute": false
    }
  ]
}
  1. Check if the configuration was saved (optional) :
    -assetConfigLoad <asset_guid>
    

ℹ : Find more detailed information about the connector management here.

Configuration Reference

A comprehensive source for detailed information on connector parameters and their interactions.

Using the connector

⚠ Warning: It is important to understand that the flow of data between the broker and the device highly depends on the configuration of both the connector and the device. In case of unexpected results, please verify the configuration and/or check the logs for any possible errors.

With Coreflux HUB

Please refer to the general docs for connector installation through the Coreflux HUB.

With Coreflux HUBLESS

Connector management and control are conducted using the MQTT protocol. Commands (MQTT payload) are sent to the $SYS/Coreflux/Command topic. The results of these commands are published to $SYS/Coreflux/Command/Output. The following steps will focus solely on the payload that needs to be sent.

ℹ : The connector's guid can be obtained by consulting the $SYS/Coreflux/Assets topic.

Run connector

  1. Run connector:
-R <asset_guid>

Stop connector

  1. Stop connector:
-S <asset_guid>

⚠ Warning: To update the connector configuration, ensure you stop it first to avoid issues. After making the changes, restart the connector to apply the new configuration.

Logs

Logs are essential for monitoring and debugging your system. They provide insight into the operation of your connectors and can help identify and resolve issues promptly.

With Coreflux HUB

On Coreflux HUB, the logs are displayed in the "Log" section of the connector configuration.

With MQTT Explorer

To display logs in MQTT Explorer, follow these steps:

  1. Publish the following command to the $SYS/Coreflux/Command topic:

-addTraceLog topic=topic/to/show/log level=Error/Information/Warning messageContains=(assetID)
2. The logs will be shown on the $SYS/Coreflux/Log/Traces/topic/to/show/log topic.

Example1:

To display informational logs, use:

-addTraceLog topic=log/inf level=Information

Note : This will display the Logs "Information" of all the connectors

Example2:

To display error logs, from a specific connector, use:

-addTraceLog topic=log/ethernetip/err level=Error messageContains=assetID

Note : This will display the Logs "Error" of a specific connector

Note: To display all three types of logs (Error, Information, and Warning), you will need to repeat this process three times, one for each log level.