0% found this document useful (0 votes)
4 views16 pages

IoT M2

The document discusses key messaging protocols for IoT applications, specifically MQTT and CoAP, detailing their functionalities, communication models, and quality of service levels. It also covers addressing protocols like IPv4 and IPv6, highlighting their structures and differences, as well as transport protocols such as Li-Fi and BLE technology, explaining their components and operations. Overall, it provides a comprehensive overview of the protocols essential for data transmission in IoT environments.

Uploaded by

aradhyamanil9797
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views16 pages

IoT M2

The document discusses key messaging protocols for IoT applications, specifically MQTT and CoAP, detailing their functionalities, communication models, and quality of service levels. It also covers addressing protocols like IPv4 and IPv6, highlighting their structures and differences, as well as transport protocols such as Li-Fi and BLE technology, explaining their components and operations. Overall, it provides a comprehensive overview of the protocols essential for data transmission in IoT environments.

Uploaded by

aradhyamanil9797
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

MODULE-II

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:

1) Message Queuing Telemetry Transport


2)Constrained Application Protocols

1) Message Queuing Telemetry Transport

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

limited , and if there are no subscribers it automatically deleted .

MQTT Clients

1. Collect information from the sensor


2. Connect it to messaging server (broker)
3. Topic is used to publish this message to let other clients understand
4. Can also be a subscriber

MQTT Broker

1. Protocol is implemented in this case


2. Mediate and facilitate the data based on interest of subscriber

MQTT Quality of Service (MQTT QoS)

There are three levels of QoS supported by MQTT:

0 – Almost one (No acknowledgement)

1 – At least once (acknowledgement , retransmit if acknowledgement not received )

2 – Exactly once (Request to send , clear to send)


Constrained Application Protocol (CoAP)

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

the request with an appropriate reply .

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

layer is request / response process .

Message Layer

1) Confirmable - Reliable Messaging (CON)


This is a reliable approach where in re-transmission acquires until the
acknowledgement is received with the same message . When there is a time out or fail ,
there would be a RST message send from the server.

2) Non – Confirmable (Non – Reliable ) Messaging

There is no reliability ensured in this message transmission style . No acknowledgement


will be issued in this message. In case of no processing is carried out by the receiver RST message
is send.

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.

Request / Response Layer 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.

Message format of CoAP

ver – Version
TKL – Token Length
T - Type

 Version : It is a two bit unsigned integer refers the version of CoAP .

 T (Type) : It is a two bit unsigned integer refers the type of the message

0 – c o n f i r m a b l e , 1 – Non – Confirmable , 2 – ACK , 3 - Reset

 TKL ( Token Length ) : It is a 4 bit unsigned integer refers the token length normally 0 – 8

 Code : It refers to the response code

 Message ID : It is the identifier of the message


Difference between MQTT & CoAP

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)

Internet Protocol version 4 (IPv4)

An IP address is a unique identification for a node connected to the network. An IP


address is 4 bytes or 32 bit long . They can be represented in binary or decimal format.
Eg : 10.10.10.22
An IP address comprises of two halves :
1. Network ID
2 . Host ID

In IPv4 , IP addresses are classified into 5 classes .They are :


● Class A

● 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)

IPv4 Protocol Format

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.

2) Internet Header Length (IHL)


The length specifies the internet header length in 32 bit which points to the beginning
of the data .

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 .

11) Source address


It is a 32 bit IP address indicate the source of the datagram .

12) Destination address


This is a 32 bit IP address indicate the destination of the datagram .

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 .

Internet Protocol version 6 (IPv6)

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

● It has much better and efficient routing

● Larger address space

● Simplified header

● End-to-end connectivity

● Auto-configuration

● Stronger security through IPSec

● Any cast support


IPv6 Protocol Format

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 .

7) Source Address : It specifies the sender 's IP 128 – bit address.


8) Destination Address : Destination IP address is denoted here .
Transport Protocols

1) Li-Fi Technology

Li-Fi stands for Light Fidelity , is a wireless communication technology which


utilizes light to transmit data and position between devices.

Functioning of Li-Fi

● Data is transmitted over Li-Fi by modulating the intensity of light

● 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

● After this , LED illumination (flicker) takes place

● The photo-detector will be able to read this and convert it into data (after amplification /
processing)
Features of Li-Fi

● It has high speed and is bi-directional

● It is used for communication of data

● Light is the source ,that is data transfer happens through light

● 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

1) Application Block : User application is situated here . It interacts directly Bluetooth


stack

2) Host Block : This is the upper layer of the Bluetooth stack


3) Controller Block : This is the lower layer of the Bluetooth stack
4) Host Controller Interface (HCI) : It is an interface between host and the
controller .

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.

You might also like