Internet of Things Protocols
IoT is defined as making objects that we use everyday enable to send or receive data. An IoT system consits of three parts which are components (like sensors,actuators…), the network and the platforms,services.
IoT Networks
IoT runs over existing TCP/IP network which uses a 4 layer model (for more detail).
As data link level protocols BLE, LoRa,Sigfox and LTE-M can be used. IoT applications have low powered components like sensors therefore instead of Ethernet these protocols are used. LoRa and Sigfox are low power wide area networks (LPWAN). For further knowledge: https://learn.adafruit.com/alltheiot-transports/lora-sigfox
HTTP is stateless which means that you have to have connection per data transfer. One connection for reading and one connection to write data every time. It’s one to one protocol, one client request at a time. HTTP can be used in IOT applications but it’s not very fast.
REST (Representational State Transfer) is used interchangably with HTTP but it’s not technically a protocol. REST is a standart for transmitting data and most of the programming languages have REST API support. GET, PUT POST and DELETE are four ways to move data. Most services provide REST API which is simplified. The data is encoded with XML or JSON instead of HTML while using HTTP. XML is a markup language like HTML. It’s designed to store and transmit data. JSON is a lightweight data interchange format and it’s a way to represent objects. It can be used with any language.
MQTT (Message Queue Telemetry Transport) is one of the essential protocols of IoT network. It’s a simple messaging protocol that is used with low bandwith and high latency networks. MQTT works asynchronously so it is able to fetch the message later when it was disconnected. In MQTT instead of the ‘server & client’ we have ‘broker & client’. And there is only one broker but there can be several clients. Broker works even when the connection is lost which made the broker to be considered as the reliable one. It collects the published messages and stores them then broker delivers the message to clients. There are multiple softwares for brokers so the management of MQTT broker is not something to worry about it’s MQTT client part that have to be taken care of. We use URLs in REST whereas ‘topics’ are used in MQTT and these topics have commands like publish and subscribe instead of get and post. For instance when there is a reading to upload the client publishes reading to a broker using a ‘topic’. MQTT topics use text categorization and they have hierarchy. There are two topic wildcards which are + and #. + is used to achieve a single level of hierarchy and # is used for remaining levels of hierarchy.
For example,sensors/fl3/temperature/+
this topic will let us monitor all temperature sensors on the 3rd floor. And with topic like this: sensors/#
it would match any level of hieararchy after sensors.
QoS of MQTT is managed by broker however client can request QoS. In QoS 0 broker or client will deliver message only once without confirmation, this is useful when power and data conservation is required. In Qos level 1 the message is delivered at least once by the broker/client and confirmation is required which is called ACKs.In Qos 2 the message will be delivered exactly once by the broker and client (with four step handshake). QoS level 2 doesn’t have common usage.
CoAP( Constrained Application Protocol) is like REST, it has similar commands(GET/PUT/POST/DELETE) but at the same time it has a lighter packet structure and it has binary data representation. CoAP is stateless and sessionless data is sent and requested at any time. CoAP is like REST, it doesn’t manage client message routing but client can become an observer to get frequent updates to a topic of interest which makes CoAP like MQTT. In conclusion, CoAP is the least popular protocol when it’s compared with REST and MQTT.
In particular, you’ll likely be using REST whenever you have a transport that has high bandwidth and speed — like Ethernet, when your transport is Internet-connected and talking to online services.
MQTT is most often used when your transport has battery, bandwidth or packet size restrictions, like WiFi or Cellular.
Finally, CoAP is there when you have very-low bandwidth stateless connections like LoRa, ZigBee or Bluetooth.
Source:
IoT Platforms and Services
IoT platform can collect, distribute, store and analyse data also it can convert data between protocols. There are several cloud based platforms for IoT like IBM Watsom Bluemix, AWS and Microsoft Azure. Cloud based systems provide storage of the data without the need for building an infrastructure.