In this tutorial, we’ll delve deeper into configuring a Siemens PLC (e.g., S7-1200 or S7-1500) for MQTT communication with AWS IoT Core using TIA Portal.
If you are interested into an easier 5 minutes setup for an AWS-MQTT connection, check this post.
Prerequisites:
- A Siemens PLC supported by TIA Portal.
- TIA Portal software installed.
- Previously generated certificates from AWS IoT Core:
- Root CA certificate.
- Client certificate for the PLC.
- Private key for the PLC.

1. Set up your PLC in TIA Portal
1.1. Launch TIA Portal and create a new project by selecting Create new project
.
1.2. Give your project a name and choose a location to save it.
1.3. Add your PLC to the project:
- Click on the
Add new device
button. - Choose the appropriate PLC from the list.
- Follow the wizard to set up the basic settings.
2. Configure Communication
2.1. With the PLC selected in the project tree, open its Properties
.
2.2. Navigate to the Communication
section to configure the communication settings:
- General: Ensure the Profinet port is enabled.
- Advanced: Check if any advanced settings are needed, such as speed or mode.
2.3. Look for the MQTT
tab or section (note that this option might not be available in all TIA Portal versions or all Siemens PLC models):
- General:
- Enable MQTT: Check this box.
- Broker Address: Enter the AWS IoT endpoint (something like
a12345abcd.iot.us-west-1.amazonaws.com
). - Port: Typically
8883
for MQTT over TLS. - Client ID: Typically the name of your PLC or any unique identifier.
- Security:
- Security Mode: Select
TLS
. - Certificates:
- CA Certificate: Upload the root CA certificate from AWS.
- Client Certificate: Upload the client certificate for the PLC from AWS.
- Private Key: Upload the private key for the PLC from AWS. Ensure that the private key is in a format supported by TIA Portal, potentially converting it if necessary.
- Security Mode: Select
3. Set up Data Publishing
3.1. Navigate to the data publishing section (might be in the MQTT
tab or a related section):
- Topics & Payloads:
- Click
Add
to define a new topic. - Set up the topic name (e.g.,
plc/sensors/temp
). - Choose the data from the PLC that you want to publish on this topic.
- Define the payload structure, such as whether it’s a simple value, JSON, etc.
- Click
4. Deploy Configuration to PLC
4.1. Save the project.
4.2. Download the configuration to the PLC:
- Click on the
Download
button/icon. - Choose the appropriate interface (usually Profinet for Siemens PLCs).
- Ensure the PLC is in
STOP
mode and initiate the download.
4.3. After successfully downloading, change the PLC’s mode to RUN
.
Your Siemens PLC should now be configured to communicate with AWS IoT Core using MQTT with TLS security, thanks to the TIA Portal. Regularly check the AWS IoT console for incoming messages to ensure everything is functioning as expected. Remember, communication configurations can be intricate; always double-check settings if things don’t seem to work initially.
If this doesn’t work, please check this Siemens’ official post so you can find more information.
Leave a Reply