Benefits of MQTT-SN over MQTT

Benefits of MQTT-SN over MQTT

MQTT SN is exclusively designed for sensor networks and the specification for the same (MQTT SN specification) is available at MQTT.org. MQTT protocol & MQTT SN (MQTT for sensor networks) are both IoT Protocol used most widely for developing IoT devices. This blog is for developers to understand when to use MQTT-SN (SN MQTT for sensor) and the advantages of the same over MQTT.

MQTT SN Auto Discovery

In the MQTT set up, agents need to be informed where the broker runs. This increases the configuration overhead at the end user. But for MQTT-SN protocol, the sensors and the gateway can propagate messages which is understood by its counterpart and can establish connection to communicate with each other.  This makes it much simpler to configure.

Reduced Bandwidth

The size of the every packet that is transferred in the MQTT-SN has been redesigned. For example in the CONNECT, only the required parameter is sent. The WILL and WILL Message has been split into separate packets and sent only when required. The overall data transferred over the network is reduced to a greater extent to reduce the bandwidth used. Moreover MQTT SN supports four types of MQTT QoS (Quality of service) QoS 0,1,2,-1 or 3.

Predefined Topic IDs & Topics Names

The topic names can be predefined in the MQTT SN Gateway with a pre defined topic IDs. The client can directly send packets using the ID and no need to use the topic names. The topic IDs occupies a max of two bytes. The short topic names less than 2 bytes can also be used without topic IDs. If the client wants to use a new topic, then can send a register command for the new topic.

Lower Processing Power

The packet size reduction highly reduces the amount of power required to create and communicate data. Further there are provisions like Sleep of the clients which will stop the gateway from further sending or publishing messages to this client . The client can send a resume message to get all the packets received during the sleep period.  This make this publish subscribe messaging protocol highly suitable for battery powered sensors.

Connectionless

MQTT is over TCP/IP Protocol. TCP has a lot of connection over head which is not required in the MQTT-SN which is over UDP. And it does not depend on TCP/IP networks. This again reduces the amount of data transfer and the power required.

Medium Independence

It can be propagated over Zigbee, Z-Wave , bluetooth in addition to the wired and wireless sensor networks. MQTT SN is mainly targeted at embedded devices, on non TCP/IP networks such as zigbee.

You can have a look at the detailed document on how to develop MQTT-SN Clients and how to develop MQTT Clients.

MQTT Gateway to connect IOT Sensors

MQTT Gateway to connect IOT Sensors

MQTT Gateway is one of the core component in the IOT connectivity. And also MQTT Broker can now  talk to your IoT Sensors via the MQTT Gateway.

Auto Discovery of IoT Devices

The Gateway can do an auto discovery of the Sensors available in the network. The discovered devices / sensors are allowed to communicate with each other and can be managed from the central IoT Platform. As of now we have supported only network based discovery. And we are working on the bluetooth and other possible options for the communication.

MQTT Gateway to Broker Data flow

Gateway supports options to have a single connection ( Aggregated ) with the central IoT Platform.  Otherwise, it just act as a forwarder to create single connection for each sensor ( Transparent ). The aggregated gateway will help you reduce the load on the platform.

As of now we support the discovery of only the devices connected in the network using UDP protocol and we are working on bluetooth and other modes of communication.

You can start the Gateway using the script files present inside the bin/ folder of the product.

Try the  MQTT Broker with the gateway.  Feel free to write to [email protected] in case of any questions.