Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Home
  • Knowledge base
  • Contact Us
  • Home
  • Tutorials & Guides
  • AWS IoT Core - Amazon Web Services

Connecting PLCs to AWS IoT Core

This tutorial show you how to connect PLCs and other devices as a Thing to AWS IoT Core

Written by Benjamin Pinnerup

Updated at May 7th, 2024

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Installation & Technical information
    Introduction SIA Connect Standalone SIA Connect ANY-Ware Cellular & WiFi connectivity
  • Configuration in the Web UI
    Getting started with the UI Connectors Instances Items Mapping Data System Network Tools & Add-ons DigiCert IoT Trust Manager
  • Connectors
    Siemens S7 Azure IoT Ethernet/IP Mitsubishi MELSEC OPC-UA Server SQL MQTT Omron Host Link REST API Omron FINS Keyence Beckhoff TwinCAT BACnet Virtual OPC-UA Client MS SQL File M-Bus Modbus
  • Scripting & Variables
    Data formatting
  • Developers
    API documentation Shadow API
  • Tutorials & Guides
    InfluxDB AWS IoT Core - Amazon Web Services Microsoft Power BI KaaIoT Siemens S7 AVEVA Insight SIA Connect Demo Rack Grafana Azure
  • General
+ More

Articles in this section:

  • Setting up an AWS IoT Core
  • Connecting PLCs to AWS IoT Core
  • Validating data exchange between AWS IoT Core and PLC

Table of Contents

Video tutorialApplying the AWS Things SSL certificatesAdding the Thing's endpoint as InstanceConfiguring topics as ItemsDefining message formats for the topicsMapping data from the PLCs to AWS IoT Core

This article will guide you through how to publish and subscribe data between various PLCs, sensors and protocols and to AWS IoT Core. You will find a video that shows all the steps and procedure as well as written details describing the steps on how to install AWS IoT Core certificate, adding the endpoint and topics, how you are tailoring and customizing the published payload from the PLCs and respective protocols.

To connect data from PLCs to AWS IoT Core, the MQTT connector is required to be installed on SIA Connect as IoT Core is based on MQTT. If it is not already installed, you can follow this link for a guide on how to do so. 

For a complete list of all supported devices and protocols check Supported Industrial & Buildings devices‍ article. 

This guide will take you through the following steps:

  • Installing the Thing SSL certificate from IoT Core on SIA Connect
  • Creating the Thing as Instance
  • Adding topics for subscribing and publishing to the Thing



Video tutorial

This video shows how to connect PLCs to AWS IoT Core. For further details read the remanding guide.

Your browser does not support HTML5 video. 


Applying the AWS Things SSL certificates

In the previous step where a Thing was created in IoT Core, you were presented to the SSL certificates for the Thing.
These are the certificates used by SIA Connect to establish a secure & trusted connection to the Thing in AWS IoT Core.

You will need a private key, public key and Root CA certificate for the IoT Core as listed below (naming most likely differ):

The certificates need to be uploaded to SIA Connect in the MQTT connector in order for the connector to work properly.

  • Go to  Connectors
  • Locate the MQTT Connector and press Upload new file
  • A popup will open where you can upload a file.
  • Do this procedure for Root CA certificate, Private key and Device certificate


Delete

You can see a full guide to uploading your files to the MQTT connector by following this link 


After this is done the Connector files will look something like the following:


When the certificates are uploaded they can then be used when creating a new instance for the Thing in AWS IoT Core.


Adding the Thing's endpoint as Instance

In order to add a connection from SIA Connect to the Thing in AWS IoT Core you will need to add a Instance pointing to the Thing's endpoint. To add a instance refer you can follow this guide showing how to add a instance‍.

The table below shows how to fill out the fields on the instance

Parameter Description
Address a2b2rqf1kr1flp-ats.iot.eu-west-1.amazonaws.com
The address in this case refers to the endpoint, which can be found by following the previous step
Port 8883 
The port for your MQTT connection
Username Not used in this example
Broker username
Password Not used in this example
Broker password
Device ID Auto-generated by SIA Connect
The Device Id (or ClientId) to use when connecting to a Broker and be identified as such. Leave empty to auto-generate one or insert your own if desired.
Ssl Version TLS 1.2
The SSL version used by the broker
Certificate device.pem.crt
Device certificate obtained from IoT Core uploaded in previous step
Key private.pem.key
Private key uploaded in previous step 
Server Certificate Amazon-root-CA-1.pem
Root Ca Certificate uploaded in previous step 
Verify Server Ca Yes
This is an extra layer of security required to connect to the AWS IoT Core


