A Quick Guide to Understanding IoT Application Messaging Protocols

IoT and connected devices use different communication and messaging protocols at different layers. While developing an IoT device, the selection of the protocol largely depends on the type, layer and function to be performed by the device. MQTT, XMPP, DDS, AMQP, and CoAP are a few of the widely used communication protocols for the IoT application layer. Let us understand each of them in detail.

In today’s time, networking with smart devices and IoT is increasing largely due to the ongoing technological revolution across the globe. People are increasingly using IoT and connected devices to automate industrial operations, control city traffic, track health, control home appliances, manage the fleet of vehicles, etc. Smart devices like phones, wearable devices, kiosks, appliances, and automobiles use the internet to connect with other devices and exchange information and data with servers to perform different operations.
There are two ways these devices can connect to the internet. Some devices may connect through a gateway, while others may have network capability built into the devices itself. It is interesting to note here that for establishing the connection with the internet, these devices use messaging and communication protocols at each layer of the Open Systems Interconnection (OSI) model. Depending on the function of the device, the communication protocol at each layer varies.
IoT Topology
IoT devices work by fetching data from users, either through input devices such as touch screens or sensors used for motion detection, temperature, humidity, pressure, etc. This data is then sent to the data servers for storage and processing, and the resulting information is provided to the end user devices for analysis and control.
To understand this, let us consider an example of a Smart Home setup. A typical smart home consists of devices like thermostat, door sensor, smart bulbs, smart refrigerator, smart TV, surveillance systems, etc. These devices are connected to the internet directly or to the gateway, which is further connected to the end user’s smartphone, mobile application or data center and vice-versa.

IoT Protocol Stack

There are many protocols used in an IoT ecosystem at different layers of an OSI Model. However, the usage of a protocol is based on the type of application and its functionality. Usually, it is preferred to use low-powered protocols like 6LoWPAN, Bluetooth BLE, ZigBee, etc. Another deciding factor in choosing a protocol is the distance range for the communication of the IoT devices i.e. in inches or meters or miles.

MQTT (Message Queue Telemetry Transport)

MQTT is a machine-to-machine (M2M) protocol. It is a publish-subscribe-based messaging protocol, used to communicate device data to the servers. The main purpose of MQTT is to manage IoT devices remotely. It is mainly used when a huge network of small devices needs to be monitored or managed via Internet i.e. parking sensors, underwater lines, energy grid, etc.
The MQTT messages are sent asynchronously through publish-subscribe architecture. The messages are encapsulated in several defined control packets, which are designed to minimize the network footprint. Listed below are a few MQTT protocol control packets:
An MQTT control packet is formed as shown in the figure below.
It should be noted that not all control packets have the variable headers and payload. A payload can be up to 256 MB. The small header overhead in MQTT makes this protocol appropriate for IoT.
Pros:
  • Lightweight for constrained networks
  • Flexibility to choose Quality of Services with the given functionality
  • Standardized by OASIS Technical Committee
  • Easy and quick to implement
  • Cons:
    • High power consumption due to the TCP-based connection
    • Lack of encryption
    Use Case:
    A parking lot where there are a number of parking sensors installed to identify the number and location of empty or vacant parking spots.

    XMPP (Extensible Messaging and Presence Protocol)

    XMPP was originally developed as a messaging protocol known as Jabber. It uses an XML format for messaging. The main feature of this protocol is its addressing mechanism. It identifies the devices/nodes in the IoT network using the address known as Jabber ID (JID). JID follows the standard i.e. name@domain.com. This addressing mechanism enables two nodes to exchange information, regardless of how far the nodes are in the network.
    XMPP messages are usually transmitted over the underlying TCP connection. It uses a polling mechanism to identify the destination of the message. XMPP is implemented using a client-server architecture. The client starts an XML stream by sending an opening <stream> tag. The server then replies with an XML stream back to the client. Since XMPP is an open protocol, anyone can have their own XMPP server in their network without necessarily connecting to the internet.
    Below is an example of a typical message from an XMPP client wrapped in XML:

    Pros:
    • Addressing scheme to identify devices on the network
    • Client-server architecture
    Cons:
    • Text-based messaging, no end-to-end encryption provision
    • No Quality of Service provision
    • Use Case:
      • A smart thermostat that can be accessed from a smartphone via a web server.
      • A gaming console with instant messaging between the two online players.
      • For an in-depth understanding and hands on experience Click here for a video specially made for that. Thanks.

Comments

Post a Comment

Popular posts from this blog

Internet of Things (Overview)

About the Internet of Things and 5G