Evaluate the AutomationView desktop suite free for 30 days. No credit card required. Claim trial key →
arrow_back Back to Articles
HMI

Inside MQTT Sparkplug B: Architecting State-Aware HMI Communications

calendar_month
person Carvalho Raphael

Inside MQTT Sparkplug B: Architecting State-Aware HMI Communications

HMI
%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
flowchart LR
    A["Edge Node (PLC)"]:::blue -->|NBIRTH / NDEATH| B["MQTT Broker"]:::gray
    B -->|Subscribe| C["SCADA / HMI"]:::green
    B -->|Unified Namespace| D["MES / ERP"]:::purple

    classDef blue fill:#2563eb,color:#ffffff,stroke:#1e40af,stroke-width:2px;
    classDef gray fill:#4b5563,color:#ffffff,stroke:#374151,stroke-width:2px;
    classDef green fill:#16a34a,color:#ffffff,stroke:#166534,stroke-width:2px;
    classDef purple fill:#9333ea,color:#ffffff,stroke:#6b21a8,stroke-width:2px;
AutomationView Icon AutomationView

Key Takeaways

  • Standard MQTT lacks structured data and connection state monitoring, leading to fragmented SCADA implementations.
  • MQTT Sparkplug B standardizes the topic namespace, enabling plug-and-play interoperability for HMI systems.
  • Birth and Death certificates provide real-time connection state awareness without constant polling.
  • Protocol Buffers optimize bandwidth usage while enforcing strict data typing for industrial metrics.

When connecting hundreds of PLCs to a modern SCADA system, engineers frequently encounter a fundamental issue: raw MQTT is too flexible. While the lightweight pub/sub model is excellent for data transmission, the absence of a standardized data structure forces integrators to write custom parsing scripts for every vendor. Furthermore, standard MQTT provides no inherent mechanism to immediately detect when an edge device fails. MQTT Sparkplug B addresses these shortcomings, providing a deterministic framework for industrial HMI applications.

The Problem with Raw MQTT in Industrial Environments

In a standard MQTT setup, a sensor might publish temperature data to a topic like factory/line1/temp with a JSON payload of {"val": 45}. Another vendor’s PLC might use plant/oven/temperature with the payload {"temperature_celsius": 45.0, "status": "ok"}. This inconsistency prevents automatic discovery. The HMI developer must manually map each tag, increasing commissioning time and long-term maintenance overhead.

A more critical issue is state awareness. If a remote terminal unit drops its connection, the MQTT broker stops receiving messages. Without a continuous polling mechanism, the HMI continues to display the last known value indefinitely. Operators might interpret a stale “safe” temperature as current, leading to potentially dangerous operational decisions.

Architecting State Awareness with Sparkplug B

Sparkplug B introduces robust state management through the use of Birth and Death certificates. When an edge node connects to the broker, it publishes an NBIRTH (Node Birth) message containing all its supported tags and data types. The HMI system instantly reads this metadata, enabling true automatic discovery.

To handle disconnections, Sparkplug B leverages the MQTT Last Will and Testament feature. The edge node registers an NDEATH (Node Death) message with the broker upon connection. If the node disconnects unexpectedly, the broker immediately broadcasts the NDEATH message. The HMI instantly marks all associated tags as “stale” or “offline,” alerting the operator without relying on slow polling loops.

flowchart TD
    subgraph edge_network ["Edge Network"]
        plc1["PLC (EoN)"]:::blue
        plc2["Sensor Gateway"]:::blue
    end

    broker["MQTT Broker (Central Hub)"]:::gray

    subgraph enterprise ["Enterprise / SCADA"]
        hmi["Primary HMI Application"]:::green
        historian["Time-Series Historian"]:::purple
    end

    plc1 -->|NBIRTH/DBIRTH Data| broker
    plc2 -->|DDEATH/NDEATH State| broker
    broker -->|Push Updates| hmi
    broker -->|Push Updates| historian

    classDef blue fill:#2563eb,color:#ffffff,stroke:#1e40af,stroke-width:2px;
    classDef gray fill:#4b5563,color:#ffffff,stroke:#374151,stroke-width:2px;
    classDef green fill:#16a34a,color:#ffffff,stroke:#166534,stroke-width:2px;
    classDef purple fill:#9333ea,color:#ffffff,stroke:#6b21a8,stroke-width:2px;

Structured Topic Namespace and Payloads

Sparkplug B dictates a rigid topic structure: spBv1.0/[Group ID]/[Message Type]/[Edge Node ID]/[Device ID]. This uniformity guarantees that any compliant application knows exactly where to find specific data points and what the message type implies (e.g., data update, birth certificate, command).

Instead of verbose JSON or CSV, Sparkplug B utilizes Google Protocol Buffers for the payload. This binary format significantly reduces bandwidth consumption, which is highly advantageous for cellular or low-bandwidth networks. Additionally, the payload enforcing strict data typing ensures that a floating-point temperature value cannot be accidentally parsed as a string by the HMI.

Comparing MQTT Protocols for HMI

