Advisory Schedule a Technical Discovery Call — Book your session today! »

· Industrial Protocols  · 2 min read

MQTT Payload Design for IIoT: JSON vs Sparkplug B

Architecting your message format is as important as the protocol itself. Deep guide on binary efficiency, state management, and standardization with Sparkplug B.

Architecting your message format is as important as the protocol itself. Deep guide on binary efficiency, state management, and standardization with Sparkplug B.

Many IIoT projects fail to scale because engineers use the format that is easiest for them: a messy JSON. “Bandwidth is cheap,” they say. Until they have 500 machines sending data every 100ms and the broker collapses.

In this guide, we will compare the JSON approach (flexible but noisy) with the industry gold standard: Sparkplug B.

1. The “Vanilla MQTT” Problem

MQTT is a “messaging agnostic” transport. The broker doesn’t care if you send a JPG, a JSON, or a PDF. This generates the “Data Silo” problem: every integrator invents their own format.

If tomorrow you want to connect your broker to a SCADA like Ignition or a MES system, you’ll have to write custom code to map every single message.

2. JSON: Easy but Expensive

JSON is excellent for prototyping. Anyone can read it. But in IIoT, it has two critical flaws:

  1. Verbosity: Sending the word "temperature" 1000 times per second is a waste of bytes.
  2. Lack of State: MQTT has Last Will and Testament, but it doesn’t define how to synchronize the “birth” of a device in a structured way.

3. Sparkplug B: The IIoT Standard

Sparkplug B (developed by Cirrus Link and now part of the Eclipse Foundation) solves this by defining:

  • Standard Topic Namespace: spBv1.0/Group/TYPE/Edge_Node/Device.
  • Binary Payload (Google Protobuf): Data is compressed to the maximum.
  • State Management: Defines mandatory NBIRTH (Node birth) and NDEATH (Certified death) messages. This ensures your SCADA always knows which tags are online and which are “stale”.

👉 Code Comparison: mqtt-payload-toolkit

Payload Size Example

To send {"temp": 24.5, "press": 101.3}:

  • JSON: ~50-80 bytes.
  • Sparkplug B (Binary): ~15-20 bytes.

4. When to use which?

ScenarioRecommendation
Few devices, plenty of RAM, integration with web services.JSON
Thousands of devices, cellular networks (LTE/5G), industrial SCADA.Sparkplug B
Real-time and mission-critical control.Sparkplug B

Conclusion

If you are building an IIoT system that must last 10 years, standardize today. Sparkplug B may seem more complex at first, but it saves you months of integration work and thousands of dollars in cloud transfer costs.


Technical Sources:

Back to Blog

Related Posts

View All Posts »