Loading
FT Optix | FT Vault | FT Hub | Logix

MQTT Data Exchange: Real-Time Dashboard & Historical Data

Revision: A (11/10/2022) - Deploy Time: 60 Minutes |This guide details using MQTT for efficient real-time and historical data exchange and visualization between applications.
A woman sitting at a desk in front of a computer, typing on the keyboard
On this page:
  • Overview
  • Installation guide
Innovation Center Home Page

What is this for?

Demo MQTT is an example consisting of two projects: Field Application and Data Aggregator Application. The objective of this demo is to simply show an example of communication via MQTT protocol between a hypothetical application running on a machine/plant (Field Application) and an application that collects the data sent by the machine, showing them in the form of a dashboard (Data Aggregator Application). Usually, it would be done only with the visualization of historical data (cold data) but in this project, we also wanted to show an example of receiving live data.

Use MQTT for real-time data visualization and communication between applications, emphasizing safety and practical implementation using FT Optix.

General Features

MQTT for real-time communication between field and data aggregator applications, with a focus on practical setup and safety. 


Limitations/Disadvantages

The example is provided as-is and can be a useful reference for building your application. The example as its cannot be used on a real machine but must be adapted for the purpose, respecting the highest safety standards required. A public and open source MQTT broker is used in the project for demonstration purposes only, it is not secured, and its uptime can’t be guaranteed. We strongly encourage you to change the topic and server names using your provider before deploying the final application.


How to start the project?

To setup the Field Application and/or to solve compiling issues/missed references please read the MQTT_Field documentation.

Please note:

This application works paired with the Field Application, showing data received via MQTT protocol in form of a control dashboard. This app you can find in the Innovation Center under the following tittle: Real-Time Data Implementation and Visualization with MQTT in Optix.

Step 1 - screenshot

Downloads

Please note: You will need to agree to the Terms & Conditions for each download.

Files for download ›
Legal Disclaimer Acceptance. ROCKWELL AUTOMATION WILL PROVIDE ACCESS TO ROCKWELL PRODUCTS (BEST PRACTICES, APPLICATIONS AND KNOWLEDGE) ON THE CONDITION THAT YOU ACCEPT AND COMPLY WITH THE FOLLOWING TERMS AND CONDITIONS. YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT BY DOWNLOADING, INSTALLING, COPYING, OR OTHERWISE USING PRODUCTS. IF YOU ARE ACCEPTING THESE TERMS ON BEHALF OF ANOTHER PERSON, COMPANY, OR OTHER LEGAL ENTITY, YOU REPRESENT AND WARRANT THAT YOU HAVE FULL AUTHORITY TO BIND THAT PERSON, COMPANY, OR LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT AGREE TO THESE TERMS, DO NOT DOWNLOAD, INSTALL, COPY, ACCESS, OR USE THE PRODUCTS, SOFTWARE AND/OR CLOUD SERVICES. 1. Rockwell Automation retains full ownership and title to all Products and related documentation. No rights or licenses are granted other than those set forth in this Agreement. Company grants to Rockwell Automation a non-exclusive, worldwide, royalty-free, perpetual, non-revocable license to use any feedback Company provides regarding the Products, even if Company has designated the feedback as confidential. Rockwell Automation will be entitled to use the feedback without restriction or compensation to Company. 2. Company may not lease sub-lease, assign, license, sub-license or otherwise transfer any of the Products without the prior written consent of Rockwell Automation. Company may not assign or otherwise transfer access rights to the Products without the prior written consent of Rockwell Automation. Any reverse assembly, reverse engineering, decompilation, and creation of derivative works based on the Products by Company is prohibited. 3. Company acknowledges that Products provided under this Agreement are Rockwell Automation’s Confidential Information and are covered by effective or pending copyrights, patents, trademarks and/or trade secrets of Rockwell Automation, and Company agrees to maintain confidentiality by not disclosing Products or documentation to any third party without the prior written consent of Rockwell Automation and to protect the confidentiality of the Products as it would Company’s own confidential information. Company agrees that its obligation of confidentiality under this paragraph shall survive expiration or termination of this Agreement. 4. Company agrees that Products provided under this Agreement are prototypes and examples and its application and results may vary depending on each customer and project conditions. Rockwell Automation do not warranty the same results. This Agreement shall in no way be construed as a commitment by Rockwell Automation at any time to manufacture and/or offer Products for sale. There is no explicit or implicit service level agreement associated with using the Products. Rockwell Automation does not warrant that the functions contained in the Products will meet Company’s requirements. Company agrees to use all Products only in accordance with the instructions and only for the intended usages identified in the documentation. 5. EXCLUSION OF WARRANTIES AND LIMITATION OF LIABILITY. THE PRODUCTS ARE PROVIDED "AS IS". ROCKWELL AUTOMATION DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. ROCKWELL AUTOMATION EXPLICITLY DISCLAIMS ALL WARRANTIES OF NON- INFRINGEMENT AND EXPRESSLY DOES NOT WARRANT THAT THE PRODUCTS, IN WHOLE OR IN PART, WILL BE ERROR FREE OR FREE FROM SECURITY VULNERABILITIES. IN NO EVENT SHALL ROCKWELL AUTOMATION BE LIABLE FOR (i) LOST PROFITS, LOST SAVINGS, DOWNTIME, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR (ii) ANY PERSONAL INJURY, PROPERTY DAMAGE OR ENVIRONMENTAL DAMAGE ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT, WHETHER IN AN ACTION IN CONTRACT, STRICT LIABILITY OR IN TORT INCLUDING NEGLIGENCE. 6. COMPANY AGREES TO INDEMNIFY AND HOLD ROCKWELL AUTOMATION HARMLESS FROM ALL COSTS, AWARDS, DAMAGES, EXPENSES AND FEES (INCLUDING ATTORNEYS FEES) RESULTING FROM OR RELATED TO ANY THIRD-PARTY CLAIMS (INCLUDING EMPLOYEES AND AGENTS OF COMPANY) AGAINST ROCKWELL AUTOMATION, ITS DISTRIBUTORS, AGENTS, OFFICERS, DIRECTORS OR EMPLOYEES FOR PERSONAL INJURY (INCLUDING DEATH), PROPERTY DAMAGE OR ENVIRONMENTAL DAMAGE RELATED TO OR RESULTING FROM THE USE OF THE PRODUCTS. 7. In the event a Product is exported, Company agrees to comply with all applicable United States Export Control Law and Regulations, and the applicable export control laws of other countries. This Agreement shall be governed by the laws of the state of Wisconsin. This Agreement is the complete and exclusive Agreement between Rockwell Automation and the Company, and supersedes all prior agreements, whether written or oral, relating to the Products.

