S7-MQTT Gateway

This section of the documentation is still under construction. Please contact us if you have any questions.

Contents:

  1. Siemens S7
    1. Project setup
    2. Connecting to the PLC
      1. General Settings
      2. Connection Settings
      3. PDU Settings
    3. Reading data from the PLC
      1. Adding a Tag
      2. Adding multiple Tags
  2. MQTT
    1. Project setup
    2. Connecting to the broker
      1. General Settings
      2. General Connection Settings
    3. Subscribing automatically when connected
    4. Subscribing manually
      1. Subscribing/unsubscribing per topic
      2. Managing subscriptions
    5. Automatic configuration of topics and payloads
    6. Publishing messages

Siemens S7

Project setup

In the navigator right-click on the project and choose ‘Add Target’, next choose ‘Siemens S7’ as the target type and click Ok.

S7 Target

Connecting to the PLC

Right-click on connections and choose ‘New Connection’.

S7 Connection

It is possible to add multiple connections to a single S7 target, only one connection can be active simultaniously.

General settings

Name

Enter a unique name for the connection.

IP Address

The ip address of the S7 PLC.

Connection Settings

Rack

The default value is 0.

Slot

For S7-1200 PLC’s the slot should be set to 1

Connection type

PG, OP, S7 Basic

Local TSAP

The default value is 256.

Custom

Check this setting to enter a custom Remote TSAP

Remote TSAP

This value is automotically calculated from the Rack, Slot and Local TSAP settings.

PDU Settings

Reading data from the PLC

In the navigator right-click on ‘Tag Tables’ and choose ‘New Tag Table’, next double click on the newly created Tag Table to edit it. In the Tag Table editor right click on the Tag Table name and choose ‘Add Memory Area’.

S7 Memory Area

Adding a Tag

Right-click on a Memory Area and choose ‘Add Tag’

S7 Memory Area

Adding multiple Tags

Right-click on a Memory Area and choose ‘Add Tag Range’

S7 Memory Area

MQTT

Project setup

In the navigator right-click on the project and choose ‘Add Target’, next choose ‘MQTT’ as the target type and click Ok.

MQTT Target

Connecting to the broker

Right-click on connections and choose ‘New Connection’.

MQTT Connection

It is possible to add multiple connections to a single MQTT target, only one connection can be active simultaniously.

General settings

Name

Enter a unique name for the connection.

Broker Address

The ip address of the MQTT broker.

Broker Port

The port of the MQTT broker.

General Connection Settings

-

Subscribing automatically when connected

In the navigator double-click on ‘Settings’ and select the ‘Subscribe’ category in the Target Settings dialog.

MQTT Target Settings Subscribe

Subscribing manually

Subscribing/unsubscribing per topic

Right-click on a topic and in the context menu choose ‘Subscribe’ or ‘Unsubscribe’. The default Quality of Service for subscribing can be configured in the target settings dialog.

Managing subscriptions

Right-click on a topic and in the context menu choose ‘Manage Subscriptions’. The drop-down box lists all the topics that are known in the project, it is also possible to manually enter a topic in this box.

Manage Subscriptions

Automatic configuration of topics and payloads

In the navigator double-click on ‘Settings’ and select the ‘Topics & Payloads’ category in the Target Settings dialog.

MQTT Target Settings Topics & Payloads

-

Publishing messages

Right-click on a topic and in the context menu choose ‘Publish Message’. The drop-down box lists all the topics that are known in the project, it is also possible to manually enter a topic in this box.

Publish Message

Found a mistake or want to help improve this documentation? Contact us to suggest changes.

Schrijf je in voor de Plc-Lab nieuwsbrief.

Star

Copyright © 2019 Poelstra Besturingen - Leeuwarden