Feature Standard MQTT MQTT Sparkplug B
Topic Hierarchy Freeform / Proprietary Strictly Defined
Payload Format Undefined (usually JSON) Google Protocol Buffers
State Management Manual Implementation Native (Birth/Death Certificates)
Tag Discovery Manual Mapping Automatic
Bandwidth Efficiency Low to Medium (JSON parsing) High (Binary compression)

Conclusion

Adopting MQTT Sparkplug B transitions the HMI architecture from a brittle, point-to-point configuration into a scalable Unified Namespace. By enforcing a standardized payload, strict topic hierarchy, and native state management, automation teams can drastically reduce integration time and eliminate stale data artifacts on operator displays.

FAQ

Why use Protocol Buffers instead of JSON for the payload?

Protocol Buffers serialize data into a compact binary format, drastically reducing payload size compared to plain text JSON. This efficiency is critical for high-frequency telemetry over restricted networks.

Can standard MQTT clients read Sparkplug B messages?

Any MQTT client can subscribe to the topics, but extracting the data requires a Protocol Buffers decoder aware of the Sparkplug B schema.

Ready to upgrade your control room infrastructure? Explore our highly optimized HMI templates and PLC scripts in the AutomationView Store to accelerate your next deployment.

Share this article

Stay Updated with HMI

Get the latest articles and news delivered directly to your inbox.

Log in to Subscribe

You must be registered and logged in to manage subscriptions.

Recommended for you

WebSocket vs SSE: Architecting Real-Time HMI Telemetry

HMI
%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
flowchart LR
    client["Web HMI Client"]
    server["SCADA Gateway"]

    client -->|"HTTP Upgrade (ws://)"| server
    server -->|"Full-Duplex (WebSocket)"| client
    
    client -.->|"Standard HTTP"| server
    server ==>|"Unidirectional Push (SSE)"| client

    classDef wsFill fill:#2563eb,color:#ffffff,stroke:#1e40af
    classDef sseFill fill:#16a34a,color:#ffffff,stroke:#166534
    
    client:::wsFill
    server:::wsFill
AutomationView Icon AutomationView
calendar_month

WebSocket vs SSE: Architecting Real-Time HMI Telemetry

WebSocket vs Server-Sent Events (SSE) for Real-Time HMI Telemetry Modern industrial control systems require sub-second data streaming to provide operators with accurate situational awareness. When architecting web-based HMI telemetry dashboards, automation engineers face a critical decision: should you implement full-duplex WebSockets or rely on unidirectional Server-Sent Events (SSE)? Both protocols eliminate legacy polling techniques, but […]

Read Article arrow_forward

Offline-First SCADA Dashboards: PWA & Service Worker Implementation

HMI
%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
flowchart LR
    client["PWA Dashboard"]:::clientStyle
    sw["Service Worker"]:::swStyle
    cache["Local Cache (IndexedDB)"]:::cacheStyle
    server["SCADA Server"]:::serverStyle
    
    client -->|Requests Data| sw
    sw -->|Network Available| server
    sw -->|Network Down| cache
    server -->|Updates| cache
    
    classDef clientStyle fill:#2563eb,stroke:#fff,stroke-width:2px,color:#fff
    classDef swStyle fill:#16a34a,stroke:#fff,stroke-width:2px,color:#fff
    classDef cacheStyle fill:#dc2626,stroke:#fff,stroke-width:2px,color:#fff
    classDef serverStyle fill:#9333ea,stroke:#fff,stroke-width:2px,color:#fff
AutomationView Icon AutomationView
calendar_month

Offline-First SCADA Dashboards: PWA & Service Worker Implementation

The Reality of Plant Floor Connectivity Walk the floor of any heavy manufacturing facility, and you will quickly realize that ubiquitous, high-speed Wi-Fi is a myth. Dead zones behind massive metal enclosures, high electromagnetic interference (EMI) from variable frequency drives, and network congestion frequently cause transient connection drops. For an operator monitoring a critical process […]

Read Article arrow_forward

Advanced Alarm Management in Modern HMI: A Technical Guide to ISA-18.2 Implementation

HMI
%%{init: {'theme':'dark', 'themeVariables': { 'background': '#001c38' }}}%%
flowchart LR
    A["Nuisance Alarms"]:::redNode -->|Rationalization| B["ISA-18.2 Guidelines"]:::blueNode
    B -->|Actionable Content| C["Prioritized HMI"]:::greenNode
    classDef redNode fill:#dc2626,stroke:#7f1d1d,color:#ffffff
    classDef blueNode fill:#2563eb,stroke:#1e3a8a,color:#ffffff
    classDef greenNode fill:#16a34a,stroke:#14532d,color:#ffffff
AutomationView Icon AutomationView
calendar_month

Advanced Alarm Management in Modern HMI: A Technical Guide to ISA-18.2 Implementation

Every day, automation engineers face the daunting task of managing alarm floods in their SCADA systems, where hundreds of meaningless faults can obscure a single critical failure. The transition to modern HMI design demands a structured approach to filter the noise and provide operators with actionable insights. This is where ISA-18.2 alarm management comes into […]

Read Article arrow_forward