UNIT III (IoT)
UNIT III (IoT)
In essence, IoT architecture is the system of numerous elements that range fromsensors, protocols,
actuators, to cloud services, and layers. Besides, devices and sensors theInternet of Things (IoT) architecture
layers are distinguished to track the consistency of asystem through protocols and gateways. Different
architectures have been proposed byresearchers and we can all agree that there is no single consensus on architecture
for IoT.
1. Sensors/actuators
Sensors collect data from the environment or object under measurement and turn it into usefuldata. Think of the
specialized structures in your cell phone that detect the directional pull ofgravity and the phone's relative position to
the―thing¦ we call the earth and convert it intodata that your phone can use to orient the device.
Actuators can also intervene to change the physical conditions that generate the data. An actuator might, for
example, shut off a power supply, adjust an air flow valve, or move arobotic gripper in an assembly process.
The sensing/actuating stage covers everything from legacy industrial devices to roboticcamera systems,
water level detectors, air quality sensors, accelerometers, and heart ratemonitors. And the scope of the IoT is
expanding rapidly, thanks in part to low-power wirelesssensor network technologies and Power over Ethernet,
which enable devices on a wired LANto operate without the need for an A/C power source.
The data from the sensors starts in analog form. That data needs to be aggregated and convertedinto digital
streams for further processing downstream. Data acquisition systems
(DAS) perform these data aggregation and conversion functions. The DAS connects to the sensor
network, aggregates outputs, and performs the analog-to-digital conversion. The Internet gateway receives the
aggregated and digitized data and routes it over Wi-Fi, wired LANs, orthe Internet, to Stage 3 systems for further
processing. Stage 2 systems often sit in close proximity to the sensors and actuators.
For example, a pump might contain a half-dozen sensors and actuators that feed datainto a data aggregation device
that also digitizes the data. This device might be physically attached to the pump. An adjacent gateway device or
server would then process the data and forward it to the Stage 3 or Stage 4 systems. Intelligent gateways can build
on additional, basic gateway functionality by adding such capabilities as analytics, malware protection, and data
management services. These systems enable the analysis of data streams in real time.
3. Edge IT
Once IoT data has been digitized and aggregated, it's ready to cross into the realm of IT. However, the data may
require further processing before it enters the data centre. This is where edge IT systems, which perform more
analysis, come into play. Edge IT processing systems may be located in remote offices or other edge locations, but
generally these sit in the facility or location where the sensors reside closer to the sensors, such as in a wiring closet.
Because IoT data can easily eat up network bandwidth and swamp your data centre resources, it's best to have
systems at the edge capable of performing analytics as a way to lessen the burden on core IT infrastructure. You'd
also face security concerns, storage issues, and delays processing the data. With a staged approach, you can pre-
process the data, generate meaningful results, and pass only those on. For example, rather than passing on raw
vibration data for the pumps, you could aggregate and convert the data, analyse it, and send only projections as to
when eachdevice will fail or need service.
Data that needs more in-depth processing, and where feedback doesn't have to beimmediate, gets
forwarded to physical data centre or cloud-based systems, where more powerful IT systems can analyse,
manage, and securely store the data. It takes longer to getresults when you wait until data reaches Stage
4, but you can execute a more in-depth analysis,as well as combine your sensor data with data from other sources
for deeper insights. Stage 4 processing may take place on-premises, in the cloud, or in a hybrid
cloud system, but the typeof processing executed in this stage remains the same, regardless of the platform.
A Reference Architecture (RA) can be visualisedas the ―Matrix that eventually gives birth
ideally to all concrete architectures. For establishing such a Matrix, based on a strong andexhaustive analysis of the
State of the Art, we need to envisage the superset of all possiblefunctionalities, mechanisms and protocols that can
be used for building such concretearchitecture and to show how interconnections could take place between selected
ones (as noconcrete system is likely to use all of the functional possibilities). Giving such a foundationalong with a
set of design-choices, based on the characterisation of the targeted system w.r.t.various dimensions (like distribution,
security, real-time, semantics) it becomes possible for asystem architect to select the protocols, functional
components, architectural options, neededto build their IoT systems.
As any metaphoric representation, this tree does not claim to be fully consistent in its depiction;it should therefore
not be interpreted too strictly. On the one hand, the roots of this tree are spanning across a selected set of
communication protocols (6LoWPAN, Zigbee, IPv6,) anddevice technologies (sensors, actuators, tags,) while on
the other hand the blossoms / leaves ofthe tree represent the whole set of IoT applications that can be built from the
sap (i.e., data andinformation) coming from the roots. The trunk of the tree is of utmost importance
here, as itrepresents the Architectural Reference Model (ARM). The ARM is the combination of theReference
Model and the Reference Architecture, the set of models, guidelines, best practices, views and perspectives that can
be used for building fully interoperable concrete IoT architectures and systems. In this tree, we aim at selecting a
minimalset of interoperable technologies (the roots) and proposing the potentially necessary set ofenablers or
building blocks (the trunk) that enable the creation of a maximal set of interoperableIoT systems (the leaves).
Business scenarios defined as requirements by stakeholders are the drivers of the architecturework. With the
knowledge of businesses aspirations, a holistic view of IoT architectures can be derived.
The IoT Reference Model provides the highest abstraction level for the definition of the IoT-A
Architectural Reference Model. It promotes a common understanding of the IoT domain.The description of the IoT
Reference Model includes a general discourse on the IoT domain,an IoT Domain Model as a top-level
description, an IoT Information Model explaining howIoT information is going to be modelled, and an
IoT Communication Model in order tounderstand specifics about communication between many heterogeneous
IoT devices and theInternet as a whole.
The IoT Reference Architecture is the reference for building compliant IoT architectures. Assuch, it provides views
and perspectives on different architectural aspects that are of concern to stakeholders of the IoT. The terms’ view
and perspectives are used according to the generalliterature and standards the creation of the IoT Reference
Architecture focuses on abstract setsof mechanisms rather than concrete application architectures. To organisations,
an importantaspect is the compliance of their technologies with standards and best practices, so
thatinteroperability across organisations is ensured.
In an IoT system, data is generated by multiple kinds of devices, processed in different ways, transmitted to different
locations, and acted upon by applications. The proposed IoT referencemodel is comprised of seven levels. Each
level is defined with terminology that can be standardized to create a globally accepted frame of reference.
Simplifies: It helps break down complex systems so that each part is moreunderstandable.
Clarifies: It provides additional information to precisely identify levelsof the IoT and to establish
common terminology.
Identifies: It identifies where specific types of processing is optimized across different parts of the system.
Standardizes: It provides a first step in enabling vendors to create IoT products thatwork with each other.
Organizes: It makes the IoT real and approachable, instead of simply conceptual.
IoT reference Model:
2. Connectivity:
Communications and connectivity are concentrated in one level--Level 2. The most important function of Level 2
is reliable, timely information transmission. This includes transmissions:
Traditional data communication networks have multiple functions, as evidenced by theInternational Organization
for Standardization (ISO) 7-layer reference model. However, a complete IoT system contains many levels in
addition to thecommunications network. One objective of the IoT Reference Model is for communications and
processing to be executed by existing networks. The IoT Reference Model does not require or indicate creation of a
different network .it relies on existing networks. However, some legacy devices aren’t IP-enabled, which
willrequire introducing communication gateways. Other devices will require proprietarycontrollers to serve the
communication function. However, over time, standardizationwill increase. As Level 1 devices proliferate, the ways
in which they interact with Level2 connectivity equipment may change. Regardless of the details, Level 1 devices
communicate through the IoT system by interacting with Level 2 connectivity equipment.
Connectivity includes:
• Thresholding
• Event generation
➢
➢ If data is of interest to higher levels: If so, Level 4 processing is the first levelthat is configured to serve the
specific needs of a higher level.
➢ If data must be persisted: Should data be kept on disk in a non-volatile state oraccumulated
in memory for short-term use?
➢ The type of storage needed: Does persistency require a file system, big datasystem, or relational database?
➢ If data is organized properly: Is the data appropriately organized for the requiredstorage system?
➢ If data must be recombined or recomputed: Data might be combined, recomputed, or aggregated with
previously stored information, some of whichmay have come from non-IoT sources.
As Level 4 captures data and puts it at rest, it is now usable by applications on a non-real-
time basis. Applications access the data when necessary. In short, Level 4 converts event-based
datato query-based processing. This is a crucial step in bridging the differences between the real-time networking
world and the non-real-time application world. Figure 6 summarizes theactivities that occur at Level 4.
5. Data Abstraction:
IoT systems will need to scale to a corporate — or even global — level and will requiremultiple storage systems
to accommodate IoT device data and data from traditionalenterprise ERP, HRMS, CRM, and other systems. The
data abstraction functions ofLevel 5 are focused on rendering data and its storage in ways that enable
developingsimpler, performance-enhanced applications. With multiple devices generating data there are many
reasons why this data may not land in the same data storage:
There might be too much data to put in one place.
Moving data into a database might consume too much processing power, so thatretrieving it must be separated from
the data generation process. This is donetoday with online transaction processing (OLTP) databases and
datawarehouses.
Levels 3 and 4 might separate “continuous streams of raw data” from “data thatrepresents an event.” Data storage
for streaming data may be a big data system,such as Hadoop. Storage for event data may be a relational
databasemanagement system (RDBMS) with faster query times.
But frequently, the action needed requires more than one person. People must be ableto communicate and
collaborate, sometimes using the traditional Internet, to make theIoT useful. Communication and collaboration often
require multiple steps. And itusually transcends multiple applications. This is why Level 7, as shown in Figure
9,represents a higher level than a single application.
FIG 10
Security in the IoT:
Discussions of security for each level and for the movement of data between levelscould fill a
multitude of papers. For the purpose of the IoT Reference Model, securitymeasures must:
o Secure each device or system
o Provide security for all processes at each level
o Secure movement and communication between each level, whether north- orsouth-boundAs
shown in Figure 10, security must pervade the entire mode
Protocols:
Internet protocol (IP) is a set of rules that dictates how data gets sent to the internet.
IoT protocols ensure that information from one device or sensor gets read and understood by
another device, a gateway, a service. Protocols they are:
1. 6LowPAN
2. RPL
3. CoAP
4. MQTT
6LoWPAN: (Internet Protocol version 6 (IPv6) over low-power wireless
networks):
While the Internet Protocol is key for a successful Internet of Things, constrained nodes andconstrained networks
mandate optimization at various layers and on multiple protocols of theIP architecture. Some optimizations are
already available from the market or underdevelopment by the IETF. Figure below highlights the TCP/IP layers
where optimization is applied.
Unless the technology is proprietary, IP adaptation layers are typically defined by an IETFworking group and
released as a Request for Comments (RFC). An RFC is a publication fromthe IETF that officially documents
Internet standards, specifications, protocols, procedures,and events. For example, RFC 864 describes how an IPv4
packet gets encapsulated over anEthernet frame, and RFC 2464 describes how the same function is performed for
an IPv6 packet.
IoT-related protocols follow a similar process. The main difference is that an adaptation layerdesigned for IoT may
include some optimizations to deal with constrained nodes and networks.The main examples of adaptation layers
optimized for constrained nodes or “things” are the ones under the 6LoWPAN working group and
its successor, the 6Lo working group.
The initial focus of the 6LoWPAN working group was to optimize the transmission of IPv6 packets over
constrained networks such as IEEE 802.15.4. Figure below shows an example of an IoT protocol
stack using the 6LoWPAN adaptation layer beside the well-known IP protocolstack for reference.
The 6LoWPAN protocol does not support IPv4, and, in fact, there is no standardized IPv4adaptation layer for IEEE
802.15.4. 6LoWPAN header compression is stateless, andconceptually it is not too complicated. However, a
number of factors affect the amount ofcompression, such as implementation of RFC 4944 versus RFC 6922,
whether UDP isincluded, and various IPv6 addressing scenarios.
At a high level, 6LoWPAN works by taking advantage of shared information known by allnodes from their
participation in the local network. In addition, it omits some standard headerfields by assuming commonly used
values. Figure below highlights an example that shows theamount of reduction that is possible with 6LoWPAN
header compression.
The bottom half of Figure above shows a frame where header compression has been enabledfor a best-case scenario.
The 6LoWPAN header increases to 2 bytes to accommodate the compressed IPv6 header, and UDP has been
reduced in half, to 4 bytes from 8. Mostimportantly, the header compression has allowed the payload to more than
double, from 53 bytes to 108 bytes, which is obviously much more efficient. Note that the 2-
byte header compression applies to intra-cell communications, while communications external to the cellmay
require some field of the header to not be compressed.
Mesh Addressing
The purpose of the 6LoWPAN mesh addressing function is to forward packets over multiple hops. Three fields are
defined for this header: Hop Limit, Source Address, and Destination Address. Analogous to the IPv6 hop limit field,
the hop limit for mesh addressing also providesan upper limit on how many times the frame can be forwarded. Each
hop decrements this value by 1 as it is forwarded. Once the value hits 0, it is dropped and no longer
are forwarded.The Source Address and Destination Address fields for mesh addressing IEEE
802.15.4addresses indicating the endpoints of an IP hop. Figure below details the 6LoWPAN mesh addressing
header fields.
Note that the mesh addressing header is used in a single IP subnet and is a Layer 2 type ofrouting
known as mesh-under. RFC 4944 only provisions the function in this case as thedefinition of Layer 2 mesh routing
specifications was outside the scope of the 6LoWPAN working group, and the IETF doesn’t define “Layer 2
routing.” An implementation performing Layer 3 IP routing does not need to implement a mesh addressing header
unless required by agiven technology profile.
When considering constrained networks and/or a large-scale deployment of constrained nodes, verbose web-based
and data model protocols, may be too heavy for IoT applications. To address this problem, the IoT industry is
working on new light weight protocols that are better suited to large numbers of constrained nodes and networks.
Two of the most popular protocols are CoAP and MQTT.
The CoAP messaging model is primarily designed to facilitate the exchange ofmessages over UDP between
endpoints, including the secure transport protocolDatagram Transport Layer Security (DTLS).
From a formatting perspective, a CoAP message is composed of a short fixed-length Header field (4 bytes), a
variable-length but mandatory Token field (0– 8 bytes),Options fields if necessary, and the Payload field. Figure
below details the CoAPmessage format, which delivers low overhead while decreasing parsing complexity.
CoAP Message Format
The CoAP message format is relatively simple and flexible. It allows CoAP todeliver low overhead, which is
critical for constrained networks, while also being easyto parse and process for constrained devices.
CoAP Message Fields
CoAP can run over IPv4 or IPv6. However, it is recommended that the message fit within asingle IP packet and
UDP payload to avoid fragmentation. For IPv6, with the default MTU
size being 1280 bytes and allowing for no fragmentation across nodes, the maximum CoAP
message size could be up to 1152 bytes, including 1024 bytes for the payload. In thecase of IPv4, as IP fragmentation
may exist across the network, implementations should limit themselves to more conservative values and set the IPv4
Don’t Fragment (DF) bit.
CoAP communications across an IoT infrastructure can take various paths. Connections can be between devices
located on the same or different constrained networks or between devices andgeneric Internet or cloud
servers, all operating over IP. Proxy mechanisms are also defined, and RFC 7252 details a basic HTTP mapping for
CoAP. As both HTTP and CoAP are IP
based protocols, the proxy function can be located practically anywhere in the network, not
necessarily at the border between constrained and non-constrained networks.
Just like HTTP, CoAP is based on the REST architecture, but with a “thing” acting as both the client and the server.
Through the exchange of asynchronous messages, a client requests anaction via a method code on a server resource.
A uniform resource identifier (URI) localizedon the server identifies this resource. The server responds with a
response code that may includea resource representation. The CoAP request/response semantics include the
methods GET, POST, PUT, and DELETE.
The application on the right side of Figure above is an MQTT client that is a subscriber to theTemp/RH data being
generated by the publisher or sensor on the left. This model, wheresubscribers express a desire to receive information
from publishers, is well known. A greatexample is the collaboration and social networking application Twitter.
With MQTT, clients can subscribe to all data (using a wildcard character) or specific data fromthe information
tree of a publisher. In addition, the presences of a message broker in MQTTdecouples the data
transmission between clients acting as publishers and subscribers. In fact, publishers and subscribers do not
even know (or need to know) about each other. A benefit of having this decoupling is that the MQTT
message broker ensures that information can be buffered and cached in case of network failures. This also
means that publishers and subscribersdo not have to be online at the same time. MQTT control packets run
over a TCP transport using port 1883. TCP ensures an ordered, lossless stream of bytes between the MQTT client
and the MQTT server. Optionally, MQTT can be secured using TLS on port 8883, andWebSocket (defined in RFC
6455) can also be used.
MQTT is a lightweight protocol because each control packet consists of a 2-byte fixed headerwith optional variable
header fields and optional payload. You should note that a control packetcan contain a payload up to 256 MB. Figure
2.23 provides an overview of the MQTT message format.
Compared to the CoAP message format, MQTT contains a smaller header of 2 bytes comparedto 4 bytes for CoAP.
The first MQTT field in the header is Message Type, which identifies thekind of MQTT packet within a message.
Fourteen different types of control packets arespecified in MQTT version 3.1.1. Each of them has a unique value
that is coded into theMessage Type field. Note that values 0 and 15 are reserved. MQTT message types
aresummarized in the above table.
The next field in the MQTT header is DUP (Duplication Flag). This flag, when set, allows theclient to notate that
the packet has been sent previously, but an acknowledgement was notreceived. The QoS header field allows for the
selection of three different QoS levels. The nextfield is the Retain flag. Only found in a PUBLISH message, the
Retain flag notifies the serverto hold onto the message data. This allows new subscribers to instantly receive the last
knownvalue without having to wait for the next update from the publisher.
The last mandatory field in the MQTT message header is Remaining Length.This fieldspecifies the number of
bytes in the MQTT packet following this field.
MQTT sessions between each client and server consist of four phases: session establishment, authentication, data
exchange, and session termination. Each client connecting to a server hasa unique client ID, which allows the
identification of the MQTT session between both parties.When the server is delivering an application message to
more than one client, each client istreated independently.
A message broker uses a topic string or topic name to filter messages for its subscribers. Whensubscribing to a
resource, the subscriber indicates the one or more topic levels that are used tostructure the topic name. The forward
slash (/) in an MQTT topic name is used to separate eachlevel within the topic tree and provide a hierarchical structure
to the topic names.
RPL stands for Routing Protocol for Low Power and Lossy Networks for heterogeneous trafficnetworks. It is a
routing protocol for Wireless Networks. This protocol is based on the samestandard as by Zigbee and
6 Lowpan is IEEE 802.15.4 It holds both many-to-one and one-to-one communication. It is a Distance Vector
Routing Protocol that creates a tree-like routingtopology called the Destination Oriented Directed Acyclic Graph
(DODAG), rooted towardsone or more nodes called the root node or sink node.
The Directed Acyclic Graphs (DAGs) are created based on user-specified specific ObjectiveFunction (OF).
The OF defines the method to find the best-optimized route among the numberof sensor devices.
The IETF chartered the ROLL (Routing Over Low power and Lossy networks) working groupto
evaluate all three routing protocols and determine the needs and requirements for developinga routing solution for
IP smart objects. After the study of various use cases and a survey ofexisting protocols, the consensus was that a new
routing protocol should be developed for IPsmart objects, given the characteristics and requirements of the
constrained network. This newDistance Vector Routing Protocol was named the IPv6 Routing Protocol for Low
power and Lossy networks (RPL). The RPL specification was published as RFC 6550 by the ROLLworking
group.
In an RPL Network, each node acts as a router and becomes part of a mesh network. Routingis
performed at the IP Layer. Each node examines every received IPv6 packet and determinesthe next-hop destination
based on the information contained in the IPv6 header. No informationfrom the MAC layer header is needed to
perform the next determination.
Modes of RPL:
This protocol defines two modes:
Storing mode: All modes contain the entire routing table of the RPL domain.Every nodeknows how
to reach every other node directly.
Non-Storing mode: Only the border router(s) of the RPL domain contain(s) the full routingtable.
All other nodes in the domain maintain their list of parents only and use this as a list ofdefault routes towards the
border router. The abbreviated routing table saves memory spaceand CPU. When communicating in non-storing
mode, a node always forwards its packet to the border router, which knows how to ultimately reach the
final destination.
RPL is based on the concept of a Directed Acyclic Graph (DAG). A DAG is Directed Graphwhere no cycle exists.
This means that from any vertex or point in the graph, we cannot followan edge or a line back to this same point. All
of the edges are arranged in a path oriented towardand terminating at one or more root nodes.
A basic RPL process involves building a Destination Oriented Directed Acyclic Graph (DODAG). A DODAG is
a DAG rooted in one destination. In RPL this destination occurs at
a border router known as the DODAG root.
In a DODAG, three parents maximum aremaintained by each node that provides a path to the root. Typically
one of these parents is the preferred parent, which means it is the preferred next hop for upward
roots towards the root.The routing graph created by the set of DODAG parents across all nodes defines the full
set ofupwards roots. RPL protocol information should ensure that routes are loop-free by
disallowingnodes from selected DODAG parents positioned further away from a border router.
Implementation of RPL Protocol:
The RPL protocol is implemented using the Contiki Operating system. This Operating Systemmajorly focuses on
IoT devices, more specifically Low Power Wireless IoT devices. It is an Open source Model and was first bought
into the picture by Adam Dunkel’s.
The RPL protocol mostly occurs in wireless sensors and networks. Other similar OperatingSystems include T-
Kernel, EyeOS, LiteOS, etc.
➢ 8 fields for storing data of any type - These can be used to store the data from a sensoror from an embedded
device
➢ 3 location fields - Can be used to store the latitude, longitude and the elevation. These are very useful for
tracking a moving device.
➢ 1 status field - A short message to describe the data stored in the channel.
To use Thing Speak, we need to signup and create a channel. Once we have a channel, we cansend the data, allow
Thing Speak to process it and also retrieve the same. Let us start exploringThing Speak by signing up and setting
up a channel.
Thing Speak allows for IoT analytics with its cloud supportive features that make it easier foryou to analyse the live
data. It supports MATLAB code that a developer can write and performactions on the live data streams. It includes
different functions like data visualization, pre- processing, analysis, and more.
The functions included in Thing Speak are:
❖ Location Tracing
❖ Information distribution through public channels and gathering through a private channel
❖ Includes cloud support
❖ Online analytics of data to identify patterns and relations
❖ device executions supported through command schedule
❖ Social sharing support through Twilio and Twitter
❖ Alerts for every reaction
It allows one to prototype an IoT system in advance before they start the development. Theanalytics and data
generated through Thing Speak are incredibly reliable as the tool
enables performing the best operations and delivers excellent results to make your IoT system full
proof.