3.1.2 MQTT

MQTT is the de-facto standard for communication in the IoT

Message Queuing Telemetry Transport, or MQTT, is a simple lightweight protocol for transmitting data between machines. Originally developed to monitor an oil pipeline via a satellite link, it has since become one of the most important protocols in the IoT.

It is a possible implementation of an event-driven architecture.

How it works

The main takeaway from this video should be the terms “broker”, “pub/sub”, “quality of service” and “topics”


There are two aspects of MQTT security:

  1. Authentication
  2. Authorization

Both have a similar name, but actually mean something different.

At first, a devices needs to authenticate themselves at the MQTT broker. This means that the MQTT broker checks, whether the device is the device it says it is. This could be either username/password or certificates. To understand how certificates work and how you can use them, you can take a look at our blog article: An introduction into certificates and secure communication in IoT for normal people

After the authentication step, there is the authorization step. Is the device allowed to do the action it wants to do? For this we typically use an Access Control List (ACL), where you can specify rules about which device can read/write into which topic.

Sparkplug B

There are two challenges with using plain MQTT:

  1. the payload and topic structure is not defined
  2. there are no metadata about the devices (e.g., whether it is connected)

Sparkplug B is a specification on top of MQTT that is addressing these issues.

The United Manufacturing Hub is not using Sparkplug B as we see two major problems:

  1. Sparkplug B has a lot of overhead and organizes message payload and topic on a physical level. There is no difference whether the data is now a raw vibration or a new product order, which makes it hard to keep the overview. It is good for keeping track of the pure physical device layer, but one device can connect to multiple assets (or the other way around). We use instead a more practical oriented data model
  2. When trading off complexity with the advantage of having some metadata, we chose a lower complexity. In the Industrial IoT devices are typically always online (and if they are offline, the production asset is likely offline as well). For AGVs, mobile handheld devices or the general IoT this might be different and Sparkplug B can add value.

But make your own mind on this topic: you can find the standard on the Eclipse page

What next?

To understand how to properly use MQTT for data processing or when and where not to use it, please take a look at the following blog article: Tools & Techniques for scalable data processing in Industrial IoT

For a practical guide on MQTT, you can take a look at Steve’s Internet Guide - a practical guide to MQTT and mosquitto

Last modified October 5, 2022: Historian article (#107) (5f30dc0)