Why Sparkplug B?

A vanilla MQTT message topic and payload may be as simple as “My Plant/Tank 1/Temperature” and “21.3”. This may work well for a simple IoT device, but it has limitations for industrial applications dependent on real-time communications. For example, what do you do when you have a PLC with hundreds of messages that need to be continually published? What happens when the internet goes down? What time was the value recorded? What are the engineering units?
Enter Sparkplug B: an industry specification that addresses these and other issues.

How does Sparkplug B Address MQTT Issues?

Sparkplug B is a specification for MQTT messages that specifies a standard for the message topic and a standard for the message payload.

The biggest difference between a vanilla MQTT message and a Sparkplug B structured message is the message payload. Whereas a vanilla MQTT message payload may be “21.3”, a Sparkplug B message payload bundles multiple devices, timestamps, and context all together. What may take hundreds of vanilla MQTT messages can be handled with one Sparkplug B message.
Another nice feature is that a Sparkplug B message can send multiple time-series values for the same device in one message. Thus, it can provide store-and-forward capability in case a network connection is lost.
Sparkplug B is also stateful, meaning it is ‘aware’ of network failures, low bandwidth, high latency, or anything else it might encounter. This functionality lets systems know if there is a disconnection to start buffering or change message size to continue the flow of data.

The illustration shows an example Sparkplug B message payload.

sparkplug b code example<br />

What Else Can Sparkplug B Do for Me?

Two of the other benefits of Sparkplug B are security and that it provides plug-and-play solutions:

  • Security It uses encryption to ensure the integrity and confidentiality of the data.
  • Plug and Play Many vendor products now embed Sparkplug B messages into their applications. For example, a SCADA system may publish its data using Sparkplug B and a Sparkplug B aware data historian can subscribe to the messages. This allows the two systems to easily work together with minimal configuration.

The Sparkplug B specification is hosted by the Eclipse Foundation. You will find a copy on their website.