Understand the difference between the IoT gateway protocol MQTT and Modbus in one article

The key to Internet of Things (IoT) technology is communication, and various protocols play an important role in connecting the vast number of “things” to the Internet. This article introduces two complementary IoT protocols: Message Queuing Telemetry Transport (MQTT), a scalable Internet protocol that supports global communication in the IoT, and Modbus, a local protocol for short-distance device connections, giving you a detailed understanding of the differences between them. the difference.

MQTT protocol

MQTT is an open, lightweight machine-to-machine protocol designed for IoT interactions. The MQTT network contains an MQTT broker, which is responsible for coordinating interactions between MQTT brokers. Agents are publishers responsible for publishing information for use by users.

Шлюз DTU/Edge Gateway/IoT-платформа/шлюзовой модульШлюз DTU/Edge Gateway/IoT-платформа/шлюзовой модуль

MQTT has very few requirements as it is designed for embedded devices with limited resources. In addition to its small footprint, MQTT offers excellent communication efficiency (even over low-bandwidth networks) and very little overhead (compared to protocols such as HTTP). In 3G networks, MQTT’s throughput speed is 93 times faster than Representational State Transfer (REST) ​​using HTTP.

MQTT implements a publish/subscribe pattern by using minimal methods to indicate the operations to be performed on a specific topic. Agents connect to brokers before publishing or subscribing to topics. Once completed, the agent will disconnect from the broker. MQTT method definition:

  • Connect – Establish a connection to the MQTT broker.
  • Disconnect – Disconnect from the MQTT broker.
  • Publish – Publish a topic on the MQTT broker.
  • Subscribe – Subscribe to a topic from an MQTT broker.
  • Unsubscribe – Unsubscribe from the topic on the MQTT broker.

MQTT allows defining quality of service (QoS). There are three levels of QoS in MQTT:

QoS 0: This level represents “at-most-once” delivery (best case scenario). The message will not be confirmed, so this is a one-and-done approach.

QoS 1: This level indicates “at least once” delivery. Users may get messages more than once, but the recipient is allowed to acknowledge receipt.

QoS 2: The slowest but most guaranteed quality of service level is level 2. QoS2 stands for “just once” and consists of a four-phase delivery handshake. This level is the slowest, but the safest.

The QoS level you choose will depend on the importance of the data and its delivery.

Modbus protocol

Modbus is a serial communication protocol that has evolved into a comprehensive set of protocols supporting multiple physical links (such as RS-485). The core of Modbus is a serial communication protocol using master-slave mode. The master sends a request to the slave, and the slave replies. In a standard Modbus network, there is one master and up to 247 slaves (however, if 2-byte addressing is used, this limit can be increased significantly).

Шлюз DTU/Edge Gateway/IoT-платформа/шлюзовой модульШлюз DTU/Edge Gateway/IoT-платформа/шлюзовой модуль

MQTT With RS-485, communication between master and slave occurs in frames indicating function codes. This function code identifies the function to be operated, such as reading an independent input; reading a first-in-first-out queue; or executing a diagnostic function. The slave then responds based on the function code received, which is a simple response indicated by a set of bytes. Therefore, slaves can be smart devices or simple devices with only one sensor.

From this description, you can see that the Modbus protocol is very simple, but its openness as a protocol makes it the de facto communication protocol for entire industries or SCADA systems.

MQTT and Modbus can complement each other to improve the performance of the Internet of Things. Using Modbus as a local interface to manage devices and using MQTT as a global protocol to extend the scope of the device both play an important role.

X

Для заполнения данной формы включите JavaScript в браузере.
Введите данные о продукте, такие как конфигурация интерфейса, среда и т.д., а также другие специфические требования, чтобы получить точное предложение.

ru_RURussian
Для заполнения данной формы включите JavaScript в браузере.
Введите данные о продукте, такие как конфигурация интерфейса, среда и т.д., а также другие специфические требования, чтобы получить точное предложение.