Article count:410 Read by:508512

Account Entry

Popular Science | What is MQTT and what is its value?

Latest update time:2022-03-01 19:22
    Reads:

Communication is an indispensable part of Internet of Things (IoT) applications. The communication requirements vary for different application scenarios, and the special requirements of these scenarios for the network environment can also be captured.


Today, communication technologies such as cellular networks, wireless connection technologies (such as Wi-Fi and Bluetooth), wired Ethernet, and satellites are widely used in various IoT devices, but communication protocols are the key component of all IoT technology stacks . Only through specific communication protocols can IoT devices transmit and exchange data.


In order to meet the diverse needs of current IoT applications, a variety of protocols including CoAP, XMPP and DDS are available on the market for selection in various application scenarios. Among them, Message Queuing Telemetry Transport (MQTT) and its derivative protocol MQTT-SN are widely used in the increasingly common Low Power Wide Area (LPWA) networks.



This article will share with you a lightweight protocol - MQTT, and elaborate on the advantages of MQTT application on various IoT devices.


Sneak peek

1. MQTT protocol

2. MQTT Function Overview

3. MQTT-SN

4. MQTT core concepts

5 Conclusion


1. MQTT protocol


As a lightweight protocol, MQTT has a simple and compact architecture and a small code footprint , making it suitable for low-cost, low-power IoT microcontroller devices. MQTT can run on the TCP/IP protocol and specializes in network environments with high latency and poor quality. The protocol is suitable for applications with the following communication requirements:


  • Use very little bandwidth

  • Wireless network communication

  • Low power consumption

  • Ensure high reliability when necessary

  • Low demands on processing and memory resources


MQTT is popular in many IoT applications, such as smart meters, asset tracking tools, and connected sensors for industrial equipment. Its efficient use of limited bandwidth makes MQTT ideal for use cases where network costs are high and power consumption is high , such as remote sensor arrays that need to operate autonomously in the field for years without maintenance.


MQTT is a many-to-many protocol for multiple clients to transmit information through a central server. It can efficiently distribute information to one or more subscribers. In addition, its small code footprint makes MQTT an ideal choice for mobile application communication.


2. MQTT Function Overview


MQTT is based on a publish and subscribe model , rather than a client-server model. It has two functional entities: the MQTT server and the MQTT client. Any "thing" on the IoT network, whether it is a hardware device or a software program, can be considered a client of MQTT.


All clients do not publish or subscribe to messages directly to each other, but publish or subscribe to messages to "topics" managed by the MQTT server. "Topics" can be understood as email inboxes; when a client publishes a message to a topic, other clients subscribed to the topic will receive the message.


The MQTT server is responsible for receiving all published messages and ensuring their delivery to all subscribed clients. Messages are published according to multiple agreed QoS levels (see below). The server will also authenticate all IoT devices on the network and manage connections, sessions and subscriptions.


Figure 1: What is MQTT

(Source: MQTT Org)


3. MQTT-SN


MQTT-SN is an optimized version of MQTT, designed for large-scale wireless sensor networks that require improved data transmission efficiency and power consumption efficiency.


MQTT-SN improves data transmission efficiency by shortening the length of topic IDs . These shortened IDs are programmed into the client and server, thereby reducing the amount of information transmitted.


The "link hold mechanism" in MQTT-SN allows a device to enter sleep mode and retrieve any queued messages when woken up.


4. MQTT core concepts


In addition to the server and client entities, MQTT and MQTT-SN operations also involve the following core concepts:


MQTT Topics


The topic is the basis for MQTT to achieve efficient use of bandwidth. It has a multi-level structure, as shown in Figure 2. The MQTT client only subscribes to the topics it is interested in, and can use wildcard entries to access multiple topics.


Figure 2: MQTT topic (Source: u-blox)


Since devices only receive messages from subscribed topics, MQTT topics will organize data flows more efficiently through IoT networks, thereby enabling large-scale applications.


Connections