Need Help?

If you need help with an application or have feedback from the Innovation Center, please contact us.

Guía de implementación

Paso 1

Start the Field Application.

Paso 2:

After that, open this project on another FT Optix window and run the application with FT Optix Emulator.

Step 2 - screenshot
Step 2 - screenshot

Paso 3:

If the connection with the Field Application is working, the “Live Data” LED will be green.

Step 3 - screenshot
Step 3 - screenshot

Detailed information

The data exchange is based on a Runtime Netlogic which can be found in the Netlogic folder. The Netlogic MQTTBrokerLogic is present on both applications but is configured differently.

Step 4 - screenshot
Step 4 - screenshot

Field application

Here the Runtime Netlogic acts as Publisher, in this way it publishes data on certain topics, addressed to an MQTT broker.

Step 5 - screenshot
Step 5 - screenshot

Data aggregator application

Here the Runtime Netlogic works as Subscriber: subscribing to the topics on which the Field Application publishes, it shows all data in the form of a dashboard.

Step 6 - screenshot
Step 6 - screenshot

MQTT BrokerLogic

Server MQTT

Debe activarse (TRUE) solo si desea utilizar su aplicación Uniqo como Broker (por lo tanto, no usar un broker MQTT existente, en este ejemplo test.mosquitto.org).

Parameters:

  • IPAddress: IP address where the Broker will be instantiated.
  • Port: number of the port on which the broker is listening
  • UseSSL: enables the use of certificates.
  • Certificate
  • CertificatePassword
  • AutoStart LEAVE TRUE
  • UserAuthentication: if true only the specified users can access
  • AuthorizedUsers
  • IsRunning: Server status
  • IsDebuggingMode NOT USED
  • MaxNumberOfConnections: maximum number of clients that can connect to the Broker
  • NumberOfConnections: number of active connections
Step 7 - screenshot
Step 7 - screenshot

MQTT Client

It must always be active (TRUE) because it is the connection with the Broker to which you publish or to which you subscribe. If you want to connect two applications, you need to set the same broker and the same port on both projects. Instead, the ClientID parameter must be different (unique) on each application.

Parameters:

  • IPAddress: broker address (test.mosquitto.org) could be external like in this case, or internal if the application work as a broker (e.g., MQTTBrokerLogic.MQTTServer.IPAddress)
  • Port: broker port (1883 for test.mosquitto.org)
  • UseSSL: Switch to TRUE if the broker requires certificates
    • CaCertificate
    • ClientCertificate
    • ClientCertificatePassword
    • AllowUntrustedCertificates
  • UserAuthentication: Switch to TRUE if the broker requires authorized users.
    • AuthorizedUsers: String array which contains Uniqo users (User1; User2; User […]);
  • IsRunning NOT USED
  • IsDebuggingMode NOT USED
  • ClientId: this is the unique Id, different for each application that wants to participate in the data sharing/exchange
  • Connected: connection status to the broker
  • SentPackages STATS
  • ReceivedPackages STATS
