Skip to main content

Sparkplug B (MQTT-based IIoT Standard)

Sparkplug B is an IIoT messaging standard defined by Eclipse Tahu / Cirrus Link. It layers a defined topic structure + Protobuf payload on top of an MQTT broker, allowing equipment from different vendors to read each other's data.

Edge uses this in two directions — the two below are different features, so don't confuse them.

DirectionWhatWhere it's documented
Receive (driver)Subscribes to Sparkplug topics on a broker, caches metrics, and reads them as tagsEarlier part of this document
Export (transmit)Edge publishes collected values as Sparkplug BExport below

Registration form fields​

FieldWhat to enterExample
IP AddressMQTT broker192.168.10.50
PortMQTT broker port1883 (plaintext) / 8883 (TLS, planned)
Group ID (group-id)Sparkplug Group — factory/site levelFactoryA, Plant01
Edge Node ID (edge-node-id)A single node, or + (all nodes)+ (default), edge-01
Keep Alive (keep-alive)MQTT keep-alive seconds60 (default)
Connect Timeout (connect-timeout)MQTT connection timeout, ms5000 (default)
Group / Edge Node ID must match the broker-side publisher (NBIRTH)

Check which group / edge ID the sending side (Eclipse Tahu / Ignition / Cirrus Link MQTT Engine, etc.) uses to send NBIRTH, and enter the same value. Setting edge-node-id=+ subscribes to all nodes in the group at once.


Tag PLC address notation​

The Sparkplug metric identifier uses only the part after the group (group is separated out as a driver option).

NotationMeaning
edge1/TemperatureNode-level metric Temperature of edge node edge1
edge1/motor1/RPMMetric RPM of device motor1 under edge node edge1
edge1/dev2/Statuse.g. device status boolean
Name vs alias

On the Sparkplug sending side, metric names and aliases (numeric) are published together during NBIRTH/DBIRTH. Afterward, NDATA/DDATA send only the alias to reduce payload size. Since the PlantPulse driver automatically maintains the alias↔name map, users only ever need to enter the name.


Automatic data type detection​

The Sparkplug B Payload specifies a datatype for each metric (Int8/16/32/64, UInt8/16/32/64, Float, Double, Boolean, String, DateTime, Bytes, etc.). The driver converts to the appropriate type based on the wire datatype and caches it as a String, so match the tag's data_type as follows.

Sparkplug datatypeRecommended data_type
Int8 / Int16 / Int32 / UInt8 / UInt16 / UInt32Integer
Int64 / UInt64 / DateTimeLong
FloatFloat
DoubleDouble
BooleanBoolean
String / Text / UUIDString

Writing (NCMD / DCMD)​

PlantPulse's write automatically branches into NCMD/DCMD.

  • edge1/SetPoint (segment 2) → NCMD publish (node-level command)
  • edge1/dev1/SetPoint (segment 3+) → DCMD publish (device-level command)

Currently, this phase publishes all command values with String datatype. Since the sending side (Tahu / Ignition) knows the metric's datatype, conversion is usually automatic.



Export — Edge publishing as Sparkplug B​

Exports values collected by Edge as standard Sparkplug B (Protobuf). This is the opposite direction of "Receive" described earlier.

🔴 Where it goes first — not the Platform, but the «broker on Edge»

The publish target is Edge's own MQTT settings (mqtt.server.host, default 127.0.0.1:1883). This is not a feature that sends to the Platform.

Think of the direction like this — when Edge publishes to the broker on itself, whoever subscribes to that broker (SCADA · MES · upstream IIoT platform) receives it. Values going up to the Platform take a separate path from this.

Topic format​

spBv1.0/{groupId}/{type}/{edgeNodeId}[/{deviceId}]
PositionWhat goes here
groupIdsparkplug.group.id — if empty, the site id
edgeNodeIdsparkplug.edge.node.id — if empty, the edge id
deviceIdOPC connection id (opc_id) — one connection is one device

Configuration​

KeyDefaultWhat
sparkplug.enabletrueTurn on publishing
mqtt.server.host · .port127.0.0.1 · 1883Target broker for publishing — uses Edge's MQTT settings as-is
mqtt.server.user · .password—Broker credentials
sparkplug.group.idSite idGroup in the topic
sparkplug.edge.node.idEdge idNode in the topic
sparkplug.device.strategyper-opcOne OPC connection = one device
sparkplug.qos0MQTT QoS
sparkplug.alias.enabletrueReduce payload with alias
sparkplug.cmd.enablefalseReceive commands (NCMD/DCMD)
sparkplug.bdseq.path/data1/pp-data/sparkplugb/bdseqFile to store bdSeq
device.strategy is currently just per-opc

The config comment also mentions single, but it is not yet implemented. Currently it only works as per-opc.

The metric name is the tag id​

🔴 What goes in the metric name position is the tag_id — not the tag name (tag_name), and not a hierarchy path.

tag_name follows along as a metric's attribute.

Edge's fieldSparkplug attribute
Descriptiondocumentation
Tag namedisplayName — omitted if identical to the tag id
UnitengUnit

The axis that breaks the consumer side is tag_id. Changing the display name shown on screen is safe, but changing the tag id breaks the mapping on the receiving side.

Lifecycle — connect and disconnect​

  1. When connecting to the broker, NDEATH is registered as the will — if Edge suddenly dies, the broker notifies on its behalf
  2. Sends NBIRTH
  3. Sends DBIRTH for all devices in sequence
  4. From then on, values flow via DDATA

Only after NBIRTH and the full DBIRTH have "finished" is the initial BIRTH marked complete — if it fails midway, it remains incomplete.

bdSeq is kept in a file (path in the table above). So when Edge restarts, on the consumer side, the previous session's NDEATH (old bdSeq) goes out first, followed by the new NBIRTH with incremented bdSeq, then all DBIRTH follow. If the file doesn't exist or can't be read, it starts from scratch.

alias — numbers change on reconnect​

With alias.enable=true (default), it behaves as standard — BIRTH carries both name and alias together, and afterward DDATA sends only the alias. This makes the payload smaller.

Consumers must re-read the mapping «every time a new BIRTH arrives»

Alias numbers are assigned as 1, 2, 3 … per session. On reconnect, the same tag may get a different number. If you hold onto an old mapping, the value gets attached to the wrong tag — the display looks fine but the value is wrong.

Receiving commands — cmd.enable​

Receiving NCMD · DCMD is implemented and off by default (sparkplug.cmd.enable=false). Since this is a feature being rolled out gradually, the default is off.

Check before turning this on

Opening the command topic means anyone who can connect to the broker can send commands to Edge. Whether that command actually leads to writing to equipment depends on deployment and configuration, so before turning it on, check both broker access control and write permissions.

The "Sparkplug topic" on the Platform screen is different​

The UNS screen in the Platform console also shows Sparkplug-style topics. That is a preview showing how names are constructed, and is separate from the export feature described in this document.

  • Eclipse Tahu — <https://eclipse.dev/tahu/>
  • Sparkplug Spec v3.0 — <https://sparkplug.eclipse.org/specification/>
  • Cirrus Link MQTT Engine — <https://www.cirrus-link.com/mqtt-engine/>