Nowadays, the “Internet of Things” (IoT) is being discussed everywhere and became an increasingly growing topic of conversation in most of the industries as well as out of them. But what exactly is the “Internet of things” and how it is working?
The terminology was first introduced by British entrepreneur Kevin Ashton in 1999. The Internet of Things (IoT) is a system of interrelated “Things” which can be computing devices, machines, vehicles, objects, animals, people or probably any “thing” that is provided with a unique identity and the ability to communicate over a network without requiring human-to-human or human-to-computer interaction. The practical implementation is wide spread in industries like manufacturing, precision farming, energy, healthcare, banking and transportation.
The Devices and Networks
The four main components of IoT will be
- The Thing or The Device
- The Local Network
- The Internet
- The Backend Systems [Data Processors, Controllers…]
The base of every IoT device is the sensors that monitor physical or environmental conditions. A WSN [Wireless Sensor Network] is a collection of these sensors and each single sensor is called a WSN Node, which usually perform a single operation. There will be a WSN Node which has the Internet Protocol connectivity and acts as a gateway between WSN and IP networks. These are called WSN Edge Nodes.
If we need to transmit data over the Internet, then we may need IPv6, as the current IPv4 standard faces a global addressing shortage, as well as limited support for multicast, and poor global mobility.
The IoT Protocols
The constrained environment of IoT is characterized by low memory availability, low power, low bandwidth requirement and high packet loss – these are the reasons which make it difficult to use TCP / IP stack and web technologies in IoT. ZigBee, Z-Wave etc..are some proprietary protocols in IoT and Home Automation used by lots of product vendors and their alliance worldwide. But still, these protocols are not standardized one’s like TCP, IP, HTTP or SMTP.
There are some new set of protocols like 6LowPAN, CoAP are emerging through the standardization of bodies like IEEE, IETF etc.
The protocols used in each layer of IoT will be as below:
|Network Layer||IEEE 802.15.4||It is a standard for wireless communication which defines the Physical Layer (PHY) and Media Access Control (MAC) layers. 802.15 group of standards are for different wireless personal area networks (WPANs) for various applications. IEEE 802.15.4 focuses on communication between devices in constrained environment with scant resources (memory, power, and bandwidth).|
|Internet Layer||6LowPAN [ IPv6 over Low-Power Wireless Personal Area Networks ]||It is an adaptation layer that allows to transport IPv6 packets over 802.15.4 links. Without 6LowPAN IPv6, Internet protocols would not work in these Low Power Wireless Personal Area Networks that uses IEEE 802.15.4.|
|Transport Layer||UDP [ User Datagram Protocol ]||UDP is much lighter, faster and with much smaller header size than TCP – making it suitable for the constrained environment of devices and sensors.
Datagram Transport Layer Security [DTLS] is the UDP alternative of TLS/SSL. DTLS provides the same security features on UDP or Datagrams, which TLS/SSL gives for TCP communication.
CoAP [ Constrained Application Protocol] : Is for use in low power and constraint networks. It’s a RESTful protocol semantically aligned with HTTP. Because CoAP uses UDP, some TCP functions are reproduced in CoAP. Requests and responses are exchanged asynchronously over CoAP messages.
CoAP packets are much smaller than HTTP TCP flows. Bitfields and mappings from strings to integers are used extensively to save space. All the headers, methods and status codes are binary encoded, which reduces the protocol overhead. Packets are simple to generate and can be parsed in place without consuming extra RAM in constrained devices.
CoAP follows a client/server model. Clients make requests to servers, servers send back responses. And these communications happens through connectionless datagrams. Clients may GET, PUT, POST and DELETE resources. Retries and reordering are implemented in the application stack. CoAP allows UDP broadcast and multicast to be used for addressing.
MQTT [ Message Queue Telemetry Transport] : It is an open source protocol for constrained devices and low-bandwidth, high-latency networks. It is a publishing/subscribe messaging transport that is extremely lightweight and ideal for connecting small devices to constrained networks.
- MQTT Publisher – a sensor or device in IoT world that publishes a piece of information.
- MQTT Subscriber – The one who is subscribing and receiving a piece of information publishes by a MQTT Publisher.
- MQTT Broker – An intermediary that receives information from publisher and forwards them to the subscribers.
- MQTT is message oriented. Every message is a discrete chunk of data, opaque to the broker.
- Every message is published to an address, known as a topic. Clients may subscribe to multiple topics. Every client subscribed to a topic receives every message published to the topic.
- MQTT supports three quality of service levels, “Fire and forget”, “delivered at least once” and “delivered exactly once”.
MQTT targets large networks of small devices that need to be monitored or controlled from a back-end server on the Internet. It is not designed for device-to-device transfer. Nor is it designed to “multicast” data to many receivers.
MQTT-SN [MQTT For Sensor Networks] – Is an open and lightweight publish/subscribe protocol designed specifically for machine-to-machine and mobile applications.
Even though MQTT is designed to be lightweight, it has two drawbacks for very constrained devices.
- Every MQTT client must support TCP and will typically hold a connection open to the broker at all times. For some environments where packet loss is high or computing resources are scarce, this is a problem.
- MQTT topic names are often long strings which make them impractical for 802.15.4.
Both of these shortcomings are addressed by the MQTT-SN protocol, which defines a UDP mapping of MQTT and adds broker support for indexing topic names.
MQTT and CoAP are both useful as IoT protocols, but have fundamental differences. Both protocols have pros and cons, choosing the right one depends on your application.
|MQTT is a many-to-many communication protocol for passing messages between multiple clients through a central broker. It decouples producer and consumer by letting clients publish and having the broker decide where to route and copy messages. While MQTT has some support for persistence, it does best as a communications bus for live data.||CoAP is, primarily, a one-to-one protocol for transferring state information between client and server. While it has support for observing resources, CoAP is best suited to a state transfer model, not purely event based.|
|MQTT clients make a long-lived outgoing TCP connection to a broker. This usually presents no problem for devices behind NAT.||CoAP clients and servers both send and receive UDP packets. In NAT environments, tunnelling or port forwarding can be used to allow CoAP, or devices may first initiate a connection to the head-end as in LWM2M.|
|MQTT provides no support for labelling messages with types or other metadata to help clients understand it. MQTT messages can be used for any purpose, but all clients must know the message formats up-front to allow communication.||CoAP, conversely, provides inbuilt support for content negotiation and discovery allowing devices to probe each other to find ways of exchanging data.|
IoT and Rrealworld
In the beginning of 21st century the number of connected devices were around 90 Million and by 2020 it is expected to be 20 Billion, a huge growth indeed. The gap between physical and digital world will be minimized by these devices, to improve the quality and productivity of life, society and industries.
How easy it will be, if you were able to switch on or off the lights or check your front door lock sitting at your office or even switch on your bedroom AC before you reach home. If your wrist watch can give you an alert on your days activities and give you suggestions or send the details to your physician for analysis ? All these are now possible and people are using them. Nowadays most of us are knowingly or unknowingly using one or another aspect of IoT, in the form of Smart Homes, Smart Watches or even in the form of SmartPhones.
The future of IoT is not limited into these, we can have enormous applications, some of them may beyond our current imagination, using billions of ‘things’ talking to each other and making human intervention least. IoT will bring a paradigm shift in the way we live and work.
Write to us on any queries related to implementing Internet of Things solutions in your organization. We would love to hear from you.