Physical Design of IOT
Physical Design of IOT
• It refers to IoT Devices and IoT Protocols.
• Things are Node device which have unique identities and can
  perform remote sensing, actuating and monitoring
  capabilities.
• IoT Protocols helps Communication established between
  things and cloud based server over the Internet.
                         Things
• Basically Things refers to IoT Devices which have unique
  identities and can perform remote sensing, actuating and
  monitoring capabilities. Things are main part of IoT
  Application. IoT Devices can be various type, Sensing
  Devices, Smart Watches, Smart Electronics appliances,
  Wearable Sensors, Automobiles, and industrial machines.
  These devices generate data in some forms or the other
  which when processed by data analytics systems leads to
  useful information to guide further actions locally or
  remotely.
Universal Asynchronous Receiver-
Transmitter (UART)
• UART stands for universal asynchronous receiver/transmitter and is a
  simple, two-wire protocol for exchanging serial data.
• Asynchronous means no shared clock, so for UART to work, the same
  bit or baud rate must be configured on both sides of the connection.
• Start and stop bits are used to indicate where user data begins and
  ends, or to “frame” the data.
• Serial Peripheral Interface (SPI)
• Inter-Integrated Circuit (I2C) Protocol
• Controller Area Network (CAN)
                    IoT Protocols
• IoT protcols help to establish Communication between IoT
  Device (Node Device) and Cloud based Server over the
  Internet.
• It help to sent commands to IoT Device and received data
  from an IoT device over the Internet.
IOT Protocols
                      IOT Protocols
• Link Layer
• Link layer protocols determine how data is physically sent
  over the network’s physical layer or medium (Coxial calbe or
  other or radio wave).
• Link Layer determines how the packets are coded and
  signaled by the hardware device over the medium to which
  the host is attached (eg. coxial cable).
                  802.3 – Ethernet
• IEEE 802.3 defines the physical layer and the medium access
  control (MAC) sub-layer of the data link layer for wired
  Ethernet networks.
• Ethernet is a set of technologies and protocols that are used
  primarily in LANs.
                    802.11 – WiFi
• IEEE 802.11 is part of the IEEE 802 set of LAN protocols, and
  specifies the set of media access control (MAC) and physical
  layer (PHY) protocols for implementing wireless local area
  network (WLAN) Wi-Fi computer communication in various
  frequencies, including but not limited to 2.4 GHz, 5 GHz, and
  60 GHz frequency bands.
               802.15.4 -LR-WPAN
• A collection of standards for Low-rate wireless personal area
  network.
• The IEEE’s 802.15.4 standard defines the MAC and PHY layer
  used by, but not limited to, networking specifications such as
  Zigbee®, 6LoWPAN, Thread, WiSUN and MiWi protocols.
• The standards provide low-cost and low-speed communication
  for power-constrained devices.
2G/3G/4G- Mobile Communication :
• These are different types of telecommunication generations.
  IoT devices are based on these standards can communicate
  over the celluer networks.
                Application Layer
• Application layer protocols define how the applications
  interface with the lower layer protocols to send over ther
  network.
MQTT
  Introduction to Internet of Things   3
         Introduction
     ✓Message Queue Telemetry Transport.
     ✓ISO standard (ISO/IEC PRF 20922).
     ✓It is a publish‐subscribe‐based lightweight
      messaging protocol for use in conjunction with the
      TCP/IP protocol.
     ✓MQTT was 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.
Source: “MQTT”, Wikipedia (Online)
                                     Introduction to Internet of Things   4
✓A message broker controls the publish‐subscribe
 messaging pattern.
✓A topic to which a client is subscribed is updated
 in the form of messages and distributed by the
 message broker.
✓Designed for:
  ▪ Remote connections
  ▪ Limited bandwidth                                                     5
  ▪ Small‐code footprint
Source: “MQTT”, Wikipedia (Online)   Introduction to Internet of Things
    MQTT Components
                            Publishers    • Lightweight sensors
                          Subscribers     • Applications interested in sensor data
                                Brokers   • Connect publishers and subscribers
                                          • Classify sensor data into topics
Source: “MQTT”, Wikipedia (Online)
                                           Introduction to Internet of Things        6
    MQTT Methods
                  Connect
                  Disconnect
                  Subscribe
                  Unsubscribe
                  Publish
Source: “MQTT”, Wikipedia (Online)
                                     Introduction to Internet of Things   7
                                                                                                         8
                                                                    Introduction to Internet of Things
Source: “MQTT 101 – How to Get Started with the lightweight IoT Protocol”, HiveMQ (Online)
   Communication
   ✓The protocol uses a publish/subscribe
     architecture (HTTP uses a request/response
     paradigm).
   ✓Publish/subscribe is event‐driven and enables
     messages to be pushed to clients.
   ✓The central communication point is the MQTT
     broker, which is in charge of dispatching all
     messages between the senders and the rightful
     receivers.
   ✓Each client that publishes a message to the broker,
     includes a topic into the message. The topic is the
     routing information for the broker.
Source: “MQTT 101 – How to Get Started with the
lightweight IoT Protocol”, HiveMQ (Online)
✓Each client that wants to receive messages
 subscribes to a certain topic and the broker delivers
 all messages with the matching topic to the client.
✓Therefore the clients don’t have to know each
 other. They only communicate over the topic.
✓This architecture enables highly scalable solutions
 without dependencies between the data producers
 and the data consumers.
   Source: “MQTT 101 – How to Get Started with the lightweight IoT Protocol”, HiveMQ (Online)
                                                                                Introduction to Internet of Things   10
MQTT Topics
✓A topic is a simple string that can have more
 hierarchy levels, which are separated by a slash.
✓A sample topic for sending temperature data of
 the living room could be
 house/living‐room/temperature.
✓On one hand the client (e.g. mobile device) can
 subscribe to the exact topic or on the other hand,                                          11
 it can use a wildcard.
