Message queuing telemetry transport (MQTT) is a lightweight open-source messaging protocol for devices and low-bandwidth, high-latency, or unreliable networks. IBM created it in the late 1990s, and it has become a crucial component of the Internet of Things (IoT) and Supervisory Control and Data Acquisition (SCADA) (opens in new tab).
The MQTT protocol operates on a publish and subscription model. This means that devices (known as clients) can publish messages to a broker (the backend system), which then distributes these messages to other devices that have subscribed to the relevant topics. MQTT's simplicity, efficiency, and ability to provide real-time communication make it an ideal protocol for a wide range of applications, from smart devices to industrial automation systems. Below is a detailed diagram of how the MQTT protocol operates with IoT devices:
The latest version of MQTT is 5.0 (opens in new tab), which introduced several enhancements over the previous version (3.1.1).
Some of the latest features in MQTT 5.0 include:
MQTT is adopted across different industries due to its versatility. Here are some key sectors where MQTT is prominently used:
Using MQTT involves several steps, from setting up an MQTT broker to configuring clients for publishing and subscribing messages. Below is a detailed guide on how to use MQTT:
In MQTT, the primary operations are publish and subscribe. When a client wants to send data to the broker, it publishes a message to a specific topic. This action is called a publish. When a client wants to receive data from the broker, it subscribes to a topic or set of topics. By subscribing, the client indicates interest in receiving messages published to those topics. Once subscribed, the client will receive all messages published to those topics from that point on.
The data sent between clients and the broker are referred to as messages. These messages can vary, including sensor readings, log messages, telemetry data, heartbeats, or even commands that trigger actions. Along with the message, the publisher specifies a Quality of Service (QoS) level, which determines the guarantee of message delivery. The QoS levels are:
Users can choose the appropriate QoS level to balance the trade-offs between reliability and performance based on their specific application needs.
Let's consider a smart manufacturing facility with multiple IoT devices. This facility is a process manufacturing plant that produces petrochemicals. A key safety point at this kind of facility is measuring the overall temperature of assets and the environment. Below are the different types of devices that would be used at the facility and how they would be subscribed to MQTT:
While the MQTT protocol and hypertext transfer protocol (HTTP) are widely used for communication, they serve different purposes. MQTT is ideal for IoT applications requiring efficient, real-time communication with numerous devices over constrained networks. While HTTP remains the protocol of choice for traditional web applications where request/response interactions are predominant.
Below is a table to help you understand the key differences between the two communication protocols based on functionality and features:
MQTT is widely regarded as the best protocol for IoT, SCADA, and is growing in importance for PdM for several reasons. Let’s review why MQTT excels in these areas:
MQTT continues to grow in popularity due to its numerous benefits. Although HTTP has remained a common choice for traditional web applications, MQTT is the preferred method when working with numerous devices over constrained networks. Understanding the differences helps you choose the right protocol for your specific use case.
Leverage the cloud to work together, better in the new connected age of maintenance and asset management.