One of the most popular industrial IoT
(IIoT) protocols for data communications
is MQTT. Originally developed
for the oil and gas sector, it is efficient, quick,
and secure, making it ideal for connecting field
devices to a central SCADA system and passing
data between them. With the advent of IIoT
and Industrie 4.0, many automation professionals
have turned to MQTT as a useful protocol for
connecting devices to the cloud. But MQTT has
its drawbacks. For example, it does not have a
standardized data format to define how data is
sent and received, causing interoperability issues.
To address this problem, Sparkplug B was created.
Sparkplug B provides a topic namespace, state
management, and payload definition for MQTT. It
classifies MQTT clients as either edge of network
(EoN) devices that produce data, or as applications
that consume data. Each Sparkplug B device
produces messages of various kinds, like a “birth”
message to show it has come online, “data” messages
for sending data, and a “death” message when
it goes offline. Any Sparkplug B application that is
online receives these messages and is kept informed
of which data is coming from which device.
A smart MQTT broker
for Sparkplug B
The Sparkplug B specification makes MQTT a better
choice for a range of IIoT applications. And yet
even more can be done by enabling an MQTT broker
to parse messages. By design, MQTT is a transport
protocol. The broker that connects the clients
acts like a postal service, passing along letters but
not knowing the contents. An MQTT broker that
can parse and act on the content of the messages
as they stream through becomes a smart broker. A
smart MQTT broker that also supports Sparkplug
B provides some unique capabilities beyond what a
normal Sparkplug B broker can offer.
For example, it can:
Synchronize all applications. Because it is aware
of all connections, a smart broker can synthesize
a “birth” (startup) message for each connected
device whenever a new application comes online.
This allows that application to receive “data” messages
from all currently connected devices, eliminating
issues related to start-up order.
Respond to errors. In addition to its ability to
identify out-of-order or lost MQTT messages, a
smart broker can also automatically disconnect
a Sparkplug B device when these kinds of errors
occur and allow it to reconnect. This causes the
device to re-send its “birth” message, which resynchronizes
all receiving applications, thus maintaining
a single version of the truth.
Resolve failed writes to devices. Another useful
feature is the ability to check all write requests
from applications to devices, to ensure the specified
data value was written on the device. If the
smart broker detects that the value on the device
did not change, it forces the device to disconnect,
causing it to retransmit its “birth” message. This
resynchronizes all applications listening to that
device and is another way to maintain a single version
of the truth.
Add data quality information. For systems that
need to convert Sparkplug B data to other protocols,
a smart broker can add quality information.
For example, when converting Sparkplug B data to
OPC, it adds OPC data quality. “Birth” or “data”
messages are assigned the OPC data quality of
Good, while “death” (shutdown) messages can
take a Not Connected quality.