Step 8 - screenshot
Step 8 - screenshot

Subscriber

It must be active (TRUE) if your application needs to receive data published on the broker.

Parameters:

  • LiveTags: TRUE = receive LIVE DATA
    • LiveTagsFolder: this folder/Node contains a copy of the Publisher LiveTagsFolder parameter, on which the Netlogic will copy the values read from the broker.
    • LiveTagsTopic: on this parameter needs to be specified the topic on which you are subscribed, and you want to receive live variables/tags values.
    • LastPackageTimestamp: Timestamp of the last published packet
  • StoreTables: TRUE = receive HISTORICAL DATA
    • Store: DataStore on which we are saving received data. The store’s tables must be renamed with the “TablesPrefix” parameter, plus the name of the publisher application tables. Below is an example:
      • Publisher application DataStore table names: Datalogger, AlarmsEventLogger
      • Publisher “TablesPrefix” parameter: Station1
      • Subscriber application DataStore table names: Station1_DataLogger, Station1_EventLogger Verify to have the same columns you have on the Publisher application.
    • StoreTablesTopic: on this parameter needs to be specified the topic on which you are subscribed, and you want to receive historical variables/tags values.
  • CustomPayload: Custom message without pre-defined format
    • CustomPayloadMessage: Custom text message from the CustomPayloadTopic
    • CustomPayloadTopic: On this parameter the topic on which you are subscribed, and you want to receive custom messages needs to be specified.
Step 9 - screenshot
Step 9 - screenshot

Publisher

It must be active (TRUE) if your application needs to publish data to the broker.

Parameters:

  • LiveTags: TRUE = publish LIVE DATA
    • LiveTagsPeriod: Sending frequency (if 0000:00:00.000 send data on value change).
    • LiveTagsFolder: folder (or node) that contains data to be sended
    • LiveTagsTopic: /UniqoFieldHmiLiveTopic is the topic on which we are sending/publishing data
    • QoS: MQTT Quality of Service (0,1,2)
    • Retain: Retain message on the topic even after read
  • StoreTables: TRUE = publish HISTORICAL DATA
    • Store: DataStore on which we are saving our data
    • TableNames: Store tables to be sended
      • Table1: Datalogger
      • Table2: AlarmsEventLogger
      • Table (…) could be added or removed
    • PreserveData NOT USED
    • MaximumItemsPerPacket: define how many rows per packet to send
    • MaximumPublishTime: Maximum waiting time before publishing data even if it does not reach the MaximumItemsPerPacket value.
    • MinimumPublishTime: Minimum waiting time before publishing data when the MaximumItemsPerPacket value is reached.
    • StoreTablesTopic : /UniqoFieldHmiDataLoggerTopic is the topic on which we are sending/publishing data
    • QoS: MQTT Quality of Service (0,1,2)
    • Retain: Retain message on the topic even after read
    • TablesPrefix: A model variable containing the hypothetical name of different production sites, in this case, will be “Station1”. Into the sent packet will appear the table sent with the unique prefix corresponding to the right machine/site from which the packet arrives (Station1_AlarmsEventLogger). This is useful when we have more than one of the same machine models/more than one of the same plant configurations and we need to distinguish from which machine/plant data arrives.
  • AllRows: When it is TRUE, publish all the data already present in the Store Tables. Set on FALSE to publish only the data stored after the implementation of the MQTTBrokerLogic.
  • CustomPayload: Custom message without pre-defined format
    • CustomPayloadMessage: Custom text message published to the CustomPayloadTopic
    • CustomPayloadTopic: The topic on which the message will be published.
    • CustomPayloadPeriod: Sending frequency of the custom message (if 0000:00:00.000 send data on value change)
    • QoS: MQTT Quality of Service (0,1,2)
    • Retain: Retain message on the topic even after read
Step 10 - screenshot
Step 10 - screenshot
Have a general inquiry?

Rockwell Automation and our partners offer exceptional industry knowledge to help design, implement, and support your automation investment.

Contact Rockwell Automation
  1. Chevron LeftChevron Left Rockwell Automation Home Chevron RightChevron Right
  2. Chevron LeftChevron Left Sup... Chevron RightChevron Right
  3. Chevron LeftChevron Left Pro... Chevron RightChevron Right
  4. Chevron LeftChevron Left Downloads Chevron RightChevron Right
  5. Chevron LeftChevron Left Innovation Center Chevron RightChevron Right
  6. Chevron LeftChevron Left MQTT Data Exchange: Real-Time Dashboard & Historical Data Chevron RightChevron Right
Please update your cookie preferences to continue.
This feature requires cookies to enhance your experience. Please update your preferences to allow for these cookies:
  • Social Media Cookies
  • Functional Cookies
  • Performance Cookies
  • Marketing Cookies
  • All Cookies
You can update your preferences at any time. For more information please see our {0} Privacy Policy
CloseClose