MQTT vs Sparkplug for Equipment Integration with Critical Manufacturing MES

MQTT revolutionized IoT communication by providing a lightweight and efficient way for devices to exchange data. However, as industrial systems grew in size and complexity, engineers discovered that moving data was only part of the challenge. The real challenge was ensuring that data from thousands of devices could be interpreted consistently, managed reliably and integrated seamlessly across multiple vendors and applications. This is exactly where Sparkplug comes in.

Understanding MQTT

MQTT (Message Queuing Telemetry Transport) is a lightweight publish/subscribe messaging protocol designed for efficient communication between devices and applications. Its low network overhead, scalability and simplicity have made it one of the most widely adopted communication protocols in Industrial IoT environments.

In a typical MQTT architecture, equipment publishes data to an MQTT broker and one or more applications subscribe to the topics of interest to consume that data.

While MQTT effectively defines how messages are transported, it does not define how industrial data should be structured, contextualized or interpreted. The topic hierarchy, payload format, naming conventions, metadata and device state information are left in most cases to the application consumer to handle.

For MES integrations, this often translates into significant engineering effort. Each MQTT-connected equipment requires custom topic mappings, payload parsing, context reconstruction and business-specific interpretation before the data can be reliably consumed by MES workflows.

Why Sparkplug?

Sparkplug is an open specification that extends MQTT with a standardized framework for industrial data exchange. Rather than replacing MQTT, it builds on top of it allow defining a common topic structure, a payload model that could contain metadata and device state management. This enables all Sparkplug-compliant applications to interpret equipment data consistently and reduces the custom integration effort typically associated with MQTT-based solutions.

MQTT Example

A typical MQTT topic might look like:

Factory1/Line3/AssemblyMachine01/Temperature

Payload:

{
  "value": 200
}

While MQTT defines how the message is transported, it does not define the meaning or context of the data. The subscriber must determine the data type and the units for example.

As a result, each application must implement its own interpretation and mapping logic.

Sparkplug Example

Topic:

spBv1.0/Factory1/NDATA/Line3/AssemblyMachine01

Payload:

{
  "timestamp": "2026-10-08T18:00:00Z",
  "metrics": [
    {
      "name": "Temperature",
      "type": "Float",
      "timestamp": "2026-10-08T18:00:00Z",
      "value": 200.0,
      "quality": "online"
    }
  ]
}

In a Sparkplug implementation, the payload can provide not only the value but also its associated context, including metric names, data types, timestamps, metadata, device state information and other related metrics that should be analyzed together. Related metrics are delivered within a single structured payload, allowing consumers to interpret the data consistently without relying on application-specific conventions or additional contextualization.

This standardized approach simplifies equipment integration, improves interoperability, reduces engineering effort and enables MES to consume industrial data with a common understanding of its structure and context.

How Sparkplug Works?

Sparkplug extends MQTT with a standardized lifecycle model for industrial equipment. When a node or device connects, it publishes a Birth Certificate (NBIRTH or DBIRTH) containing its complete data model, including available metrics, data types and metadata. This allows consumers to automatically discover and understand the device without requiring extensive pre-configuration.

Once connected, the device publishes runtime data through NDATA and DDATA messages. These messages contain equipment status, process values, production information and other operational data. To optimize bandwidth, only changed values are typically transmitted while preserving the context defined during registration.

Sparkplug also provides built-in device state management. If a connection is unexpectedly lost, an NDEATH message is automatically generated. This immediately informs subscribers that the equipment is no longer available, eliminating the need for custom logic to detect offline devices.

In an MES implementation, NBIRTH messages are typically used to initialize and enable equipment operations, while NDEATH messages are used to detect communication loss, mark equipment as unavailable and trigger alarms or recovery workflows.

Sparkplug implementation in Critical Manufacturing MES

Use case: monitoring an assembly station in MES

Consider an assembly station on a production line that publishes its operational data through Sparkplug. The MES ingests this real-time equipment information, contextualizes it within the manufacturing process and forwards it to the Data Platform for monitoring.

The MQTT Explorer view shows the device-data message arriving under the configured topic. Sparkplug payloads use a structured binary encoding (Google Protocol Buffers):

In this use case, the MES receives Sparkplug messages through its Automation Controller. The Sparkplug driver decodes the payload and maps the metrics to MES equipment properties. An equipment-event workflow then processes the information, either logging it for traceability purposes or using it to trigger MES actions. The example also demonstrates the automatic publication of equipment data to the Data Platform for monitoring and analytics.

sparkplug

