Tutorial: Process and Visualize MQTT Data with Panopticon

Use Panopticon to process and visualize data sent from Twin Activate using MQTT (Message Queuing Telemetry Transport) protocol.

Attention: Available only with Twin Activate commercial edition.

Prerequesites for This Tutorial

The following software is required for this tutorial:

  • Altair Twin Activate
  • Altair Panopticon

Files for This Tutorial

MQTT Pub Panopticon.scm, Tutorial Dashboard TwinActivate.exw

A finished version of the model you build in this tutorial along with any files required to complete the tutorials are available from the Demo Browser: Tutorial Models > Integration and Collaboration > Process and visualize MQTT data with Panopticon or at this location: <installation_directory>/Tutorial Models/Integration and Collaboration/Process and visualize MQTT data with Panopticon.

Overview

One of Twin Activate's communication protocol options is MQTT, a well-known communication protocol used in IoT (Internet of Things). It is possible to both publish and subscribe to any MQTT broker, local or external, very quickly and lightly.

When publishing messages to a topic, Twin Activate will send data from the software to a MQTT broker, and Panopticon, that is a comprehensive data visualization and streaming analytics tool, will be the client that will subscribe to that broker, process, and visualize the data in real-time:

Among the many capabilities, Panopticon supports native connectors for all common data sources, including SQL and NoSQL databases, big data repositories, flat files, real-time message queues like MQTT and Kafka, and specialized time series databases with no coding or middleware needed.

Also, Panopticon provides a broad range of high-density information visualizations designed to foster intuitive comprehension of complex data. For more information, refer to https://altair.com/panopticon.

General MQTT Setup on Panopticon

After installing Panopticon, and accessing it on the web, a new Workbook must be created to set the MQTT Connector to receive and process the data:

  1. In the Panopticon main page, click New Workbook, enter a name, and click Create.
  2. After creating the workbook, select a Template.
  3. Open the Workbook Data Table Editor.
  4. Click the + icon to add a new data table.
  5. After adding a data table, select Streaming > MQTT from the page that opens.
  6. Enter a Topic name, in this case topic1.

Publish to an MQTT Topic and Visualize Data in Panopticon

In this tutorial, a standard Twin Activate demo is used, but the process should be the same across any other diagrams. In this case, data will be sent from Twin Activate to a Localhost and Panopticon will visualize that data using MQTT Connector.

  1. In Twin Activate, select Palette Browser > Communicate > MQTT PUB.
  2. Open the block's Connection tab. Set the Hostname and Topic fields:
  3. Open the Parameters tab. Enter the Number of Inputs, in this case 3, and the Message. It is a good practice to use JavaScript Object Notation (JSON) format to send data to Panopticon:
    {
        "var": {
          "X": "%%1",
          "Y": "%%2",
          "Z": "%%3",
    	"time": "%%4"
        }
    }
  4. After doing the setup for the MQTT PUB block, connect some of the Signal Generator blocks to the inputs, a Gain for each of them, and a SampleClock to activate the block:
  5. Open Simulation > > Setup, and set Real time scaling equal to 1. The simulation will send data in real time to the localhost.
  6. Click Run Simulation.
  7. While the Twin Activate simulation is running, go to Panopticon and select Generate Columns.
    Note: If Twin Activate is not running and sending data, selecting Generate Columns will generate an error.
  8. On Panopticon, after generating columns, these parameters are shown automatically:
  9. In this tutorial time variable was intentionally sent from Twin Activate, to be used in Panopticon as the time to be plot. Change the Type to Time, and Date Format to Seconds.
  10. On the Data table editor, enable this analysis to time series. Open Transform settings. Enable Transform to enable time series analysis, and select var.time to define the time axis:
  11. Save all changes and click Back to return to the Workbook page.
  12. Press and hold in a certain area:
  13. Select X-Axis Graph.
  14. Drag and drop X, Y, and Z variables to Y option.
  15. Select View and send data again from Twin Activate to visualize your data in real-time.

    You can import a finished version of this dashboard using the Tutorial Dashboard TwinActivate.exw file inside the main page.

    Panopticon is a tool with several available options to create customized dashboards, and there are focused tutorials for that. This is an example showing how to start using both tools together.