Protocols Notes

Protocols

Introduction to Non-IP Based Protocols

  • A personal area network (PAN) is a network that enables communication between devices near a person

  • They can be wired (USB), or wireless (WPAN) (ZigBee, Bluetooth…)

  • Its range is a few meters

Bluetooth Wireless Protocol
  • Bluetooth 5 is revolutionizing IoT.

  • Offers up to 4x the range, 2x the speed, and 8x the broadcasting message capacity.

  • Improved coexistence with other technologies.

  • Bluetooth Low Energy (BLE) is prominent where power consumption is crucial.

  • BLE remains in sleep mode except when a connection is initiated.

  • BLE guarantees about 4/5 years of battery life.

  • Bluetooth 5 increases data transfer bandwidth from 1Mbps to 2Mbps without increased power consumption.

  • Extended range quadruples from 50 meters to 200 meters, providing robust connections.

  • Extended range and higher speed cannot be used simultaneously while maintaining low power consumption.

  • Increased broadcasting message capacity supports larger data packets up to 255 octets.

  • More efficient use of advertising channels.

Protocols Stack
  • Controller

    • Physical Layer (PHY):

      • Handles analog communications.

      • Defines modulation and demodulation of analog signals.

      • Applies source coding to transform signals into digital symbols.

        BLE Radio:

      • Uses the 2.4 GHz ISM band (license-free).

      • Consists of 40 channels: 3 advertising channels and 37 data channels.

      • Each channel is 2 MHz width.

        Advertising Channels

        • There are 4040 RF channels in BLE, each separated by 22 MHz (center-to-center).

        • Three are Primary Advertising Channels.

        • Remaining 3737 channels are used for Data Packet transfer during a Connection.

        • Packets are sent at a fixed interval defined as the Advertising Interval.

    • Link Layer (LL):

      • Interfaces directly with the physical layer (PHY).

      • Implemented as a combination of custom hardware and software.

      • Hardware part includes CRC generation and verification.

      • Manages the link state of the radio (master, slave, advertiser, or scanner).

BLE Operation
  • Five link states:

    • Advertising: Devices transmit advertising packets on advertising channels.

    • Scanning: Devices receive advertising on advertising channels without intending to connect.

      • Active scanning: Link layer listens for advertising PDUs and may request additional information.

      • Passive scanning: Link layer only receives packets; transmission is disabled.

    • Initiating: Devices listen for connectable advertising packets and initiate by sending a connect packet.

    • Connected: Relationship between master (initiator) and slave (advertiser).

    • Standby: Device in the unconnected state.

Bluetooth Low Energy Discovery Process
  • Devices use advertising channels to find each other.

  • One device advertises, and another scans.

  • Each time a device advertises, it transmits the same packet in each of the three advertising channels.

  • This sequence is called an advertising event using ADV_IND Advertising Packets.

Advertising and Scanning
  • Activities occur at regular intervals.

  • Advertisers and Scanners are not synchronized.

  • Discovery takes place when advertising and scanning activities overlap.

BLE States
  • Advertising

  • Scanning

  • Connected

  • To connect two BLE devices:

    • One device advertises.

    • The other scans for it and initiates the connection.

  • Advertising involves broadcasting packets, allowing another scanning device to discover them.

Wireless Coexistence
  • Improvement in coexistence is with other nearby BLE devices.

  • The random frequency-hopping scheme decreases the chance of neighboring BLE devices transmitting on the same radio-frequency (RF) channel simultaneously.

  • Bluetooth 5 allows a user to control multi-devices from Bluetooth-equipped smartphones, headphones, etc.

Bluetooth Hopping
  • Utilizes frequency-hopping spread spectrum technology to avoid interference.

  • Signal switches carrier channels rapidly, at a rate of 16001600 hops per second.

  • Reduces the possibility of interference.

Zigbee
  • Wireless technology standard defining communication protocols for short-range communications.

  • Designed for control and sensor networks.

  • Low-cost implementation of low power devices with low data rate for short-range wireless communications.

  • Operates in unlicensed bands including 2.42.4 GHz, 900900 MHz and 868868 MHz.

Zigbee Applications
  • Home automation: Controller with a software application controls smart devices through a central hub.

  • Medical data collection

  • Industrial control systems

Home Automation
  • Perform control tasks inside a building.

Zigbee Components
  • Zigbee Coordinator (ZC)

    • Highly capable device used to form and initiate network functions.

    • Each network has a single ZC.

    • Responsible for forming the network by selecting the appropriate channel and security mode.

    • Trust center authenticates new nodes and distributes network keys.

    • After network formation, can behave as a ZR.

  • Zigbee Router (ZR)

    • Responsible for routing traffic between nodes.

    • May not sleep and thus, is not suitable for battery-operated devices.

    • Receives and stores messages intended for their children.

    • Gatekeepers responsible for allowing new nodes to join the network.

  • Zigbee End Device (ZED)

    • Simple endpoint device (e.g., light switch).

    • Communicates with the coordinator but has no routing logic.

    • Relays messages that are not targeted to it.

