Publish data to AWS IoT Core

The following section describes step-by-step how to use the configurator to sample data from a TwinCAT 3 PLC runtime and to publish it to AWS IoT by using a JSON data format.

Configure ADS gate, channel and symbols

Follow the step-by-step instructions to create an ADS gate and a subscriber channel and add symbols to the channel’s configuration.

The topology view is activated.
1. Right-click the canvas and select Add Gate (ADS).
2. Select the new gate and configure ADS specific settings in the properties window (AmsNetId, AdsPort, …).
3. Right-click the new gate and select Add Channel (Subscriber).
4. Select the new channel and set “SamplingMode” to “Cyclic”. Leave all other fields on their default settings.
5. Open the Target Browser.
6. Navigate to the ADS device and add some symbols to the configuration by dragging them to the subscriber channel.
An ADS gate and a subscriber channel have been created. Symbols have been added to the channel.
Publish data to AWS IoT Core 1:

AMS Net ID

Make sure that the AMS Net ID, which has been configured on the ADS gate, matches the ADS device that you selected with the target browser.

Configure AWS IoT gate and channel

Follow the step-by-step instructions to create an AWS IoT gate and a publisher channel.

The topology view is activated.
1. Right-click the canvas and select Add Gate (AWS IoT).
2. Select the new gate and configure AWS IoT related settings in the properties window (Broker address, TLS settings).
3. Right-click the new gate and select Add Channel (Publisher).
4. Select the new channel and set “SamplingMode” to “OnChange”, “Formatter” to “Simple JSON” and “Topic” to “TestTopic”. Leave all other fields on their default settings.
An AWS IoT gate and a publisher channel have been created.

Create mapping

Follow the step-by-step instructions to create a mapping between source and destination symbols. Note that a mapping can only be created between channels that have different roles (e.g. between a subscriber and a publisher channel and vice versa).

Drag-and-drop - Channel:

While holding the CTRL key, drag the subscriber channel to the publisher channel.

The configurator automatically creates new symbols on the publisher channel and a mapping between the source and destination symbol.

Drag-and-drop – Symbol:

While holding the CTRL key, drag a symbol from the subscriber channel to either an existing symbol on the publisher channel or to the publisher channel itself.

The configurator creates a link between source and destination symbol or, if the symbol has been dragged to a channel object, creates the destination symbol automatically

Activate configuration

Follow the step-by-step instructions to activate the currently opened configuration.

1. Select the target system via the toolbar.
2. Click the Activate Configuration button.
A dialog opens asking if you want to switch the target TC3 IoT Data Agent into run mode.
3. Confirm the dialog with Yes if you want to switch the mode. Otherwise, choose No.
The configuration is activated.

The resulting configuration looks like this:

Publish data to AWS IoT Core 2: