IoT unit 3 vips
IoT unit 3 vips
IoT unit 3 vips
(AIML309)
Course Overview:
• This course is foundation course around the Internet of Things (IoT). It overviews about the
technology used to build these kinds of devices, how they communicate, how they store
data, and the kinds of distributed systems needed to support them. Divided into four
modules, the first unit explores about theoretical concepts of IoT while second unit is
completely programming based to explore IoT sensors and actuators with Arduino. The rest
of the syllabus is application oriented based on learning. In general, through this course
students will be explored to the interconnection and integration of the physical world and
the cyber space. They will be able to design and develop IOT Devices
Course Objective:
LLC
SSCS
IEEE 802.15.4
MAC
PHY
IEEE
802.15.4
● IEEE 802.15.4 provides communications over distances up to about 10 metres and
with maximum transfer data rates of 250 kbps.
● Uses direct sequence spread spectrum (DSSS) modulation
● PHY Header = frame length value. It lets receiver know how much total data
to expect in PHY service data unit (PSDU) portion of 802.4.15 PHY.
● PSDU is data field or payload.
IEEE 802.15.4 MAC
Layer
● IEEE 802.15.4 MAC layer manages access to PHY channel by defining how devices in
fields.
● Frame Control defines attributes such as frame type, addressing modes, and other
control flags.
● Sequence Number indicates sequence identifier for frame.
● Addressing field specifies Source and Destination PAN Identifier fields as well
as Source and Destination Address fields.
IEEE 802.15.4 MAC Frame
Format
● MAC Payload field varies by individual frame type.
● For example, beacon frames have specific fields and payloads related to beacons, while
MAC command frames have different fields present.
● MAC Footer field is like a frame check sequence (FCS). FCS is a calculation based on data
in frame that is used by receiving side to confirm integrity of data in frame.
● IEEE 802.15.4 requires all devices to support a unique 64-bit extended MAC address,
based on EUI-64.
● However, because maximum payload is 127 bytes, 802.15.4 also defines how a 16-bit
“short address” is assigned to devices.
● This short address is local to PAN and substantially reduces frame overhead compared
to a 64-bit extended MAC address.
IEEE 802.15.4 Types of networks
and devices
Networks PAN coordinator
FFD Router
Non-Beacon
Enabled 802.15.4 Device
● Can be used for sending and ● Low power devices as they do not need to
receiving data, but it can also route other traffic and can be put into a
route data from other nodes. sleep mode when not in use
• Data -frames sent via Slotted CSMA/CA with a super frame structure managed by
PAN coordinator
Figure shows IEEE 802.15.4 frame format at a high level, with Security Enabled bit
set and Auxiliary Security Header field present.
IEEE 802.15.4
•Summary
IEEE 802.15.4 wireless PHY and MAC layers are specifications that are foundation
for various industry standards and products
• MAC layer for 802.15.4 is robust and handles how data is transmitted and received
over PHY layer.
• MAC layer handles association and disassociation of devices to/from a PAN, reliable
communications between devices, security, and formation of various topologies.
IEEE 802.15.4
•Summary
Topologies used in 802.15.4 include star, peer-to-peer, and cluster trees that allow
for formation of mesh networks.
• For IoT sensor deployments requiring low power, low data rate, and low complexity,
the IEEE 802.15.4 standard deserves strong consideration.
What is
•ZigBee?
Wireless technology standard that provides a set of communication protocols for
short-range communications.
• Open-source global standard developed by Zigbee Alliance to address needs of low-
cost, low power wireless IoT networks.
• Protocol is used in low data rate, short to medium range wireless
networking devices like senors and control networks.
• Provides flexibility for developers and end-users and delivers great interoperability.
• Low-cost, low-power consumption and having faster wireless connectivity, makes it
desirable for multiple applications.
ZigB
•ee
ZigBee is popular choice for smart homes as outstands other wireless technologies
Catering to all sectors like lightings, security, appliances and home access.
Requires very little power mainly due to its low latency and low duty cycle.
• Supports multiple networks like point to point, point to multipoint mesh- networks.
• Uses AES 128 encryption thus protecting information while on air transfers.
• Name ZigBee is closely in relation with Bees as bees do ‘waggle dance’ to communicate
with each other when they return to their hives
• Connected to other nodes inside LAN via IoT LAN; May be sometimes
IoT Node connected to internet through WAN directly
• Nodes represented by green circles have L: Local Link Addresses or LU: Local Link addresses which
are Unique locally.
• Nodes within gateway’s jurisdiction have addresses that are valid within gateway’s domain only.
• Same addresses may be repeated in domain of another gateway. Gateway has unique network
prefix, which can be used to identify them globally.
• Strategy saves lot of unnecessary address wastage. Although, nodes have to communicate to
the
internet via the gateway
Strategies of Address
Conservation
• Use local addresses which exist
uniquely within domain of gateway.
• Represented by circles here.
• Network connected to internet has routers
with their set of addresses and ranges.
• These routers have gateway
multiple connected to s
them from
packets which can to Internet, only
nodes, forwar
via
these routers. d
• These routers assign prefixes to gateways
under them, so that gateways can be
identified with them
Impact of Mobility on
Addressing Has global
view of
• This type of addressing helps to
network problem of mobility.
solve
underneath • How?
• When a particular Node changes its position
from a particular network to another network
then prefix also changes from 1 to 2, making
IoT LAN safe from changes due to mobility.
• IoT Gateway WAN takes care of
changes without change in LAN address.
address
• Within LAN, address remains same, but with
help of assignment of this unique prefix, WAN
address changes
• This is achieved using ULA.
Impact of Mobility on
• Gateways assigned with prefixes, which are
Addressing Has global
view of attached to a remote anchor point by using
network
underneath
various protocols such as Mobile IPv6, are
immune to changes of network prefixes.
• Achieved using LU.
• Address of nodes within gateways remain
unchanged as they provide them with unique
local address and change in gateway’s
network prefix doesn’t affect them.
• Tunnelling helps nodes to communicate
directly to internet, i.e, nodes communicate
to remote anchor point instead of channelling
their packets through router which is
achieved by using tunnelling protocols such
as IKEv2:internet key exchange version 2
IP Version 4
Protocol
• Packets in IPv4 layer
are called datagrams
• Datagram is a variable-
length packet
consisting of two parts:
header and data.
• Header is 20 to 60
bytes in length and
contains information
essential to routing and
delivery.
• Customary in TCP/IP to
show header in 4-byte
sections.
IP Version 4 Protocol
-•VER
4-bit field defines
version of IPv4 protocol
• Version 4 dominates
Internet today
• VER tells IPv4 software
running in processing
machine that datagram
has format of version
4.
• Including version at
start of each datagram,
makes possible
transition between
versions over a long
period of time.
IP Version 4 Protocol -
HLEN
• Header length (HLEN).
• 4-bit field defines total
length of datagram header
in 4-byte words.
• Needed because length of
header is variable (between
20 and 60 bytes).
• When there are no options,
header length is 20 bytes,
and value of this field is 5 (5
x 4 = 20).
• When option field is at its
maximum size, value of this
field is 15 (15 x 4 = 60).
IP Version 4 Protocol -
Services
• IETF has changed
interpretation and name of
this 8-bit field.
• Previously called service
type, is now called
differentiated services
• First 3 bits are called
precedence bits.
• Next 4 bits are
called type
of service (TOS) bits
• Last bit is not used.
IP Version 4 Protocol -
Services
a. Precedence is a 3-bit
subfield ranging from 0 (000
in binary) to 7 (111 in binary).
• Defines priority of
datagram in issues such as
congestion.
• If router is congested and
needs to discard some
datagrams, lowest
precedence datagrams are
discarded first.
IP Version 4 Protocol -
Services
b. Type of Service (TOS) bits
is a 4-bit subfield with each
bit having a special meaning.
• Although bits can be either
0 or 1, but only 1 bit set at a
time.
TOS bits Description
• Bit patterns and their
interpretations are given in 0000 Normal (Default)
Table. 0001 Minimize Cost
• With only 1 bit set at a 0010 Maximize reliability
time, we can have five
0100 Maximize throughput
different types of services.
1000 Maximize delay
Default types of
service
• Application programs can request a
specific type of service.
• Defaults for some applications are
shown in table
• Activities requiring immediate
attention and response need
minimum delay.
• Activities that send bulk data require
maximum throughput.
• Management activities need
maximum reliability.
• Background activities need minimum
cost
Default types of
service
• First 6 bits denote codepoint subfield
• Last 2 bits are not used.
• Codepoint subfield is used in two ways.
A. When 3 rightmost bits are 0’s, 3 leftmost bits
are interpreted same as precedence bits in
service type interpretation. i.e., it is
compatible with old interpretation.
Values for Codepoints
B. When 3 rightmost bits are not all 0’s, 6 bits
Category Code Description
define 64 services based on priority
assignment by Internet or local authorities Point
• First category (numbers 0, 2,4, ... ,62) is assigned
by Internet authorities (IETF). 1 XXXXX0 Internet
• Second category (3, 7, 11, 15,… 63) assigned by 2 XXXX11 Local
local authorities (organizations). 3 XXXX01 Temporary or
• Third category (1, 5, 9, ,61) is temporary and experimental
canused for experimental purposes.
be
IPv
6
•IPv4 provides host-to-host communication between systems in Internet.
• IPv4 is well designed, data communication has evolved since inception of IPv4 in 1970s.
• IPv4 has some deficiencies that make it unsuitable for the fast-growing Internet.
Despite all short-term solutions, such as subnetting, classless addressing, and NAT,
address depletion is still a long-term problem in Internet.
Internet must accommodate real-time audio and video transmission which requires
minimum delay strategies and reservation of resources not provided in IPv4 design.
No encryption or authentication is provided by IPv4.
• To overcome these deficiencies, IPv6 was proposed
• IPv6 was extensively modified to accommodate unforeseen growth of Internet.
• Format and length of IP address were changed along with packet format.
IPv6 Advantages
over
• LargerIPv4
address space: IPv6 address is 128 bits long while IPv4 is 32-bit long
• Better header format. In, IPv6 options are separated from base header and inserted, when
needed, between base header and upper-layer data. This simplifies and speeds up routing
process because most options do not need to be checked by routers.
• New options. IPv6 has new options to allow for additional functionalities.
• Allowance for extension. IPv6 is designed to allow extension of protocol if required by new
technologies or applications.
• Support for resource allocation. In IPv6, type-of-service field has been removed, but a
mechanism (called jlow label) has been added to enable source to request special handling
of packet. This mechanism can be used to support traffic such as real-time audio and
video.
• Support for more security. Encryption and authentication options in IPv6 provide
confidentiality and integrity of packet.
IPv6
Structure
• IPv6 address consists of 16 bytes (octets); it is 128 bits long.
• To make addresses more readable, IPv6 specifies hexadecimal colon notation.
• In this , 128 bits is divided into eight sections, each 2 bytes in length.
• Two bytes in hexadecimal notation requires four hexadecimal digits.
• Thus, address consists of 32 hexadecimal digits, with every four digits separated by a colon
Abbreviated IPv6
addresses
• IP address, in hexadecimal format, is very long, many of its digits are zeros.
• Leading zeros of a section (four digits between two colons) can be omitted. Only leading zeros
can be dropped, not trailing zeros
IPv6 datagram header and
payload
IPv6 datagram header and
payload
Packet Format
• Each packet is composed of a mandatory base header followed by payload.
• Payload consists of two parts: optional extension headers and data from an upper
layer.
• Base header occupies 40 bytes, whereas extension headers and data from upper layer
contain up to 65,535 bytes of information.
IPv6 datagram header and
payload
Base Header
• Base header has eight fields.
Version: 4-bit field defines
version number of IP. For IPv6,
value is 6.
Priority: 4-bit field defines
priority of packet w.r.t. traffic
congestion.
Flow label: 3-byte (24-bit) field
designed to provide special
handling for a particular flow of
data.
Payload length: 2-byte field
defines length of IP datagram
excluding base header.
IPv6 datagram header and
payload
Base Header
Next header: 8-bit field defining
header that follows base
header in datagram. One of optional
extension headers used by IP or
header of an encapsulated packet
such as UDP or TCP. Each extension
header also contains this field. This
field in version 4 is called protocol.
Hop limit: 8-bit field serves same
purpose as TIL field in IPv4.
Source address: 16-byte (128-bit)
Internet address that identifies
original source of datagram.
Destination address: 16-byte
(128-
bit) Internetofaddress,
destination identifies
datagram.
Comparison of IPv4
and IPv6 IPv4
Properties IPv6
Addressing Provides 32-bit addresses Provides 128-bit addresses which results
in a significantly larger address space
Security Does not provide security Provides authentication, integrity, and
mechanisms, and requires confidentiality during communication of
additional security protocols data over a network with the
facilitated by network devices implementation of IPSec protocol suite
• IPv6 addresses enable every device to have a unique and globally routable address,
reducing need for Network Address Translation (NAT).
• Constrained nodes are low-power, resource-constrained devices that operate with limited
memory, processing power, and battery life.
• 6LoWPAN protocol enables IPv6 communication between constrained nodes and internet
via wireless networks using smaller and more efficient IPv6 datagrams.
• 6LoWPAN protocol also utilizes fragmentation, which breaks up packets into smaller
fragments that can be transmitted more efficiently over network
What is
6LoWPAN
• Internet Engineering Task Force (IETF) formed 6LoWPAN Working Group in 2004 to design
an adaptation layer for IPv6 when running over 802.15.4 low-power and lossy networks
• This adaptation layer provides features such as : packet fragmentation and packet
reassembly, compression of header and Routing of data link layer
• 6 stands for letter 6 in IPv6
• 6LoWPAN is about use of IPv6 over WPAN.
• 6LoWPAN optimizes IPv6 packet transmission in low power lossy networks.
• Operates at two frequencies:
2400 to 2483.5 MHz (worldwide)
902 to 929 MHz (North America)
• Uses IEEE 802.15.4 standard in unslotted CSMA/CA MAC protocol mode
6LoWPAN
Features
• Allows IEEE 802.15.4 radios to carry 128 ‐bit addresses of IPv6.
• Header compression and address translation techniques allow IEEE 802.15.4 radios to
access Internet.
• IPv6 packets compressed and reformatted to fit IEEE 802.15.4 packet format.
• Allows for smallest devices with limited processing ability to transmit information
wirelessly using an IP.
route to destination,
Forwarding such RREQs until they reach destination LOADng Router,
• Enables WSNs to integrate with other IPv6-enabled networks, such as internet, which
can provide new opportunities for data collection, analysis, and visualization.
• Enable WSNs to efficiently and effectively communicate with each other and
with other networks.
Message Queue Telemetry
•Transport.
ISO standard (ISO/IEC PRF 20922).
• Publish‐subscriber‐based lightweight messaging protocol for use in conjunction with TCP/IP
protocol.
• Introduced by IBM in 1999 and standardized by OASIS in 2013.
• Designed to provide connectivity (mostly embedded) between applications and
middle‐wares on one side and networks and communications on the other side.
• Message broker controls publish‐subscribe messaging pattern.
• Topic to which client is subscribed is updated in form of messages and distributed by
message broker.
• Designed for:
1. Remote connections
2. Limited bandwidth
3. Small‐code footprint
Message Queue Telemetry
•Transport.
ISO standard (ISO/IEC PRF 20922).
• Publish‐subscriber‐based lightweight messaging protocol for use in conjunction with TCP/IP
protocol.
• Introduced by IBM in 1999 and standardized by OASIS in 2013.
• Designed to provide connectivity (mostly embedded) between applications and
middle‐wares on one side and networks and communications on the other side.
• Message broker controls publish‐subscribe messaging pattern.
• Topic to which client is subscribed is updated in form of messages and distributed by
message broker.
• Designed for:
1. Remote connections
2. Limited bandwidth
3. Small‐code footprint
MQTT
Components
• Lightweight sensors
Publishers
• Applications interested in sensor
Subscriber data
Disconnect
Subscribe
Unsubscribe
Publish
MQTT
Communication
MQTT
•Communication
Protocol uses publish/subscribe architecture (HTTP uses a
request/response paradigm).
• Publish/subscribe is event‐driven and enables messages to be pushed to
clients.
• Central communication point is MQTT broker, which is in charge of
dispatching all messages between senders and rightful receivers.
• Each client that publishes a message to broker, includes a topic into message.
• Topic is routing information for broker.
• Topic is a simple string that can have more hierarchy levels, separated by slash.
• Sample topic for sending temperature data of living room could be
house/living‐room/temperature.
• Client (e.g. mobile device) can subscribe to exact topic or can use a wildcard.
MQTT
Communication
• Subscription to house/+/temperature would result in all messages sent to
previously mentioned topic house/living‐ room/temperature, as
well as any topic with an arbitrary value in place of living room, such as
house/kitchen/temperature.
• Plus sign is a single level wild card and only allows arbitrary values for one
hierarchy.
• If more than one level needs to be subscribed, such as, entire sub‐tree, there is
also a
multilevel wildcard (#).
Applicati
ons
• Facebook Messenger uses MQTT for online chat.
• Microsoft Azure IoT Hub uses MQTT as its main protocol for telemetry messages.
• Adafruit launched a free MQTT cloud service for IoT experimenters called
Adafruit IO.
Secure MQTT
•(SMQTT)
Extension of MQTT, uses encryption based on lightweight attribute based
encryption.
• Advantage: Broadcast Encryption Feature, in which one message is encrypted and
delivered to multiple other nodes [common in IoT applications]
• Algorithm consists of four main stages: setup, encryption, publish and
decryption.
• In setup phase, subscribers and publishers register themselves to broker and
get a master secret key according to their developer’s choice of key generation
algorithm.
• When data is published, it is encrypted and published by broker to be sent to
subscribers, which is finally decrypted at subscriber end having same master secret
key.
CoAP – Constrained Application Protocol
• Web transfer protocol for use with constrained nodes and networks.
• Designed for Machine to Machine (M2M) applications such as smart energy
and building automation.
• Based on Request‐Response model between end‐points
• Client‐Server interaction is asynchronous over a datagram oriented transport
protocol such as UDP
• CoAP is a session layer protocol designed by IETF Constrained RESTful Environment
(CoRE) working group to provide lightweight RESTful (HTTP) interface.
• Representational State Transfer (REST) is standard interface between HTTP client and
servers.
• Lightweight applications such as those in IoT, could result in significant overhead
and consumption by REST.
power
CoAP – Constrained Application Protocol
• CoAP is designed to enable low‐power sensors to use RESTful services while
meeting their power constraints.
• Built over UDP, instead of TCP (which is commonly used with HTTP) and has a
light mechanism to provide reliability.
• CoAP architecture is divided into two main sub‐layers:
1. Messaging 2. Request/response.
• Messaging sub‐layer is responsible for reliability and duplication of messages,
while
request/response sub‐layer is responsible for communication.
• CoAP
1. has four messaging modes:
Confirmable 2. Non‐confirmable
3. Piggyback 4. Separate
CoAP Position
Application
Request
CoAP
Messages
UDP
CoAP Message Types
Message Types‐CoAP
Confirmable
Non‐confirmable
Piggyback
Separate
CoAP Request-Response Model
CoAP Request-Response Model
• Confirmable and non‐confirmable modes represent reliable and
unreliable transmissions, respectively, while other modes are used for
request/response.
• Provides for discovery of services residing locally or across network, and availability
information of these services.
XMPP – Extensible Messaging and Presence Protocol
• Well‐suited for cloud computing where virtual machines, networks, and firewalls
would present obstacles to alternative service discovery and presence‐based
solutions.
• Open means to support machine‐to‐machine or peer‐to‐peer communications
across a diverse set of networks.
• Decentralization – No central server; anyone can run their own XMPP server.
• Open standards – No royalties or granted permissions are required to implement
these specifications
• Security – Authentication, encryption, etc.
• Flexibility – Supports interoperability
XMPP – Extensible Messaging and Presence Protocol
Core XMPP Technologies
Core
• information about ore XMPP technologies for XML streaming
Jingle
• multimedia signalling for voice, video, file transfer
PubSub
• alerts and notifications for data syndication
BOSH
• HTTP binding for XMPP
XMPP – Weaknesses
THANKS