Channel Access
  • Coordinator assigns one channel to the network for all devices to share.

  • Channel access methods:

    • Contention-free method: Coordinator dedicates a specific time slot (GTS) to each device.

    • Contention-based method: Devices do not need to be synchronized.

      • CSMA (collision avoidance mechanism) is used.

      • Device goes into receive mode and detects if there's any signal in the channel.

      • Transmits data only if the channel is clear; otherwise, backs off for a random time and tries again.

Zigbee Topologies
  • Star Topology

    • Simplest/less expensive.

    • No routers.

    • End devices cannot communicate directly.

  • Mesh Topology

    • Every node (except end devices) is connected with the neighboring node.

    • Message hops from one device to another.

    • If a node fails, data can be re-routed using another path.

  • Tree Topology

    • Not very different from a mesh configuration.

    • Routers are not interconnected.

Zigbee Characteristics
  • Intended for low power consumption applications that do not require large data transfer speeds.

  • Common applications: home automation, wireless network sensors, smoke or motion sensors, medical data collection, and industrial control systems.

  • Features:

    • Devices do not connect individually to the Internet.

    • Offers low energy consumption.

    • Range: Up to 75-100 meters indoor and up to 300+ meters (line of sight).

    • Very low data transfer speeds: 250250 kbit/s.

    • Network join time: ~3030 msec (Wifi: up to 33 s, Bluetooth up to 1010 s).

    • Number of devices: Up to 6500065000 in theory / 240240 in practice.

    • Low cost products and cheap implementation.

    • AES cryptographic algorithm.

RF Bands
  • Three different bands assigned to Zigbee:

    • Europe: 868868 MHz

    • US/Australia: 915915 MHz

    • Across the World: 2.42.4 GHz

  • Only one channel is selected for use in a network.

Zigbee Benefits
  • Self-forming: Zigbee network can configure itself automatically.

  • Self-healing: Zigbee can reconfigure itself dynamically if nodes become faulty, removed, or disabled.

  • Interoperability: Zigbee modules from different manufacturers can operate together.

Z-Wave
  • Alternative to WiFi or Bluetooth.

  • Functions as a mesh network system.

  • Zigbee is an open protocol managed by the Zigbee Alliance, while Z-Wave is private.

  • Being closed guarantees that all compatible devices function without any problem between them.

  • Z-Wave has a greater range than Zigbee (up to 100100m) and usually offers greater stability in connections.

  • Zigbee supports more connected devices (6500065000 compared to just over 200200).

  • Z-Wave requires a hub or bridge to connect and manage IoT devices.

  • Zigbee uses the 2.42.4GHz frequency, so it has no problem to be used in any country.

  • Z-Wave uses different radio frequencies in different countries, which means we cannot use them in countries where different frequencies are used.

  • Features:

    • Requires the use of a bridge or hub device.

    • Mesh network system.

    • Devices do not connect individually to the Internet.

    • Offers low energy consumption.

    • Maximum reach 100100m.

    • Very low data transfer speeds, maximum speed of 100100 kbit/s.

    • Mainly for home use, control of household items, sensors, electronic security elements.

    • It is a closed protocol.

Introduction to IP Based Protocols

Why IP-Based Protocols?
  • Use of existing infrastructure.

  • IP-based networks can readily be connected to other IP-based networks without the need for gateways.

6LOWPAN
  • Combines the latest version of the Internet Protocol (IPv6) and Low-power Wireless Personal Area Networks (LOWPAN).

  • Allows for the smallest devices with limited processing ability to transmit information wirelessly using an internet protocol.

  • Newest competitor to ZigBee.

  • IPV6 provides significant theoretical addressability of 21282^{128} or 3.4x10383.4x10^{38} unique addresses.

  • Well-suited for IoT growth.

  • Acronym: IPv6 over Low-Power Wireless PAN.

  • Networking technology or adaptation layer allowing to transport IPv6 packets over small link layer frames, such as those defined by 802.15.4.

  • More suitable for high density.

  • No Intermediate gateway.

6LOWPAN Topology
  • Mesh networks residing on the periphery of larger networks.

  • Flexible topologies allowing for ad hoc and disjointed networks without any binding to the internet.

  • Ad-hoc networks can form without requiring Internet connectivity of an edge router.

  • An edge router (also known as border router) is necessary as it has four functions:

    • Handles communication to the 6LOWPAN devices and relays data to the internet.

    • Performs compression of IPv6 headers by reducing a 40-byte IPv6 header and 8-byte UDP headers.

    • A typical 40-byte IPv6 header can compress to two to 20-bytes depending on usage.

    • Initiates the 6LoWPAN network.

    • Exchanges data between devices on the 6LoWPAN network.

