Lecture 10 P1
Lecture 10 P1
Lecture 10 P1
These capabilities may be beneficial, but the data overhead and power cost may not
be worth it.
So, there are many alternate protocols that have been
developed for IOT environments. Some of the popular IOT
Application Layer protocols are as follow
Low-bandwidth.
1. Publish/Subscribe 2. Messages
3. Topics 4. Broker
MQTT – Publish/Subscribe
The first concept is the publish and subscribe system. In a publish and
subscribe system, a device can publish a message on a topic, or it can
be subscribed to a particular topic to receive messages
Messages are the information that you want to exchange between your
devices. This could be a command or data.
MQTT – Topics
Another important concept is the topics. Topics are the way you register
interest for incoming messages or how you specify where you want to
publish the message.
Topics are represented with strings separated by a forward slash. Each forward
slash indicates a topic level.
Broker
1. MQTT has been specially designed for sensor networks and wireless
sensor networks.
2. MQTT allows devices to send or publish data information on a given
topic to a server.
3. There is an MQTT broker (Broker- Mosquitto) in between publisher
and subscriber.
4. The broker then transfers the information to the clients that are
previously subscribed.
5. The sensors are interfaced with a broker which is an IoT device or
server that reads and publish sensor data.
6. The other devices that subscribe for and request sensor data are
called clients.
7. The sensors themselves are referred as publishers in the network.
8. The client can be a laptop, smart phone, tablet or other mobile
device.
9. The client devices need to subscribe with the broker in the network
to receive sensor data.
10. For receiving data, the subscribed client devices have to establish
connection with the broker and request data.
11. The broker takes the data from the publisher (wireless sensors) and
sends it to the client requesting for it. Even if the connection with
the client device is broken after the request has been made, the
broker saves the data and sends when the client device reconnects
with the broker, it could receive the requested sensor data.
12. Similarly, if the connection between the publisher and the broker is
broken after the request has been made, the broker forwards
appropriate instructions sent by the publisher, so that client device
can reconnect and receive requested data.
Key
Subscribe to temperature Publish to temperature
An MQTT session can be divided into four stages -
1) Connection 2) Authentication 3) Communication 4) Termination
Connection- In this stage, the client (like a mobile device or laptop) initiates a
TCP-IP connection with the broker (server) using a standard port (generally
1883 for non-encrypted and 8883 for encrypted communication through Secure
Sockets Layer (SSL) or Transport Layer Security (TLS) or a port defined by the
network operator.
Authentication- In encrypted communication, the server sends server
certificate to authenticate itself by the client and client may also send a
certificate to the server to authenticate itself. Though even in encrypted
communication, the client authentication is not part of the specification and also
not common. Still, usually, the client authentication is done by passing a
username and password by the client to the broker (server).
Termination - The publisher or client can terminate the connection
by sending a DISCONNECT message to the broker, after which, the
TCP-IP connection is closed. If the connection is broken suddenly (due
to limited network bandwidth) without termination request, the broker
sends the cached messages from the publisher to the client.
Communication - The sensor data is communicated to client using small code
footprints. It usually contains 2-byte long header, an optional variable length header,
sensor data as message payload limited to 250 Mb in size and Quality of Service
Level Indication.
There can be three Quality of Service (QoS) levels
Each exceeding QoS level requires more network bandwidth and tolerance to latency.
2. The client stores the original message until it gets a PUBACK message
from the broker. If the client does not receive the PUBACK message, it
will resend the original message.
4. In both cases, if the sender does not receive a PUBACK message within
some amount of time, it will republish the original message to the recipients
with a duplicate flag(DUP). The DUP flag is not processed by the client or
the broker but can be used based in your program to handle duplicate
message.
While QoS level 1 guarantees that the message is being received, it can cause duplicate
messages to get republished if the PUBACK is not received on time. QoS Level 1 is
slower than Level 0.
MQTT QoS level 1 is used in commercial MQTT brokers like AWS IoT, Azure etc.
Most commercial MQTT brokers do not support QoS level 2 as its slow and consumes
more resources.
MQTT QoS Level 2 – Exactly Once
This service level should be used if: Messages can be delivered slowly.
Message duplication causes issues.
Most commercial brokers like AWS IoT & Azure IoT do not support QoS
Level 2 as on todays date.
MQTT’s publish/subscribe model offers several specific benefits outlined
below:
Independent Operation
While a node and the broker need to have each other’s IP address, nodes
function independently of one another. Without any knowledge of each
other, nodes can publish information and subscribe to other nodes’ published
information.
Reason being: Everything goes through the broker.
Time and Synchronization Independence
MQTT uses TCP for its transport layer, enabling certain TCP security
capabilities. The protocol can leverage TLS/SSL security for encrypting
traffic, but this can be resource-intensive. Another option is to encrypt only
the packet payload. This is a better approach for networks that consider
power management a higher priority than security.
• Scalable
• open to integration
• failure-resistant
- Requests - Responses.
less complex when compared with TCP. Network/ IPv6/IPv4, RPL, TCP/UDP,
Communication 6LoWPAN
This makes UDP a good choice, but the layer
only problem is that it is not stable, PHY/MAC layer IEEE802.11 Series, 802.3,
to take care of that it needs to 802.16,WirelessHART, Z-
WAVE, UWB
be combined with Application layer
• HTTP has computational complexity, low
data rate and high energy consumption,
therefore it is not suitable for constrained
devices. IETF came with numerous
protocols and COAP is one of them
1. Gilles & Robert, (15th November 2016), “Mastering The IoT: | Connectivity |
Technology”, Amsterdam / The Hague.
2. Pethuru Raj, Anupama C. Raman, “The Internet of Things: Enabling Technologies,
Platforms, and Use Cases”, CRC Press, New York
3. Lawrence Miller, “Internet of Things for Dummies”, Wiley Brand
4. Zeinab Kamal Aldein Mohammeda, Elmustafa Sayed Ali Ahmedb, “Internet of
Things Applications, Challenges and Related Future Technologies”
5. Debasis Bandyopadhyay · Jaydip Sen, (2014), “Internet of Things: Applications and
Challenges in Technology and Standardization”
6. M.A. Matin and M.M. Islam, “Overview of Wireless Sensor Network”
7. D. Stephan, H Paul, (2005), “Introduction to Wireless Sensor Networks”
8. White Paper on “Machine-to-Machine Communication (M2M)”
9. Machine-to-Machine Communications: Architectures, Standards and Applications
10. Building block of IoT
11. IoT standards and Protocols
12. Low-Rate Wireless Personal Area Networks: Enabling Wireless Sensors with IEEE
802.15.4 [Book]