Source: “MQTT 101 – How to Get Started with the lightweight IoT Protocol”, HiveMQ (Online)
       ✓The subscription to house/+/temperature would
        result in all messages sent to the previously
        mentioned topic house/living‐ room/temperature, as
        well as any topic with an arbitrary value in the place
        of living room, such as house/kitchen/temperature.
       ✓The 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, the entire sub‐tree, there is also a multilevel
        wildcard (#).
       ✓It allows to subscribe to all underlying hierarchy
        levels.
       ✓For example house/# is subscribing to all topics
        beginning with
        house.
Source: “MQTT 101 – How to Get Started with the lightweight IoT Protocol”, HiveMQ (Online)
                                                                             Introduction to Internet of Things   12
  Applic ations
✓Facebook Messenger uses MQTT for online chat.
✓Amazon Web Services use Amazon IoT with
 MQTT.
✓Microsoft Azure IoT Hub uses MQTT as its main
 protocol for telemetry messages.
✓The EVRYTHNG IoT platform uses MQTT as an
 M2M protocol for millions of connected products.
✓Adafruit launched a free MQTT cloud
 service for IoT experimenters called Adafruit
 IO.
                       Introduction to Internet of Things   13
            SMQTT
       ✓Secure MQTT is an extension of MQTT which
        uses encryption based on lightweight attribute
        based encryption.
       ✓The main advantage of using such encryption is
        the broadcast encryption feature, in which one
        message is encrypted and delivered to multiple
        other nodes, which is quite common in IoT
        applications.
       ✓In general, the algorithm consists of four main
        stages: setup, encryption, publish and
        decryption.
Source: M. Singh, M. Rajan, V. Shivraj, and P. Balamuralidhar, "Secure MQTT for Internet of Things (IoT)," in Fifth International Conference on Communication Systems
and Network Technologies (CSNT 2015), April 2015, pp. 746‐751
                                                                             Introduction to Internet of Things                                                         14
✓In the setup phase, the subscribers and publishers register
 themselves to the broker and get a master secret key
 according to their developer’s choice of key generation
 algorithm.
✓When the data is published, it is encrypted and published
 by the broker which sends it to the subscribers, which is
 finally decrypted at the subscriber end having the same
 master secret key.
✓The key generation and encryption algorithms are not
 standardized.
✓SMQTT is proposed only to enhance MQTT security               15
 features.
CoAP
 Introduction to Internet of Things   2
                             Introduction
        ✓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
Source: Z. Shelby , K. Hartke, C. Bormann, “The Constrained Application Protocol (CoAP)”, Internet Engineering TasktoForce
                                                                                                    Introduction           (IETF),
                                                                                                                      Internet  ofStandards
                                                                                                                                   Things Track,
2014
        ✓The Constrained Application Protocol (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 the
         standard interface between HTTP client and servers.
        ✓Lightweight applications such as those in IoT, could
         result in significant overhead and power consumption
         by REST.
        ✓CoAP is designed to enable low‐power sensors to use
         RESTful services while meeting their power constraints.
Source: Z. Shelby , K. Hartke, C. Bormann, “The Constrained Application Protocol (CoAP)”, Internet Engineering Task Force (IETF), Standards Track, 2014
                                                                                                     Introduction to Internet of Things                   4
✓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:
  ▪ Messaging
  ▪ Request/response.
✓The messaging sub‐layer is responsible for reliability and
 duplication of messages, while the request/response sub‐layer is
 responsible for communication.
✓CoAP has four messaging modes:
  ▪ Confirmable
  ▪ Non‐confirmable
  ▪ Piggyback                    Introduction to Internet of Things   5
  ▪ Separate
       CoAP Position
                                                                     Application
                                                         Request
                                                                                       CoAP
                                                        Messages
                                                                          UDP
Source: Z. Shelby , K. Hartke, C. Bormann, “The Constrained Application Protocol (CoAP)”, Internet Engineering Task Force (IETF), Standards Track,
2014
                                                                        Introduction to Internet of Things
   CoAP Message Types
                                            Message Types‐CoAP
                                                                    Confimble
                                                                 Non‐Confirmable
                                                                    Piggyback
                                                                    Separate
Source: Z. Shelby , K. Hartke, C. Bormann, “The Constrained Application Protocol (CoAP)”, Internet Engineering Task Force (IETF), Standards Track,
2014
                                                                        Introduction to Internet of Things
      CoAP Request-Response Model
Source: V. Karagiannis, P. Chatzimisios, F. Vazquez‐Gallego, and J. Alonso‐Zarate, "A survey on application layer protocols for the internet of
things," Transaction on IoT and Cloud Computing, vol. 3, no. 1, pp. 11‐17, 2015
                                                                          Introduction to Internet of Things
✓Confirmable and non‐confirmable modes represent the
 reliable and unreliable transmissions, respectively, while
 the other modes are used for request/response.
✓Piggyback is used for client/server direct communication
 where the server sends its response directly after receiving
 the message, i.e., within the acknowledgment message.
✓On the other hand, the separate mode is used when the
 server response comes in a message separate from the
 acknowledgment, and may take some time to be sent by
 the server.
✓Similar to HTTP, CoAP utilizes GET, PUT, PUSH, DELETE
                                                    9
 messages requests to retrieve, create, update, and delete,
 respectively
      CoAP Request-Response Model
Source: V. Karagiannis, P. Chatzimisios, F. Vazquez‐Gallego, and J. Alonso‐Zarate, "A survey on application layer protocols for the internet of
things," Transaction on IoT and Cloud Computing, vol. 3, no. 1, pp. 11‐17, 2015
                                                                          Introduction to Internet of Things
       Features
       ✓ Reduced overheads and parsing complexity.
       ✓ URL and content‐type support.
       ✓ Support for the discovery of resources provided by known
         CoAP services.
       ✓ Simple subscription for a resource, and resulting push
         notifications.
       ✓ Simple caching based on maximum message age.
Source: ”Constrained Application Protocol”, Wikipedia (Online)
                                                                 Introduction to Internet of Things   11
XMPP
 Introduction to Internet of Things   12
     Introduction
      ✓ XMPP – Extensible Messaging and Presence Protocol.
      ✓ A communication protocol for message‐oriented middleware
        based on XML (Extensible Markup Language).
      ✓ Real‐time exchange of structured data.
      ✓ It is an open standard protocol.
Source: “XMPP”, Wikipedia (Online)
                                     Introduction to Internet of Things   13
      ✓ XMPP uses a client‐server architecture.
      ✓ As the model is decentralized, no central server is required.
      ✓ XMPP provides for the discovery of services residing locally or
        across a network, and the availability information of these
        services.
      ✓ Well‐suited for cloud computing where virtual machines,
        networks, and firewalls would otherwise 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.
Source: “XMPP”, Wikipedia (Online)
                                      Introduction to Internet of Things   14
     Highlights
      ✓ 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
Source: “XMPP”, Wikipedia (Online)
                                     Introduction to Internet of Things   15
Source: “JabberNetwork.svg”, Wikimedia Commons (Online)
                                                          Introduction to Internet of Things   16
Core XMPP Technologies
                   Core
                   • information about the core XMPP technologies for XML streaming
                   Jingle
                   • multimedia signalling for voice, video, file transfer
                   Multi‐user Chat
                   • flexible, multi‐party communication
                   PubSub
                   • alerts and notifications for data syndication
                   BOSH
                   • HTTP binding for XMPP
Source: “XMPP: Technology Overview”, XMPP.org (Online)
                                                         Introduction to Internet of Things   17
Weaknesses
✓ Does not support QoS.
✓ Text based communications induces higher network
  overheads.
✓ Binary data must be first encoded to base64 before
  transmission.
                              Introduction to Internet of Things   18
Applic ations
✓   Publish‐subscribe systems
✓   Signaling for VoIP
✓   Video
✓   File transfer
✓   Gaming
✓   Internet of Things applications
    ▪ Smart grid
    ▪ Social networking services
                                   Introduction to Internet of Things   19
AMQP
 Introduction to Internet of Things   2
     Introduction
      ✓ Advanced Message Queuing Protocol.
      ✓ Open standard for passing business messages between
        applications or organizations.
      ✓ Connects between systems and business processes.
      ✓ It is a binary application layer protocol.
      ✓ Basic unit of data is a frame.
      ✓ ISO standard: ISO/IEC 19464
Source: “Advanced Message Queuing Protocol”, Wikipedia (Online)
                                                                  Introduction to Internet of Things   3
Source: “The‐amqp‐model‐for‐wikipedia.svg”, Wikimedia Commons (Online)
                                                                 Introduction to Internet of Things   4
AMQP Features
Organizations   Technologies                Time                     Space
                        Connects across
                                Introduction to Internet of Things           5
Features
           Security
           Reliability
           Interoperability
           Routing
           Queuing
           Open standard
                              Introduction to Internet of Things   6
     Message Delivery Guarantees
      ✓ At‐most‐once
             ▪ each message is delivered once or never
      ✓ At‐least‐once
             ▪ each message is certain to be delivered, but may do so multiple times
      ✓ Exactly‐once
             ▪ message will always certainly arrive and do so only once
Reference: "OASIS AMQP version 1.0, sections 2.6.12‐2.6.13". OASIS AMQP Technical Committee
                                                                  Introduction to Internet of Things   7
    AMQP Frame Types
       ✓ Nine AMQP frame types are defined that are used to initiate, control and
         tear down the transfer of messages between two peers:
              ▪   Open (connection open)
              ▪   Begin (session open)
              ▪   Attach (initiate new link)
              ▪   Transfer (for sending actual messages)
              ▪   Flow (controls message flow rate)
              ▪   Disposition (Informs the changes in state of transfer)
              ▪   Detach (terminate the link)
              ▪   End (session close)
              ▪   Close (connection close)
Source: O.S. Tezer, “An advanced messaging queuing protocol walkthrough ”, DigitalOcean (Online), 2013
                                                                     Introduction to Internet of Things   8
      Components
                     Exchange                               • Part of Broker
                                                            • Receives messages and routes them to Queues
                         Queue                              • Separate queues for separate business processes
                                                            • Consumers receive messages from queues
                      Bindings                              • Rules for distributing messages (who can access
                                                              what message, destination of the message)
Source: O.S. Tezer, “An advanced messaging queuing protocol walkthrough ”, DigitalOcean (Online), 2013
                                                                     Introduction to Internet of Things         9
      AMQP Exchanges
                                          Direct
                                          Fan‐out
                                          Topic
                                          Header
Source: O.S. Tezer, “An advanced messaging queuing protocol walkthrough ”, DigitalOcean (Online), 2013
                                                                     Introduction to Internet of Things   10
     AMQP Features
       ✓    Targeted QoS (Selectively offering QoS to links)
       ✓    Persistence (Message delivery guarantees)
       ✓    Delivery of messages to multiple consumers
       ✓    Possibility of ensuring multiple consumption
       ✓    Possibility of preventing multiple consumption
       ✓    High speed protocol
Source: O.S. Tezer, “An advanced messaging queuing protocol walkthrough ”, DigitalOcean (Online), 2013
                                                                     Introduction to Internet of Things   11
     Applic ations
       ✓ Monitoring and global update sharing.
       ✓ Connecting different systems and processes to talk to each other.
       ✓ Allowing servers to respond to immediate requests quickly and
         delegate time consuming tasks for later processing.
       ✓ Distributing a message to multiple recipients for consumption.
       ✓ Enabling offline clients to fetch data at a later time.
       ✓ Introducing fully asynchronous functionality for systems.
       ✓ Increasing reliability and uptime of application deployments.
Source: O.S. Tezer, “An advanced messaging queuing protocol walkthrough ”, DigitalOcean (Online), 2013
                                                                     Introduction to Internet of Things   12