IoT M2
IoT M2
Messaging Protocols
Messaging protocols play a vital role to send and receive data or messages too or from the
cloud for any IoT application. The important messaging protocols are:
The MQTT is a by protocol ,means that it demands minimal resources for its
functioning and does not require additional resources from its working environment. The MQTT
follows the publisher-subscriber pattern.
A component called central broker plays a key role in the entire system .The
message broker helps to dispatch messages to the node. The publisher sends a message to the
broker and the broker takes the responsibility of dispatching the messages to the subscribed
destination.
A publisher node can send the data to the MQTT broker. Based on the subscription from the
nodes connected the broker send messages accordingly. The data reaches the node that really wants
it and not to all the nodes present in network. In MQTT there is no address ,the topics are used to
root the message appropriately. So the topics are used to connect the publisher to the subscriber.
In MQTT protocol the clients who are subscribers can also publish. Once the messages
reach the clients the messages gets removed from the broker. That means,the life of message is
MQTT Clients
MQTT Broker
Many devices or equipments (things) need to be connected to the internet. This cannot be done
easily and demands the necessity of various resources along with the protocol . The CoAP is a messaging
protocol in IoT works in constrained environment . It is used to enable the smart devices to connect to the
internet. The CoAP is a one-to-one communication protocol. It uses lesser resources than HTTP. The HTTP
runs over TCP and it is connection oriented , while the CoAP runs over UDP and is connectionless .
The CoAP is a client-server model architecture. The client will send a request followed by server”s response to
CoAP is based on the REST API model known as Restful (Representational State Transfer). The REST
approach ensures a secure , fault tolerance and scalable system . The CoAP optimises the Datagram link . It also
support multicast.
The CoAP is a two layered protocol. The lower layer is message layer and the upper
Message Layer
3) Acknowledgement
This is a traditional acknowledgement message send in any sort of protocol. We can
connect it to the regular hand shaking scheme.
4) Reset (RST)
If no processing is happened at the receiver end even after a specific amount of time there
should be a mechanism to inform the sender of the situation by using the RST message.
1) Piggy Backed
In this mode of request / response approach the client send a request through the
CON / NON messaging method ACK received immediately with token numbers and messages.
2) Separate Response
When CON type message is send to the server and server is unable to respond immediately
an empty ACK will be reverted . After sometimes when the server is able to send the response , it
send a CON message with data.
3) Non – Confirmable Request and Response
Here , NON type messages is send from the client to the server . The server does not
need to give ACK.
ver – Version
TKL – Token Length
T - Type
T (Type) : It is a two bit unsigned integer refers the type of the message
TKL ( Token Length ) : It is a 4 bit unsigned integer refers the token length normally 0 – 8
MQTT CoAP
Underlying Protocol TCP connectionless UDP Connection oriented
Communication Many-to-Many One-to-One
Model Publish-Subscribe Request-Response
Power Higher than CoAP ,lesser than other protocols Consumes less power than MQTT
Addressing Protocols
1) Internet Protocol version 4 (IPv4)
2) Internet Protocol version 6 (IPv6)
● Class B
● Class C
● Class D
● Class E
Class A
Class A addressing is dedicated for a very huge network . In this type of addressing the first
-
octet can be from 1 126 . This means , that there can be 126 network possible . The first bit of
the first octet will always set 0 . The remaining three octet used for Host ID. In Class A , there can
24
be 2 – 2 IP addresses can be generated.
Class B
It is mainly applicable in medium sized network. Class B uses addresses from 128 - 191 .
First and second octet used for network ID and the remaining octets are used as Host ID. The first
14
two bits of the first octet are set as 10 . Maximum possible networks is 2 - 2 .
Class C
This class is mainly used for small networks .First three octet are represent the network ID and
the remaining one is used for Host ID . The Class C address starts with 192 and ends in 223 . First
8
three bits of the first octet is fixed as 110 . It allows 2 – 2 hosts per network.
Class D
This class is mainly used for multi casting . The first octet bits are 1110 . The address starts
from 224 – 239 .
Class E
This class is mainly used for experimental purposefully . The bits in the first octet are fixed
th
as 1111 (first bit is 1 , second bit is 1 , third bit is 1 and 4 bit is 1)
1) IP version number
It is a 4 bit field which indicates the version of IP being utilized . The version is
represented in binary form.
3) Type of service
This is an 8 bit field which indicate the quality of services . They are :
a) presidence : The bits 0 – 2 represents the presidence . The important presidence are :
000 – routine , 001 – priority , 010 – immediate etc
th
b) Delay : This is the 4 bit and it indicate the delay . 0 indicates normal delay and 1
indicates lower delay
c) Throughput : 0 indicate normal throughput and 1 indicates high throughput.
d) Reliability : 0 indicates normal reliability and 1 indicates higher reliability.
4) Total Length
This is a 16 bit field which indicate the total length of the IPv4 datagram.
5) Identification
This is 16 bit field added by the centre to help in assembly the fragments.
6) Flag
This field is composed of 3 bits . The important flags are :
DF : Don't Fragment
MF : More Fragment
7) Fragment
When fragmentation of the message acquires this field specifies the offset in the
overall message where the data in the fragment is present .
8) Time to live
This is an 8 bit field and it indicates the type with the IP datagram serviced.
9) Protocol
This indicate the higher layer protocol carried in the IP datagram . The important
protocols are :
00 – Reserved
01 – ICMP ( Internet Control Message Protocol )
02 – IGMP ( Internet Group Management Protocol)
03 – DGP ( Data Gateway Protocol )
04 – IP ( Internet Protocol )
06 – TCP ( Transmission Control Protocol )
08 – EGP ( Exterior Gateway Protocol)
10) Header Checksum
This is a 16 bit checksum computed over the header to provide basic protection
against corruption in transition .
13) Options
This is an optional field which includes any optional values in the header .
14) Padding
IP option length varying in length .So the padding field provides additional 0 bit .
IPv6 was developed to overcome the difficulties faced with IPv4 address allocations . It is named as
the next generation protocol for the Internet . It also works in Layer 3 .It has more addresses and
128
multiple features than IPv4 . IPv6 provides support for 2 unique IP addresses .
Features of IPv6
● Simplified header
● End-to-end connectivity
● Auto-configuration
1) Version (4 bits) : This is used to represent the version of IP being used . In IPv4 , it is 4
and in IPv6 it is 6.
2) Traffic class (8 bits) : This is 8-bit field that provides the means of identifying different
classes or priorities of IPv6 packets .
3) Flow Label (20 bits) : This is used to identify the sequence of packets . It help in
prioritizing packet delivery and providing real time service .
4) Payload Length (16 bits) : This identifies the length of the IPv6 payload . It is used in
place of total length of IPv4 .
5) Next Header (8 bits) : It represents the type of extension header that follows the
primary IPv6 header .
6) Hop Limit (8 bits) : Time to Live (TTL) is replaced by Hop Limit in IPv6 header . The
value in this field is decremented by 1 every time the packet passes through a host that
forwards the packet .
1) Li-Fi Technology
Functioning of Li-Fi
● The modulation happens real quick and human eyes cannot really feel or capture it
● The light is received by the photo-detector and demodulation happens to generate the data
stream sent by the transmitter
● All the LED lamps need an LED lamp driver
● The photo-detector will be able to read this and convert it into data (after amplification /
processing)
Features of Li-Fi
● Light is generated through lights bulbs , which makes the use of Li-Fi inexpensive
2) BLE Technology
BLE stands for Bluetooth Low Energy , is a power-conserving variant of
Bluetooth Personal Area Network (PAN) technology, designed for use by Internet-connected
machines and appliances. A BLE devices communicates with outside world by broadcasting and
connections .
Components of BLE
BLE
Application Controller
Host
Architecture of BLE stack
1. Controller : This consist of Host Controller Interface (HCI) , link layer and physical layer .
a) Host Controller Interface (HCI) : It is used to enable interoperability between
host and controller .
b) Link Layer (LL) : It defines the packet structure .
c) Physical Layer (PHY) : It takes care of the transmission / reception .This layer
takes care of modulation / demodulation . It is also responsible for analog – to –
digital conversion .
2. Host : The host layer includes the host-side HCI, Logical Link Control and Adaptation
Protocol (L2CAP), Attribute Protocol (ATT), Generic Attribute Profile (GATT), Security Manager
(SMP), and Generic Access Profile (GAP).
a) Generic Access Profile (GAP) : It takes care of the device discovery , connection
establishment , connection management and security .
b) Attribute Protocol (ATT) : It is the protocol for accessing data .
c) Generic Attribute Profile (GATT) : It defines the structure in which data is exchanged
between two devices and how ATT attributes are grouped into sets to form services.
d) Logical Link Control and Adaptation Protocol (L2CAP) : It is responsible for
fragmentation and de-fragmentation of the application data . It also manages the
multiplexing and de-multiplexing of multiple packet sources.
e) Security Manager (SMP) : It handles pairing , authentication and encryption .
f) Host Controller Interface (HCI) : It is used to enable interoperability between host and
controller .
3. Application Layer : It helps to interact with applications and profiles as desired. Any
profiles/applications run on top of GAP/GATT layers of BLE protocol stack. It handles device
discovery and connection related services for the BLE device.