Automation Glossary • Sparkplug B

What Is Sparkplug B?

Merobix Engineering • • 7 min read

Sparkplug B is an open specification that turns plain MQTT into a SCADA-ready, interoperable data protocol. Managed by the Eclipse Foundation, it defines how industrial data is structured, how devices announce themselves, and how state is managed on top of MQTT's lightweight publish/subscribe transport - making it a cornerstone of modern IIoT and unified namespace architectures.

Back to Blog

Sparkplug B in one line: Sparkplug B is an open MQTT specification for industrial SCADA that standardizes topic namespaces, payload encoding, and session state - including birth and death certificates and report-by-exception - so edge nodes and applications can share stateful process data interoperably over an MQTT broker.

Why Plain MQTT Needed Sparkplug

MQTT is an efficient publish/subscribe transport, but on its own it says nothing about how industrial data should be structured or how to know whether a value is currently valid. Two vendors could both use MQTT and still be unable to understand each other's topics or payloads. Sparkplug B fills that gap with three key mechanisms. It defines a standard topic namespace so every message has a predictable structure identifying the group, edge node, and device. It specifies a compact payload encoding for metrics with data types, timestamps, and quality.

Crucially, it adds stateful session management. When an edge node connects it publishes a birth certificate (NBIRTH/DBIRTH) declaring all its metrics and current values; MQTT's Last Will and Testament is registered so that if the node drops, the broker automatically publishes a death certificate (NDEATH), telling every subscriber the data is now stale. Between those, the node reports by exception - sending only changed values - which keeps bandwidth low, a real benefit over cellular links at remote wellsites.

Sparkplug B, Unified Namespace, and Oil and Gas

Sparkplug B is closely tied to the unified namespace concept: a single, real-time MQTT broker acts as the central hub where every asset publishes its state and any authorized application subscribes, decoupling data producers from consumers. Instead of point-to-point polling, an edge gateway at a wellpad or compressor station publishes its metrics once, and SCADA, analytics, and historians all subscribe.

For oil and gas, this fits the reality of thousands of dispersed, bandwidth-constrained sites. Report-by-exception and efficient payloads suit cellular and satellite backhaul, while birth/death certificates give operators trustworthy knowledge of which sites are actually online. A cloud SCADA can act as a Sparkplug host application subscribing to the broker, so the same edge data feeds dashboards, alarms, and long-term history without bespoke integrations for each device type.

The Topic Namespace and Message Types

Every Sparkplug B message lives under a fixed topic structure: the namespace token spBv1.0, then the group ID, the message type, the edge node ID, and optionally a device ID beneath that node. That predictability is what lets any compliant application parse who is speaking and what kind of message it is without prior knowledge of the publisher. How physical equipment maps onto those levels is the subject of the edge node and device hierarchy.

MessagePurpose
NBIRTH / DBIRTHNode or device announces itself with all metrics and current values
NDATA / DDATAChanged metric values, report-by-exception
NDEATH / DDEATHNode or device is offline; its data is stale
NCMD / DCMDCommands written down to a node or device
STATEHost application announces its own online status

Sequence Numbers, Aliases, and Rebirth

Sparkplug's state management runs on counters. Every data message carries a sequence number that increments from 0 to 255 and wraps, so a subscribing host can detect a gap - a missed message - and know its picture of that node is no longer trustworthy. A separate birth-death sequence number ties each death certificate to the specific session it belongs to, preventing a stale will from a previous connection being mistaken for a current failure.

When a host detects a gap, or starts fresh with no state at all, it publishes a rebirth request commanding the node to republish its birth certificate with every metric and current value, rebuilding the full picture. Aliases serve the bandwidth side of the design: the birth message can assign each metric a compact numeric alias, and subsequent data messages reference the alias instead of the full metric name - a meaningful saving on cellular links carrying thousands of metric updates a day.

Every metric also carries its data type and its own timestamp, declared once in the birth message and honored in every update after it. Consumers never guess whether a value is an integer or a float, and a historian can store each sample at the time the edge actually measured it rather than the time the message happened to arrive - which matters when a node buffers data through a network outage and delivers it late.

Designing a Deployment That Scales

The decisions that age well are made before the first node ever connects. The group, node, and device naming scheme is effectively permanent once historians and applications subscribe to it, so it deserves the same care as a tag naming convention - the guide on designing a Sparkplug group ID and topic namespace covers the trade-offs. The broker is the heart of the system, so its availability, capacity, and failover behavior set the ceiling for everything built above it.

Security is deliberately delegated: Sparkplug specifies data structure and state, not encryption or authentication, so those come from the MQTT layer - TLS on the connection, credentials or client certificates at the broker, and topic-level authorization so an edge node can publish only into its own branch. Finally, decide which application is the primary host, since its online state is what edge nodes watch to know whether their data is being supervised - and rehearse the failure modes on a bench: kill the broker, kill a node, kill the host, and confirm every subscriber shows stale data exactly where it should.

Frequently Asked Questions

What is the difference between MQTT and Sparkplug B?

MQTT is the underlying publish/subscribe transport with no rules about data structure or state. Sparkplug B is a specification layered on MQTT that standardizes topic namespaces, payload encoding, and stateful session management (birth/death certificates and report-by-exception), making the data interoperable and SCADA-ready.

What are birth and death certificates in Sparkplug?

A birth certificate (NBIRTH/DBIRTH) is published when an edge node connects, declaring all its metrics and current values so subscribers get the full state. A death certificate (NDEATH), delivered via MQTT's Last Will and Testament, tells subscribers the node has disconnected and its data is now stale - so no one acts on outdated readings.

How does Sparkplug B relate to unified namespace?

Sparkplug B is a common way to implement a unified namespace (UNS): an MQTT broker is the single real-time hub where every asset publishes its state and applications subscribe. Sparkplug adds the structure and state management that make that shared namespace consistent and self-describing.

Does Sparkplug B encrypt or secure the data?

No - the specification defines topics, payload encoding, and session state, and intentionally leaves security to the layers beneath it. In practice that means TLS for encryption, broker-side authentication with credentials or client certificates, and per-topic authorization rules. A Sparkplug system is exactly as secure as its MQTT infrastructure is configured to be.

What happens when the SCADA host application restarts?

The host publishes its own STATE message so edge nodes know supervision was lost and restored, and because it returns with no memory of node metrics, it issues rebirth requests. Each node responds with a fresh birth certificate carrying all metrics and current values, and the host rebuilds its complete picture from those births without manual intervention.

Sources and verification

This page references the protocol specifications published by the organizations below. Editions, product capabilities, and documentation change over time - confirm current requirements and specifications directly with the source.

Merobix is not affiliated with, endorsed by, or sponsored by these organizations; their names are used only to identify the standards and products discussed.

More in Industrial Protocols
Configure Sparkplug Metric Birth Certificates  •  Design a Sparkplug Namespace  •  Fix a Sparkplug Sequence Number Mismatch  •  Fix a Sparkplug Stale Metric After Reconnect  •  Lay Out a Sparkplug Group and Node ID Scheme  •  All Industrial Protocols →
Free SCADA operator training
Merobix University - 70 video lessons & 261 quiz questions, from first login to compliance reporting. No demo call required.
Start free →