What is MQTT and Why You Need It in Your IoT Architecture
If you play in the IoT or Industrial IoT (IIoT) space, you may have heard of the MQ Telemetry Transport (MQTT) protocol. In addition to being used as an underlying communications protocol for IIoT, MQTT is used in smart home automation systems alongside cloud platforms such as Microsoft Azure, AWS and IBM Watson. Facebook also uses MQTT as a communication protocol for its Messenger and Instagram platforms.
The Industrial Internet of Things (IIoT) can be loosely defined as a system of sensors and other devices interacting with industrial and manufacturing systems all in an effort to enhance business operations. Industries like manufacturing, mining, oil & gas and agribusiness, to name just a few, deploy massive numbers of sensors. These sensors in turn send critical telemetry data to analytics engines, where the data is analyzed for trends and/or anomalies, enabling organizations to better understand and improve their operations.
In environments using Low Power Wide Area Network (LPWAN) solutions, sensor data is sent over wireless radio transmissions where it is received by one or more central base stations. This data, small as individual packets but massive when aggregated together, is then sent to analytics and visualization tools whether in the cloud or on-premises. That’s where MQTT comes in. Residing on top of the TCP/IP network stack, MQTT is a lightweight publish/subscribe messaging protocol designed for low-bandwidth, high latency, unreliable networks. MQTT’s features make it an excellent option for sending high volumes of sensor messages to analytics platforms and cloud solutions.
History of MQTT
MQTT was invented in 1999 by engineers Andy Stanford-Clark and Arlen Nipper, as a method of allowing pipelines in the oil and gas industry to communicate with Supervisory Control and Data Acquisition (SCADA) systems. At the time, these systems used disparate, proprietary protocols, and, as such, were not able to communicate with each other. Adding MQTT capabilities helped overcome inter-communication problems. In addition to interoperability, the original goals for the protocol were that it should be lightweight, bandwidth efficient, data agnostic and simple to implement while offering quality-of-service data delivery.
Unlike the traditional client-server model, in which a client communicates directly with an endpoint, MQTT clients are split into two groups: A sender (referred to as a publisher in MQTT) and a consumer that receives the data (an MQTT subscriber). The publisher and the subscriber do not know anything about each other, and, in fact, are never in direct contact with each other. A third component (an MQTT broker), acts like a ‘traffic cop’, directing messages from the publisher to any end points acting as subscribers.
Messages make their way from a publisher, through a broker, to one or more subscribers using topics. Topics are hierarchical UTF-8 strings. Each level in a topic is delimited by a forward slash. Every message from a publisher must include a topic. To receive the published message, the entity that consumes the message must subscribe to the same topic. A broker sends the message it receives only to those clients that have subscribed to the same topic. Examples of topics are:
MQTT and LPWAN
In environments using LPWAN solutions such as MIOTY by BehrTech, base stations perform the role of MQTT publisher. When a base station receives a message from a sensor, the base station publishes the message to the MQTT broker on behalf of the sensor. The broker then sends the message over TCP/IP to whatever device or devices that have subscribed to the topic.
MQTT is natively supported on BehrTech base stations. MQTT brokers and mappings for publishing data are configured with ease. Our out-of-the-box Azure integration also uses MQTT in its underpinnings. Another way in which we use MQTT is through the Node-RED programming tool. Performing the role of the subscriber, Node-RED takes incoming sensor data, processes it and sends it to visualization dashboards. As the published messages from the base station continue, Node-RED dashboards are updated on the fly.
Going forward, as organizations continue to move to LPWAN solutions in order to take advantage of its many benefits, the popularity of MQTT in the IoT architecture will grow as well.
Subscribe to Our Monthly Blog Roundup
Get Best-in-Class Wireless Connectivity with MYTHINGS™
Contact a MYTHINGS™ Platform Expert to learn more about MQTT or LPWAN solutions in general.