IoT Unit - 04
IoT Unit - 04
IoT Unit - 04
Q. 1) Explain MQTT and their methods & components / Explain MQTT communication.
Ans. : -
It's widely used in IoT (Internet of Things) applications due to its simplicity,
efficiency, and reliability.
1) Publishers : -
IoT devices that generate data (temperature sensors, smart meters, etc.) publish
messages to a central server called a broker. A client that sends messages to the
broker. These messages can be data, commands, or notifications.
2) Subscriber : -
A client that receives messages from the broker. Subscribers express their interest
on specific topics and the broker delivers messages to them based on their
subscriptions.
3) Broker : -
4) Topic : -
Topics provide a way to categorize and filter messages. Messages are organized into
topics, which act as channels for communication. For example, a topic could be
"home/living room/temperature". Subscribers can subscribe specific topics and can
receive relevant data.
MQTT supports three levels of QoS, which define the guarantees for deliver
messages:
QoS 0 (At most once) : - Messages are delivered once or not at all.
QoS 1 (At least once) : - Messages are guaranteed to be delivered at least once to
the receiver, but duplicates can occur.
QoS 2 (Exactly once) : - Messages are guaranteed to be delivered exactly once. This
is the highest level of assurance but comes with increased overhead.
6) Retained Messages : -
These are special messages that are stored by the broker and sent to new
subscribers when they subscribe to a topic.
Ans. : -
MQTT topics play a crucial role in organizing and directing communication between
IoT devices. Here are some applications and examples of MQTT topics in IoT:
1) Environmental Monitoring : -
Devices publishing temperature, humidity, and air quality data to topics like
"home/environment/temperature" or "office/building/air_quality".
2) Home Automation : -
3) Asset Tracking : -
4) Industrial Automation : -
5) Energy Management : -
6) Healthcare Monitoring : -
7) Agriculture : -
Sensors in farms publishing soil moisture, temperature, and humidity data to topics
like "farm/crop/soil_moisture" or "greenhouse/temperature".
Ans. : -
SMQTT stands for Secure MQTT, which is an extension of the MQTT protocol designed
to enhance security in IoT communication.
1) Encryption : -
2) Authentication : -
3) Access Control : -
SMQTT allows for small access control and enables administrators to define access
policies based on topics, clients or specific actions (publishing, subscribing,
etc.), thus preventing unauthorized clients from accessing sensitive data.
4) Message Integrity : -
Ans. : -
It's designed to be lightweight, efficient, and suitable for IoT devices with
limited resources such as memory, processing power, and energy.
CoAP supports efficient message formats, including compressed headers and payload,
to minimize packet size and conserve bandwidth.
CoAP supports security mechanisms such as Datagram Transport Layer Security (DTLS),
which provides end-to-end encryption and authentication, ensuring the
confidentiality and integrity of data.
Ans. : -
CoAP (Constrained Application Protocol) defines four message types that facilitate
communication between clients and servers in IoT applications:
1) Confirmable (CON) : -
CON messages are used when stability is required. The sender expects an
acknowledgment (ACK) from the receiver. If no acknowledgment is received, the
message is retransmitted.
2) Non-confirmable (NON) : -
NON messages are used when stability is not critical. The sender does not expect an
acknowledgment from the receiver. These messages are faster than CON messages, but
they may not guarantee delivery.
3) Acknowledgment (ACK) : -
4) Reset (RST) : -
RST messages are sent by a receiver to indicate that a received message cannot be
processed. This could occur if the message is featureless or if the server is
unable to handle the request.
Ans. : -
Upon receiving the request, the server processes it according to the method
specified. For example, if it's a GET request, the server retrieves the requested
resource and prepares a response.
After processing the request, the server sends a CoAP response back to the client.
The response contains a response code indicating the outcome of the request
(success, error, etc.), optional payload data, and other metadata.
The client receives the response from the server and processes it accordingly. If
the request was successful, the client can extract any data included in the
response payload and take appropriate action.
If the client sends a Confirmable message and does not receive an acknowledgment
within a certain time period then it may retransmit the message.
Q. 7) Explain AMQP features and components in brief.
Ans. : -
1) AMQP Clients : -
These are the IoT devices or applications that generate and consume messages. They
use AMQP libraries or SDKs to interact with the AMQP message broker.
3) Queues : -
Queues are storage entities within the message broker where messages are
temporarily stored before being delivered to consumers. In IoT scenarios, queues
help to separates message from producers to consumers and allowing for asynchronous
communication.
4) Exchanges : -
Exchanges receive messages from producers and are responsible for routing them to
the appropriate queues based on routing rules defined by the application. Exchanges
determine how messages are distributed within the messaging system.
5) Bindings : -
Bindings define the relationship between exchanges and queues and also specifies
that how messages should be routed from exchanges to queues.
6) AMQP Protocol : -
The AMQP protocol defines the rules and standards for communication between AMQP
clients and the message broker. It ensures inter-operability and compatibility
between different implementations of AMQP.
Ans. : -
In the context of AMQP, a frame is the basic unit of communication between AMQP
clients and the message broker.
AMQP defines several types of frames, each serving a specific purpose in the
message exchange process :
1) Method Frames : -
Method frames are used to establish and manage the communication between AMQP
clients and the message broker and performing actions such as opening or closing
connections, channels, or sessions.
2) Header Frames : -
Header frames contain metadata about the message payload, such as content type,
encoding, and message properties. They provide necessary information for the
processing and explanation of the message payload.
3) Body Frames : -
Body frames enable the transfer of large messages efficiently between AMQP clients
and the message broker. They may be divided into multiple frames if the message
size exceeds the maximum frame size.
4) Heartbeat Frames : -
Heartbeat frames are used to maintain the liveliness of the connection between AMQP
clients and the message broker. They serve as a mechanism for detecting and
handling network failures or idle connections.
Ans. : -
XMPP provides a versatile and robust communication protocol for IoT applications
and offering features such as real-time messaging, presence information,
scalability, and security.
Its flexibility and interoperability make it suitable for a wide range of IoT use
cases, from smart homes and industrial automation to healthcare and transportation.