When the IoT Core endpoint is added as a Instance the next step is to define and add all the MQTT topics you want to publish and subscribe to the IoT Core. This is done by adding a item defining this topic and is described in the next section.


Configuring topics as Items

When the instance has been set up with the proper endpoint, we next need to set up items that defines the topics to use when publishing and subscribing to the Thing in AWS IoT Core. To learn how to add an item you can follow this guide.‍

We will set up three items in this example. You can add and name the topics just as you desire:

Topic Read/Write Description
PublishTopic Write Topic used to publish data
SubscribeTopic Read Topic used to subscribe data
Pub/SubTopic Read and Write Topic that both subscribe and publishes data. Not recommended to use as this also subscribes to its own messages
/device/%INSTANCE_MASTER.NAME%/datapoint/%ITEM_MASTER.NAME% Write Topic that will auto generate by the name of the PLC and its datapoints by using the dynamic variables %INSTANCE_MASTER.NAME% and %ITEM_MASTER.NAME%. Refer to Instance variables and Item variables‍ for full ‍reference.
 ‍
E.g.: /device/PLC_BOTTLE/datapoint/Counter

The following image shows a item configuration for the PublishTopic item. The name of the item can be anything.



Defining message formats for the topics

In order to define and customize the payloads that are being published the Input template for the topics item can be set.
Below are some examples of how these payload and message formats can be set:

Message format example (Input template) Result
{
   "device": "%INSTANCE_MASTER.NAME%", 
   "item": "%ITEM_MASTER.NAME%", 
   "value": "%VALUE%", "time": "%VALUE.TIME%" 
}
{
   "device": "PLC Bottle Line", "item": "Bottle Counter", "value": "458",
   "time": "2022-02-03T07:47:26"
}
{ 
   "value": "%VALUE%", 
   "time": "%VALUE.TIME.FORMAT("h:m:s yy/d/M")%",
   "prod_id": "%UID_OF_PRODUCTION_ITEM%"
}
{ 
   "value": "458", 
   "time": "7:3:5 22/2/3",
   "prod_id": "ORDER XYZ12345" 
}

For a full reference of the available variables and parameters please refer to System variables‍, Instance variables‍ and Item variables‍.

That's it, now we are ready to create the mappings between the PLC data and the topics we just added.


Mapping data from the PLCs to AWS IoT Core

SIA Connect is able to read data from almost any PLC. This is done by creating an instance and setting the PLC up withing that instance. If you need help in doing so, our help-page contains various guides for creating instances for the specific PLC you want to use

For a PLC to transfer data to the AWS IoT core, you must use Mappings. Mappings is a SIA Connect feature where you can transfer data from one Instance to another. In this case, we have two instances, a PLC and the AWS IoT Core.

Delete

For further details of how to create a mapping and what the parameters are used for please refer to Add Mapping‍ article.


As Master item select the instance and item which masters when to transmit data. In this example we select Siemens S7 PLC and its item named Analog. As Slave item select the AWS instance and the desired Item which in this case is the topic. In this example it is instance named AWS and item named Publish.

In this window we can see how the mapping interface looks like


Data from the Siemens S7 PLC from the Analog item is now being published to the AWS IoT Core's topic named Publish. Continue this step with all the data items which you desire to publish to AWS IoT Core.

Following the next guide - Validating data exchange between AWS IoT Core and PLC - you can see the data being transferred between the AWS IoT Core and SIA Connect and verify that everything is working



plc to aws plc data to aws connecting plcs to aws melsec to aws allen bradley to aws siemens s7 to aws opc to aws bacnet to aws siemens to aws omron fins to aws modbus to aws

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Setting up an AWS IoT Core
  • Validating data exchange between AWS IoT Core and PLC

0
0
Expand