The Sparkplug driver and the task responsible for publishing equipment data to the Data Platform were developed by internal teams (with the driver being led by @Antonio_Almeida ). Their implementation demonstrates the extensibility of the Critical Manufacturing Connect IoT platform, showing how custom protocol integrations and data-processing workflows can be added to address specific customer and business requirements.

Configure the Sparkplug connection

The equipment communication parameters identify the broker and the Sparkplug namespace. In this example, the device ID is AssemblyStation, the broker URL is mqtt://localhost:1983, the group ID is Factory1, the edge node is AssemblyLine1, the Sparkplug version is spBv1.0 and the application ID is Sparkplug.MES.IoT. Username and password fields are available for brokers that require authentication.

Together, the group, message type, edge node and device ID identify the device’s topic. The MQTT Explorer screenshot shows a device-data topic in this namespace:

spBv1.0/Factory1/DDATA/AssemblyLine1/AssemblyStation

In this topic structure, DDATA indicates a Device Data message. Device Data messages are used to publish runtime metric updates from the device after its birth certificate has been established. Whenever the device reports new values for its metrics, a new message is published to this topic, allowing MES to receive real-time updates.

Map Sparkplug metrics to MES equipment properties

The Automation Driver Definition declares the equipment properties MES should recognize and maps each property to a metric name (Property Device ID). For example, MotorTemperature maps to Sensors/MotorTemperature, while Status maps to Machine/Status. The screenshot also shows mappings for PartCount, CycleTime, ConveyorSpeed, AirPressure, FaultCode and Uptime.

This mapping is the bridge between names and paths in the incoming Sparkplug metrics and the properties configured for the MES equipment. The driver definition also specifies types and whether a property is readable or writable; those details should match the actual device contract.

Define an MES equipment event and its properties

The driver definition includes an event named Event and associates it with eight equipment properties. Rather than handling incoming Sparkplug messages as unstructured notifications, this configuration ensures that each event is processed as a well-defined set of contextualized values.

This is one of Sparkplug’s main advantages: related information is delivered together as a single contextual payload rather than as individual, disconnected tags. As a result, the MES receives a consistent snapshot of the equipment state, ensuring that all associated metrics are correlated to the same event and timestamp. This simplifies event processing, improves data integrity and provides richer context for MES.

In the Automation Controller, an On Equipment Event workflow provides the event trigger and makes the event properties available to subsequent workflow actions. The example routes selected properties into a log action. In an operational workflow, those properties can instead implement some MES logic appropriate to the use case.

The runtime log illustrates the data flow: the controller receives a DDATA message containing timestamped, typed metrics, then logs an event occurrence with the mapped property values. In the example, Machine/Status is RUNNING, with values also present for the remaining metrics. This demonstrates the relationship between the device metrics and the MES event values.

Automatic post event data to Data Platform

The Equipment Event & Post task (can be found at mes-common-library/features/IoTDataPlatformHelperSuite/IoTDataPlatformHelperSuite.IoT/src/custom-dataplatform-tasks/src/tasks/equipmentEventWithDataplatform at 11.3/dev · criticalmanufacturing/mes-common-library) combines event handling with the option to post data to Data Platform. Its general settings select the Sparkplug driver and the equipment event and expose controls including Is To Post To DP, Continue On DataPlatform Error, Resolve ISA-95 On Each Event and Batch Post To DP. These settings determine whether the workflow posts data and how it handles the related Data Platform behavior.

The general configuration connects the workflow to the Event equipment event and enables Is To Post To DP for this example. The event-wide setting and the per-output posting setting work together: the workflow must be configured to post and the outputs intended for Data Platform must also be selected and appropriately described.

On the outputs tab, each output can be configured with a name, property ID, MES data type, device data type and output type. It is also possible to assigns the Sensor class and specifies °C as its unit of measure for example. The same approach can be applied to other metrics, using the correct class and unit for each one.

Conclusion

MQTT provides a lightweight and scalable transport layer for exchanging data between equipment and applications, while Sparkplug builds on top of MQTT to deliver a standardized framework for industrial communication. By defining a common topic structure, payload model and device lifecycle management, Sparkplug enables equipment data to be exchanged in a consistent and interoperable manner.

Using the MES Sparkplug driver, Sparkplug messages can be automatically decoded and mapped to MES equipment properties, transforming raw device data into structured and contextualized information. This information can then be leveraged by MES workflow without requiring extensive custom integration logic.

Perhaps the greatest advantage of Sparkplug is its ability to deliver related metrics together within a single contextual payload. By keeping equipment data synchronized and associated with the same event, timestamp and device state, Sparkplug simplifies integration, improves data consistency and enables richer operational insights.

2 Likes