I wanted to do a series of posts on IOT and its various protocols. The posts will talk about protocols, implementations of a typical IOT Mgmt Portal as an Android App, Implementation of an IOT Device on NodeMCU board (using ESP8266-E-12 SOC), and how the client and the Mgmt portal are able to connect and talk to each other.
Internet of Things (IoT) encompasses various devices and communication methods to exchange information. Objects that we generally see around us, like Light Switches, Electric Meters, Cars, etc, will be connected and able to communicate with each other, under the realm of a strong and optimized authentication and authorization framework. IoT will be a fundamental technology in the future because the concept opens up opportunities for new services in all areas that mankind depends on, like Environment Monitoring and Control, Farming and Agriculture, Security and Defence etc.
In this post we discuss a simple Publish/Subscribe protocol, that is widely used in IOT devices today. Its called Message Queue Telemetry Transport (MQTT), and runs over TCP/IP. It is designed for connections with remote locations where a “small code footprint” is required or the network bandwidth is limited. The publish-subscribe messaging pattern requires a message broker. The broker is responsible for distributing messages to interested clients based on the topic of a message. The open, royalty-free MQTT protocol has been developed for satellite communications in 1999 by IBM and later used in many industrial applications.
The MQTT protocol is a publish / subscribe communications protocol which allows for data to be sent and received asynchronously from IOT Devices to a central server called a broker. The structure, in which the MQTT protocol operates, consists of a data source, which is referred to as a publisher, the data sink, the subscriber and the intermediary message broker that provides the communication controller (https://goo.gl/16hrNn).
MQTT defines methods to indicate the desired action to be performed by a MQTT Server on the identified resource (MQTT Client). This could be Switching “ON” a light bulb or an Oven at home. The following methods are defined to be given by an MQTT Client to a MQTT Server.
-
Connect - Connect to the MQTT server or broker.
-
Disconnect - Disconnect MQTT client to finish any work, and for the TCP/IP session to disconnect.
-
Subscribe - Waits for completion of the Subscribe method.
-
UnSubscribe - Requests the server unsubscribe the client from one or more topics.
-
Publish - Returns immediately to the application thread after passing the request to the MQTT client.
References: