Internet of Things: An Introduction
• IoT Overview and Architecture
• IoT Communication Protocols
• Acknowledgements
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.1
What is IoT?
Internet of Things (IoT) comprises things that have unique identities
and are connected to the Internet
The focus on IoT is in the configuration, control and networking via the
Internet of devices or “Things” that are traditionally not associated
with the internet
Eg: pump, utility meter, car engine
IoT is a new revolution in the capabilities of the endpoints that are
connected to the internet
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.2
IoT Evolution
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.3
M2M vs IoT
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.4
IoT: People Connecting with Things
ECG sensor
Internet
Motion sensor
Motion sensor
Motion sensor
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.5
IoT: Things Connecting with Things
- Complex and heterogeneous
resources and networks
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.6
IoT: Application Areas
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.7
IoT Architecture
Integrated Application Smart Grid Green Smart TransportEnv.
Building Monitor
Information Processing Data Center Search Smart Info. Security Data Mining
Engine Decision
WWAN WMAN
Network Construction
Internet
WPAN WLAN
Sensing & Identification GPS Smart RFID Sensor Sensor
Device
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.8
IoT: Sensors and Actuators
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.9
IoT: Sensors Available in the Market
(examples)
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.10
IoT: Smart Objects (examples)
Beaglebone black
Intel Galileo
Arduino Uno Raspberry Pi
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.11
IoT Communication Technologies
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.12
IoT Network Topology
Unified & Horizontal IoT Platform
Device Management/Cloud 3GPP
Unlicensed LPWA
Licensed
2G/3G/LTE/WiFi/Fixed Networks in ISM
LPWA
bands (+ other
Network(s)
bands)
NB-IoT +
EC-GSM
+20dB
Link
budget
Concentrator
gain
RF Mesh
Smart Meters
Smart Meter Smart Building Fleet Management Smart Waste Smart Parking with
Management Management with battery-powered
battery-powered sensors
sensors
1.13
IoT Cloud: Sensing-As-A-Service
Model
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.14
IoT Protocols
CoAP ( Constrained Application Protocol)
MQTT (Message Queue Telemetry Transport)
XMPP (Extensible Messaging and Presence Protocol)
6LoWPAN (Low power Wireless Personal Area Networks)
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.15
IoT Protocol Architectures
Connectivity
Power Management
Security
Rapid Evolution
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.16
IoT Protocol Stack
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.17
The 6LoWPAN Format
• 6LoWPAN is an adaptation header format
• Enables the use of IPv6 over low-power wireless links
• IPv6 header compression
• UDP header compression
• Format initially defined in RFC 4944
• Updated by RFC 6282
6LoWPAN: The Wireless Embedded
v6.12.2009
Internet, Shelby & Bormann
1.18
IoT Transport Layer for Smart
Objects
• TCP for Smart Objects • UDP for Smart Objects
• Advantages • Advantages
• Built-in reliability • Low overhead for header size
and protocol logic
• Mechanism to recover
• Less energy for packet
lost packets
transmission and reception
• Control of the maximum size • More space for application
of its packets data
• Use of the TCP MSS • Small code footprint
(Maximum Segment • Well suited for traffic with low
Size) option reliability demand.
• Drawbacks
• Drawbacks • No provision of recovery
mechanism for lost packets
• Many TCP mechanisms e.g., (application has to recover
sliding-window, congestion them)
avoidance are not needed in • No mechanism for splitting
smart object networks application data into appropriate
• Large header size introduces packet sizes.
a significant overhead. • Usually, smart object
networks deal w/ small
packet sizes.
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.19
Constrained Application Protocol
(CoAP)
• IoT oriented and less complex alternative to HTTP
• Open IETF standard (RFC 7252)
• Datagram Transport Layer Security (DTLS)
• Easy proxy to/from HTTP
• URIs supported (e.g., coap://hostname:port/leds/red?q=state&on)
• RESTfull client-server model
• Implements reliable unicast over UDP
• Supports best effort multicast
• Client-Server & Publish-Subscribe models.
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.20
CoAP and HTTP Interworking
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.21
CoAP Message Layer Model
• Confirmed and non-confirmed message exchange models
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.22
CoAP Request/Response Layer Model
• Piggy-backed Confirmed • Separate Confirmed
Response Response
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.23
CoAP Request/Response Layer Model
• Non-confirmed Response
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.24
CoAP Message Format
CoAP message header Description
It is 2 bit unsigned integer. It mentions CoAP version
Ver
number. Set to one.
It is 2 bit unsigned integer. Indicates message type viz.
T confirmable (0), non-confirmable (1), ACK (2) or
RESET(3).
It is 4 bit unsigned integer, Indicates length of token (0 to
TKL
8 bytes).
It is 8 bit unsigned integer, It is split into two parts viz. 3
Code
bit class (MSBs) and 5 bit detail (LSBs).
16 bit unsigned integer. Used for matching responses.
Message ID
Used to detect message duplication.
Zero or more option fields may follow a token. A few
Options options are Content Format, Accept, Max-Age, Etag, Uri-
Path, Uri-Query, etc.
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.25
Message Queuing Telemetry
Transport (MQTT)
• Lightweight messaging protocol designed for sensors and devices with
• Flaky network connectivity
• Low computing power
• Connections where bandwidth is at a premium
• Works on top of TCP
• Transport Layer Security (TLS)
• Protocol specification is open source
• Applications:
• A way to obtain real world data
• Information is gathered by an increasing number of sensors and devices deployed
all over
• A way to provide real time information
• E.g. Locate an item in a supply chain
• Accurate current load of a any system (e.g. electricity meters)
• Current status of a system (level of liquid in a container, temperature,
pressure etc.)
• A way to connect all the devices and sensors directly to your messaging
infrastructure
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.26
MQTT Features
• Client/Server model with Clients and Brokers
• Publish and subscribe to topics
• Managed by the broker
• 3 qualities of service
• 0 Best effort to deliver a message
• 1 Deliver at least once
• 2 Deliver exactly once
• Supports persistent messages (only most recent per topic)
• Minimal transport overhead to reduce network traffic
• As little as 2 bytes
• Last Will and Testament
• MQTT clients can register a custom “last will and testament”
message to be sent by the broker if they disconnect.
• These messages can be used to signal to subscribers when a device
disconnects.
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.27
MQTT Architecture
• All three clients open TCP connections • At a later time, Client A publishes a value
with the broker. Clients B and C subscribe of 22.5 for topic temperature. The broker
to the topic temperature . forwards the message to all subscribed
clients.
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.28
MQTT Topics and Topic Matching
• In MQTT, topics are hierarchical, like a filing system (e.g.,
kitchen/oven/temperature).
• Wildcards are allowed when registering a subscription
(but not when publishing) allowing whole hierarchies to be
observed by clients.
• The wildcard + matches any single directory name, #
matches any number of directories of any name.
• Examples:
• kitchen/+/temperature matches kitchen/foo/temperature but
not kitchen/foo/bar/temperature
• kitchen/# matches
kitchen/fridge/compressor/valve1/temperature
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.29
MQTT Protocol
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.30
MQTT Message Format
• Fixed header
bit 7 6 5 4 3 2 1 0
DUP RETAI
byte 1 Message Type QoS level
flag N
byte 2 Remaining Length
Bit position Name Description
3 DUP Duplicate delivery
2-1 QoS Quality of Service
0 RETAIN RETAIN flag
Digits From To
1 0 (0x00) 127 (0x7F)
2 128 (0x80, 0x01) 16 383 (0xFF, 0x7F)
16 384 (0x80, 0x80, 2 097 151 (0xFF, 0xFF,
3
0x01) 0x7F)
2 097 152 (0x80, 0x80, 268 435 455 (0xFF,
4
0x80, 0x01) 0xFF, 0xFF, 0x7F)
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.31
MQTT for Sensor Networks (MQTT-SN)
• Even though MQTT is designed to be lightweight, it has
two drawbacks for very constrained devices:
• Every MQTT client must support TCP and will typically hold a
connection open to the broker at all times. For some
environments where packet loss is high or computing
resources are scarce, this is a problem.
• MQTT topic names are often long strings which make them
impractical for 802.15.4 and other low bitrate small packet
protocols.
• Both of these shortcomings are addressed by the MQTT-
SN protocol:
• MQTT does not require TCP (can use UDP or serial link)
• Broker support for indexing topic names (short topic IDs).
• Requires MQTT-SN to MQTT gateway.
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.32
MQTT vs CoAP
Features MQTT CoAP
Message Queue Constrained
Full Form
Telemetry Transport Application Protocol
Connect, connect
ack, publish,
publish ack, GET, PUT, POST and
Messages used
subscribe, DELETE
subscribe ack,
disconnect etc.
Architecture Publish/Subscribe Request/Response
required, end
not required, end
Need of centralized devices
devices direct
broker communicate via
communicate
broker
Transport protocol TCP/IP UDP/IP
Security protocol TLS DTLS
fault tolerance broker is SPoF server is SPoF
Interoperability foundational semantic
device to cloud device to cloud
scope
cloud to cloud cloud to cloud
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.33
Acknowledgements
1. Dr.Kayarvizhy, “Internet of Things”,
http://studyslide.com/doc/20337/iot---dr.-kayarvizhy
2. Augusto Casaca, “Internet of Things”, IFIP TC6 LATIN AMERICA
TUTORIALS IN NETWORKING
3. Xi Chen, “Constrained Application Protocol for Internet of Things”,
https://www.cse.wustl.edu/~jain/cse574-14/ftp/coap/index.html
4. Toby Jaffey, “MQTT and CoAP, IoT Protocols”,
https://www.eclipse.org/community/eclipse_newsletter/2014/february/
article2.php
5. “MQTT vs REST”, http://www.rfwireless-world.com/Terminology/MQTT-
vs-REST.html
Prof. António grilo https://fenix.Tecnico.Ulisboa.Pt/homepage/ist14017 RMSF - 2018 1.34