Overview

Skill Level: Intermediate

This recipe explains how to configure the MQTT publisher module of the Softing dataFEED edgeGate or the uaGate to send PLC data to the Watson IoT.

Ingredients

You need at least one of this two kind of PLCs as data source:

  • A PLC or other automation device which uses the ModbusTCP protocol
  • A Siemens S7 (300, 400, 1200, 1500 series)

You need at least one of this Softing gateway devices:

The dataFEED edgeGate or uaGate should be already configured to connect to the PLC and have access to the data to publish into the Watson IoT.

Step-by-step

  1. Register your Devices and Gateway in Watson IoT Platform

    An Internet of Things resource is required for connecting dataFEED Gateway to IBM Cloud.

    1_Create-resource-1

    • Press Create resource button
    3_Selection-resource-1
    • Select Internet of Things
    • Click on Internet of Things Platform tile
         • At Internet of Things Platform page:
         • Define Service name
         • Choose an organization
         • Select Pricing Plan
         • Press Create button for completing resource creation

     

    Add Softing dataFEED OPC Suite as Service

    • Click IBM Cloud for display of Cloud Foundry Services
    • Click on service to be used for dataFEED Gateway connection

    4_Launch-1

    • Press Launch button
    • Select “Devices” in menu bar on left side
    5_Device-Overview-1

    • Press + Add Device button

    Add Device page is shown
    6_Add-Device-1

    • Enter Device Type and Device ID
    NOTES:
         • There is no restriction to Device Type and Device ID
         • Device ID has to be unique
         • For IBM Cloud Client ID is built by “d:”+<Organization ID>+”:”+<Device Type>+”:”+<Device ID>
         • Client ID is limited to 23 characters
    • Click Next button
    • Add additional optional device information at following pages
    • Click Next button until verification page is shown

    7_Add-Device-Done-1

    • Verify entries
    • Click Done button

    Device Credentials page is shown after completion of IBM Cloud configuration
    8_Device-guide-1

    NOTE:
         Authentication Token is created automatically.
         It is only displayed once at this moment.
         Thus, it is highly recommended to copy shown device details for later use during dataFEED OPC Suite configuration.

  2. Configure MQTT Broker connection from your dataFEED edgeGate or uaGate device to Watson IoT

    • Connect with a browser to the configuration web pages of the device.
    • Login as administrator or itadmin.
    • Navigate to the MQTT Broker configuration page, as in the screenshot below:

      watson-edgate-mqtt1

    • Insert the hostname of the Watson IoT with your Organisation-Id in the beginning, followed by .messaging.internetofthings.ibmcloud.com
      In this example the hostname is l24utt.messaging.internetofthings.ibmcloud.com
    • Insert the port: For unsecure tcp connection insert 1883. For secure ssl/tls connection insert 8883.
    • Insert the MQTT client-ID:

      For the IBM Cloud the Client-ID is composed as follows:

      d:<Organisation-ID>:<Device type>:<Device-ID>

      The corresponding values for each parameter can be seen in the last step of the IBM Cloud configuration. Please use the values that match your configuration of the IBM Cloud.

      In this example the values are

      Organisation-ID: l24utt

      Device type: edgeGate

      Device-ID: edgeGate004f
      and that results in the below Client-Id

      d:l24utt:edgeGate:edgeGate004f

    • Choose Authentication type “Username and password”.
    • Insert user name “use-token-auth”
    • Insert the password, which you have hopefully copied in the last step of the device registration above. Otherwise you need to delete and reregister your device again
    • Finally use the “Save” button to update the configuration.
  3. MQTT Topic configuration

    Navigate to the MQTT Topic configuration page, as shown in the image below.

    watson-edgate-mqtt2

    • Set the MQTT Root Topic to: “iot-2/evt”
    • Select flattened PLC hierarchy.
    • Set the MQTT Suffix Topic to “/fmt/json”.
    • Set the MQTT QoS to 0.
    • Disable MQTT retain.
    • Optionally enable “Publish on value change” to publish only value updates.
    • Set the minimum polling interval to a reasonable value. If the checkbox “Publish on value change” above is enabled, 0 may be a valid choice. But even in this case, it may cause an high amount of expensive data traffic.
    • Set the publish format to:

      { “d” : {“timestamp”:”@TIME@”,

      “value”:”@VALUE@”,

      “quality”:”@QUALITY@”,

      “source”:”@ITEM@”

      }}

      The double quotes (“) are requiered. So that the published data is a valid json string.

    • Finally use the “Save” button to update the configuration.
  4. MQTT Topic Selection

    Navigate to the MQTT Topic Selection, as shown in the image below.

    watson-edgate-mqtt3

    • Select the PLC data which you want to send to Watson IoT.
    • Use the “Save” button to update the configuration.
    • Finally use the “Click here to apply all settings” button.
  5. Verify

    Navigate to the gateway status page, as shown in the image below.

    watson-edgate-mqtt4

    The gateway status page above indicates, that the connection to the MQTT broker of IBM Cloud has been successfully established.

    To verify, that IBM Cloud receives the PLC data, open the device page:

    9_Browsing-Data-1

3 comments on"Send PLC data via Softing dataFEED edgeGate or uaGate to Watson IoT"

  1. Hi,

    thanks for blog,
    I get the status “disconnected” and “failed to establich MQTT connection”. I have but a proxy. How can I set the proxy-setting in IBM Bluemix IoT platform?

  2. thank you JuergenKosel for good plog.
    Can this recipe work with plc LS (xec-dr28ua )type knowing that it has embedded web server.

Join The Discussion