An MQTT client must establish a connection with a server to publish or subscribe to messages. The client provides its client ID, username, and password when sending a connection request, and the server then confirms the request. The connection request can also be qualified using the following parameters:


  • MQTT Session (Clean Session) - Requests a connection and deletes any messages already stored in the subscription queue.


  • Keep Alive - When no messages are sent by the server or client, the Keep Alive feature will prioritize ensuring the device is connected for the longest time, providing support for other battery-powered devices in sleep mode. During this time, any messages received by the client will be stored by the server until the specified time is up.


  • Sleep (MQTT-SN only) - When a device tells the server that it is going into sleep mode, the server queues all messages that the device has subscribed to for the time period the device has told it about. The main difference between this mode and "link hold" mode is that the server stores all messages regardless of QoS level, whereas in "link hold" mode only QoS 1 and QoS 2 messages are stored. While in sleep mode, the client can also flush its message queue without waking up.


subscription


A client can request to subscribe to one or more topics. The request supports two different wildcard settings, as shown in Figures 3a and 3b.


The single-level (+) wildcard character is used to replace one topic level, so "sensors/+/out" will subscribe to the following topics:


sensors/soil/out


sensors/water/out


sensors/light/out


△ Figure 3a: Single-level wildcard

The multi-level (#) wildcard character is used to replace multiple topic levels, so this wildcard character can subscribe to the following topics:


sensors/soil/out


sensors/soil/in


sensors/temperature/out


△ Figure 3b: Multi-level wildcards


Message Service Quality QoS


Both MQTT and MQTT-SN specify message quality of service (QoS) modes, allowing publishers to define message quality. We summarize these modes (see Table 1) and share how to use different modes based on the constraints of specific applications.



The difference between QoS in publishing and subscribing


In MQTT publishing and subscription operations, QoS represents different meanings. The QoS during publishing refers to the QoS used when the message is sent to the server, and the QoS during subscription refers to the maximum QoS that the server can use when forwarding messages to itself.


When the publishing QoS of client A is greater than the subscription QoS of client B, the QoS used by the server when forwarding messages to client B is the subscription QoS of client B.


When the publishing QoS of client A is less than the subscription QoS of client B, the QoS used by the server when forwarding messages to client B is the sending QoS of client A.


5 Conclusion


Today, MQTT has been widely used in many key areas including Automobile, energy, manufacturing and telecommunications , and is particularly suitable for narrower bandwidth network environments and lower power consumption IoT devices. To simplify the development process of IoT, technicians can also choose MQTT testing tools including server and client according to their own needs.


Remember that "communication is more than just establishing a connection." Take the u-blox IoT communication as a service product portfolio as an example (see Figure 4). The three products of u-blox MQTT Anywhere, MQTT Here and MQTT Now are based on scalable, high-performance MQTT servers and data stream managers. They complement each other and can effectively help you shorten product development cycles and simplify data communication between IoT devices and enterprises.


Figure 4: u-blox IoT Communications as a Service portfolio


Learn more Product parameter information, product operation video,

Webinars, technical white papers and industry experts Share

Welcome to register u-blox open platform
One-click registration, online preview

Think what you want, use what you want


/About u-blox/


Swiss u-blox (SIX:UBXN) is a leading supplier of positioning and wireless communication technologies and services for the automotive, industrial and consumer markets. Its solutions enable accurate positioning of people, vehicles and machines and wireless communication over cellular and short-range networks. With a broad and diverse portfolio of chips, modules and a growing ecosystem of product-supported data services, u-blox is uniquely positioned to help its customers develop innovative solutions for the Internet of Things quickly and cost-effectively. Headquartered in Thalwil, Switzerland, u-blox currently has offices in Europe, Asia and the United States. www.u-blox.com


Previous Issues

Learn in one article | What is the black technology of real-time location system (RTLS)

u-blox and Douglas Lighting collaborate to develop Bluetooth Mesh platform for building automation

Double happiness at the beginning of the year | u-blox launches two LTE Cat 1 modules supporting global roaming



Click to read the original text and enter the u-blox official website

—— / END / ——



(Advertisement)
#Keywords: u-blox, MQTT, Internet of Things, IoT

Featured Posts


Latest articlesabout

 
EEWorld WeChat Subscription

 
EEWorld WeChat Service Number

 
AutoDevelopers

About Us About Us Service Contact us Device Index Site Map Latest Updates Mobile Version

Site Related: TI Training

Room 1530, Zhongguancun MOOC Times Building,Block B, 18 Zhongguancun Street, Haidian District,Beijing, China Tel:(010)82350740 Postcode:100190

EEWORLD all rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2021 EEWORLD.com.cn, Inc. All rights reserved