Message Queuing Telemetry Transport (MQTT)

MQTT is a lightweight, publish-subscribe network protocol that transports messages between devices. The protocol usually runs over TCP/IP.

The MQTT protocol defines two types of network entities: message broker and clients.
An MQTT broker is a server that receives all messages from the clients and then routes the messages to the appropriate destination clients.
An MQTT client is a device that connects to an MQTT broker over a network to send/receive messages.

MQTT information is organized in a hierarchy of topics. When a publisher has a new item of data to distribute, it sends a control message with the data to the connected broker. The broker then distributes the information to any clients that have subscribed to that topic. The publisher does not need to have any data on the number or locations of subscribers, and subscribers, in turn, do not have to be configured with any data about the publishers.

MQTT broker

The MQTT broker is responsible to route the messages between clients according to MQTT specifications.

The MQTT broker routes the messages based on the topic. When a message is published by a client, the MQTT broker sends the message to each subscribers of the relevant topic.

One popular MQTT broker is Mosquitto, available for a large number of operating systems, including Windows, Linux and Mac. For home environment, it can run on Raspberry Pi.

MQTT clients

There are several types of MQTT clients. On one side there are IoT devices can be implemented as MQTT clients. On the other sides there application servers that can be implemented as MQTT clients to provide automation and monitoring tasks.

The following frameworks support MQTT on device side:

The following automation environments support MQTT on server side:

IoT architecture based on MQTT

It is possible to implement a wide range of Internet-of-Things (IoT) applications with ESP32, thanks to its specific features. An example of IoT is to provide temperature and umidity via wireless interface. This example is based on the following items:
  • IoT devices (sensors, actuators, switches...)
  • Application server, it perfomrs automation and monitoring
  • Any web browser, it displays the temperature and umidity using the application server
The following figure shows the architecture:



Creative Commons Attribution-Share Alike | Terms and conditions | Privacy policy