Configure EK9160 under TC3 as IoT MQTT Device
TC3 provides two I/O devices, the “IoT MQTT Controller” and “IoT MQTT Device”, which can be used to establish an MQTT-based communication connection. This makes it very easy to configure the EK9160 as an IoT MQTT device for a TC3 runtime. The advantage is that the EK9160 can make the process data of the EtherCAT slaves available to the TwinCAT user program via a standard TCP/IP network.

The following diagram shows possible application scenarios. This type of communication link enables both TwinCAT systems to be coupled to each other and TwinCAT to be coupled to one or more EK9160s.

For an "IoT MQTT Device", symbol information for all configured variables in the process image is stored on the message broker in a specific topic. An "IoT MQTT Controller" then has the ability to scan this symbol information and create matching variables in its own process image. The EK9160 is automatically always an "IoT MQTT Device".
EK9160 configuration
The EK9160 is automatically configured as an "IoT MQTT Device" in the background as soon as the device is configured to connect to an MQTT message broker. As a prerequisite, "Binary" must be selected as the data format and retain messages must be activated. The following screenshot shows the corresponding section of the EK9160 configuration web page.

All I/O terminals have been activated for the communication connection with the message broker. The following screenshot shows an example of this process on the configuration interface.

Notice | |
Do not use umlauts in the identifiers! If you are using TwinCAT as an IoT MQTT Controller, switch the language setting to English or change the "ä" to "ae" in designations such as "inputs" or "outputs", as some MQTT brokers do not accept umlauts. |
![]() | TwinCAT as „IoT MQTT Device“ In addition to the EK9160, TwinCAT itself can also act as an "IoT MQTT Device". In this case, the corresponding configuration steps must be carried out via the TwinCAT I/O area in TwinCAT XAE. The "IoT MQTT Device" then behaves identically to the EK9160 with regard to the further process. |
Configuration in TwinCAT
In order for TwinCAT to be able to process the symbol information and process values from the EK9160, an "IoT MQTT Controller" must be created in the I/O area of TwinCAT XAE and configured for the connection with the message broker. It is important that the fields "Main Topic", "Device" and "Stream" match the configuration of the EK9160. The following screenshot illustrates this process.


Publishers and Subscribers can then be created below the "IoT MQTT Controller", depending on whether you want to scan the output or input terminals. Input terminals are operated via the "Publisher" and output terminals via the "Subscriber".


Subsequently, the symbol information can be read out via a scan mechanism and corresponding input/output variables can be automatically created in the process image of the device.

Result (taking the subscriber as an example):

Further information
After the configuration has been activated on the EK9160, three topics below the configured "Main Topic" are used on the message broker:
- The Symbol Topic contains the symbol information for the connected I/O terminals and is filled by the EK9160 after the communication connection with the message broker has been established.
- The Description Topic contains general status information about the device and is filled by the EK9160 after the communication connection with the message broker has been established.
- The Data Topic contains the pure process data of the connected I/O terminals. This topic is thus cyclically filled with data by the EK9160.
The following screenshot shows a section of the Mosquitto Message Broker in verbose mode, on which you can see the individual publishes of the EK9160 on the above-mentioned topics.
