EP Basics: IoT Protocols What is MQTT and what is it used for?

Von Sebastian Human 4 min Reading Time

MQTT is an open network protocol for transmitting messages. These messages transmit important information in the Internet of Things. It is primarily used when connections allow only a small amount of administrative data.

MQTT is designed for IoT devices and thus lightweight, which enables cost-effective device communication.(Image: freely licensed /  Pixabay)
MQTT is designed for IoT devices and thus lightweight, which enables cost-effective device communication.
(Image: freely licensed / Pixabay)

The abbreviation MQTT stands for Message Queuing Telemetry Transport. It is a lightweight communication protocol that was specifically developed for wireless sensor networks. For this reason, it is often used in automation technology, industrial communication, and not least in the Internet of Things (IoT). Originally decoupled devices can thus communicate directly with each other. It is an open protocol that has been standardized by OASIS and ISO (ISO/IEC 20922:2016).

It follows the principle of a Publish Subscribe model and operates on TCP/IP. In this function, it allows a device to send information to a broker and then forward it to other devices that are interested in this information.

It is a simple but powerful protocol. In its core function, it facilitates communication between different devices. Thus, it plays an important role in machine-to-machine communication or the Internet of Things.

What does the MQTT architecture look like?

The MQTT architecture consists of a server, also called a broker, one or more clients, and a network. The broker is the central intermediary that enables communication between the clients. It is responsible for receiving, storing, and sending messages to the clients.

The clients are the end devices that communicate with the broker. They can send messages to the broker and receive messages from the broker. These messages are also known as MQTT Message.

The network represents the connection between the broker and the clients. It can be either a local network or the internet. The so-called Quality of Service can be divided into three levels. This allows one to find the best individual compromise between the smallest possible data transmission and the greatest possible reliability for their own applications.

The Quality of Service starts at level 0. This level entails only a minimal data transfer. To keep the data volume as low as possible, this level relies on a maximum of one-time delivery. Confirmation of successful delivery is not provided at this level.

At level 1, the broker attempts to successfully transmit the message and then waits for confirmation from the subscriber. If this is not received within a defined period, the broker sends the information again. This is therefore referred to as at least once delivery.

At level 2, both the broker and the client use a four-step handshake. Through this, both instances guarantee that the message is sent or received exactly once. This is therefore referred to as exactly once delivery.

What does an MQTT broker do?

An MQTT broker is a server that acts as an intermediary between MQTT clients. It can therefore also be referred to as an MQTT server. It receives messages from the clients and forwards them to the clients that are interested in those messages. The broker is responsible for managing the messages and the connection between the clients.

What role does an MQTT client play?

An MQTT client is a program that uses the protocol to transmit messages between a server and one or more clients. It can be used to transfer data between different devices. For example, it transmits information between a smartphone and a computer or between a sensor and a server.

What tasks does MQTT perform?

This protocol is suitable for use in wireless sensor networks, for example, because it requires low bandwidth and low energy consumption. MQTT is also used to counteract unreliable networks. It is considered very reliable and ensures secure information transmission. It can also be used as a communication protocol between different devices and systems. In this function, it transmits data between these instances.

Who uses MQTT?

MQTT is mainly used by companies and organizations that require fast, reliable, and scalable communication between devices. Therefore, it is often used in the Internet of Things to transfer data between devices. Naturally, it is also used in the automation industry, healthcare, transportation, retail, and other sectors.

How can you install an MQTT broker on a Raspberry Pi?

To install an MQTT broker on a Raspberry Pi, you first need to install the operating system on the single-board computer. Then, you must open a terminal and enter the following commands:

Subscribe to the newsletter now

Don't Miss out on Our Best Content

By clicking on „Subscribe to Newsletter“ I agree to the processing and use of my data according to the consent form (please expand for details) and accept the Terms of Use. For more information, please see our Privacy Policy. The consent declaration relates, among other things, to the sending of editorial newsletters by email and to data matching for marketing purposes with selected advertising partners (e.g., LinkedIn, Google, Meta)

Unfold for details of your consent
  1. sudo apt-get update

  2. sudo apt-get install mosquitto

  3. sudo apt-get install mosquitto-clients

Afterward, the MQTT broker should start with the command "mosquitto -v". It is also possible to edit the configuration file to customize the broker according to individual requirements.

How secure is MQTT?

MQTT is considered a very secure protocol. It uses TLS encryption to encrypt all messages transmitted between client and broker. It also uses authentication and authorization to ensure that only authorized clients can access the broker. Additionally, users can also implement their own security measures such as firewalls or VPNs to further protect the communication.

What is MQTT Standard 5.0?

The MQTT standard 5.0 is the latest version of the Message Queuing Telemetry Transport protocol. It was developed to enable secure and reliable communication between devices. It offers a number of improvements over previous versions, including enhanced security features, advanced message control, and support for more message formats. These new features enable developers to create secure and reliable applications based on the MQTT protocol.