Thread
  • Relatively new networking protocol for IoT based on IPV6 (6LOWPAN).

  • Principal target is home connectivity and home automation.

  • Launched in July of 2014 with the formation of the Thread Group Alliance.

  • Based on the IEEE 802.15.4 protocol and 6LOWPAN.

  • Commonality with Zigbee and other 802.15.4 variants, but Thread is IP addressable.

  • Builds on the data and physical layers provided by 802.15.4.

  • Mesh-based, making it attractive for home lighting systems with up to 250 devices in a single mesh.

  • By enabling IP addressability in the smallest of sensors and home automation systems, one can reduce power.

  • Edge router hosting a Thread mesh network doesn't need to process application layer protocols.

  • IPV6 compliant, and inherently secure with all communications being encrypted using the Advanced Encryption Standard (AES).

  • Up to 250 nodes can exist on a Thread mesh all with fully encrypted transport and authentication.

  • A software upgrade allows a pre-existing 802.15.4 device to be Thread compatible.

IEEE 802.11
  • Standard, popularly known as WiFi, lays down the architecture and specifications of wireless LANS (WLANS).

  • WiFi or WLAN uses high-frequency radio waves instead of cables for connecting the devices in LAN.

  • Users connected by WLANS can move around within the area of network coverage.

Architectures
  • Basic Service Set

  • Independent Basic Service Set

  • Distribution System

Topologies
  • Infrastructure

    • Station (STA) communicates with a central access point (AP).

    • AP can be a gateway to other networks (WAN), a router, or a true access point in a larger network.

    • Known as Infrastructure Basic Set Service (BSS).

    • This is a star topology.

  • Ad hoc

    • Nodes can form an Independent Basic Set Service (IBSS) where each station communicates and manages the interface to other stations.

    • No access point or a star topology is used in this configuration.

    • This is a peer-to-peer type of topology.

  • Distribution system (DS)

    • Combines two or more independent BSS networks through access point interconnects.

Long-Range Protocols

5G
  • 5th generation of mobile networks, a significant evolution of today's 4G LTE networks.

  • Designed to meet the very large growth in data and connectivity of today's modern society and the Internet of Things.

  • Will initially operate in conjunction with existing 4G networks before evolving to fully standalone networks.

  • Initial 5G services commenced in many countries in 2019, and widespread availability is expected by 2025.

  • Advantage of 5G is the fast response time referred to as latency.

  • Latency is the time taken for devices to respond to each other over the wireless network.

  • 3G networks had a typical response time of 100100 milliseconds, 4G is around 3030 milliseconds, and 5G will be as low as 11 millisecond.

  • 5G delivers continuous connection, greater capacity, and faster speed and response times through:

    • Better Connection

      • Designed to work in conjunction with 4G networks using a range of macro cells, small cells, and dedicated in-building systems.

      • Small cells are mini base stations designed for very localized coverage (typically from 10 meters to a few hundred meters).

      • Essential for the 5G networks as the mmWave frequencies have a very short connection range.

    • Increased Spectrum

      • Initial frequency bands are below 6 GHz (often in the 3.3-3.8 GHz bands).

      • Additional mobile spectrum above 6 GHz, including the 262826-28 GHz bands (mmWave), provides significantly more capacity.

    • Massive MIMO

      • Multiple element base station for greater capacity, multiple users, faster data.

      • Uses 'massive' MIMO (multiple input, multiple output) antennas that have very large numbers of antenna elements or connections.

      • More people can simultaneously connect to the network and maintain high throughput.

      • The overall physical size of the 5G massive MIMO antennas will be similar to 4G.

MQTT Protocol

  • The Message Queuing Telemetry Transport (MQTT) is a lightweight, publish-subscribe network protocol that transports messages between devices.

  • Simple messaging protocol designed for constrained devices with low-bandwidth.

  • Allows you to send commands to control outputs, read and publish data from sensor nodes, and much more.

MQTT Advantages
  • Distribute information more efficiently.

  • Increase scalability.

  • Reduce network bandwidth consumption dramatically.

  • Reduce update rates to seconds.

  • Very well-suited for remote sensing and control.

  • Maximize available bandwidth.

MQTT Broker
  • Software primarily responsible for receiving all messages, filtering the messages, deciding who is interested in them, and then publishing the message to all subscribed clients.

  • Software that could be installed on computers, servers, or others.

MQTT Broker Benefits
  • Eliminate insecure Connections

  • Easily scales (from few devices to thounsands)

  • Manages the clients easily

  • It is like a post-office, instead of sending messages peer to peer, all messages are sent/ received by the broker.

  • Publish/Subscribe Models

    • ONE TO MANY: Several clients subscribe to the same topic.

    • MANY TO ONE: Several clients publish over the same topic, but only one subscriber.

  • MQTT is a bidirectional messaging protocol, due to the broker role.

  • All devices in MQTT architecture are less coupled and more secured.

  • The broker is the central location for security.

    • TLS Encryption

    • Username/password

    • Each client is unaware of other clients

  • Automatic redundant Backup broker

  • All MQTT implementations have their clients published data only when there is change in value.

  • New subscribers got the last data published. So the broker retains the last value published about a topic.

  • The broker keeps track of all sessions. So if a device looses the connection temporarily, it can easily reconnect with the broker without having to resubscribe to topics.

  • The broker handles 3 types of messages:

    • Birth

    • Death

    • Last Will and Testament ( when something is wrong with a connection)