Skip to content
BCA-306N · Internet of Things
Unit 2

Engineering for IoT Networks and Protocols

Sign in to save
Unit 2 Learning Hub

Engineering for IoT Networks and Protocols

1. Executive Summary & Syllabus Blueprint

1. Executive Summary & Syllabus Blueprint

IoT systems operate under severe resource constraints: battery limitations, low clock speeds, small memory buffers, and lossy wireless links (LLNs). Traditional Internet protocols (IPv4, TCP, HTTP) are too verbose and computationally expensive. This unit covers the optimized IoT communication stack: the IEEE 802.15.4 physical and MAC foundation, 6LoWPAN header compression, Low-Power Wide Area Networks (LoRaWAN, Sigfox), short-range wireless meshes (Zigbee, BLE), and application-layer protocols designed specifically for constrained devices (MQTT, CoAP).

✓Topic 1 covered: 1. Executive Summary & Syllabus Blueprint
Next: 2. Comprehensive Core Theoretical Architecture & In-Depth Concept Decomposition↓

2. Comprehensive Core Theoretical Architecture & In-Depth Concept Decomposition

2. Comprehensive Core Theoretical Architecture & In-Depth Concept Decomposition

2.1 The IoT Protocol Stack vs Traditional OSI / TCP-IP

System Architecture / Concept DiagramHorizontal Scroll Enabled
  OSI Layer           Traditional Internet             IoT Protocol Stack
+---------------+   +-----------------------+       +-----------------------+
|  Application  |   | HTTP, FTP, SMTP       |  -->  | MQTT, CoAP, DDS       |
+---------------+   +-----------------------+       +-----------------------+
|  Transport    |   | TCP (Heavy Handshake) |  -->  | UDP (Lightweight), TCP|
+---------------+   +-----------------------+       +-----------------------+
|  Network      |   | IPv4 / Standard IPv6  |  -->  | 6LoWPAN / RPL / IPv6  |
+---------------+   +-----------------------+       +-----------------------+
|  Data Link    |   | 802.3 Ethernet, 802.11|  -->  | 802.15.4 MAC, BLE MAC |
+---------------+   +-----------------------+       +-----------------------+
|  Physical     |   | Copper, Fiber, 802.11 |  -->  | 802.15.4 RF, LoRa, BLE|
+---------------+   +-----------------------+       +-----------------------+

2.2 IEEE 802.15.4 Standard (Physical and MAC Layers)

  • Scope: Specifies Physical (PHY) and Media Access Control (MAC) layers for Low-Rate Wireless Personal Area Networks (LR-WPANs).
  • Frequency Bands & Data Rates:
  • 2.4 GHz ISM Band: 16 channels, 250 kbps data rate, O-QPSK modulation (worldwide).
  • 868 MHz Band: 1 channel, 20 kbps data rate, BPSK modulation (Europe).
  • 915 MHz Band: 10 channels, 40 kbps data rate, BPSK modulation (North America).
  • Device Classes:
  • Full-Function Device (FFD): Can act as a PAN Coordinator, coordinator, or simple end-device. Implements complete MAC services and maintains routing tables.
  • Reduced-Function Device (RFD): Extremely simple node; communicates only with an FFD; never routes traffic; can sleep 99% of the time.
  • Topologies: Star topology (all devices talk to PAN Coordinator) and Peer-to-Peer / Mesh topology.
  • Frame Structure: Maximum Transmission Unit (MTU) of physical layer is strictly 127 bytes (yielding a maximum MAC payload of 102-118 bytes).

2.3 6LoWPAN (IPv6 over Low-Power Wireless Personal Area Networks)

  • Problem Statement: Standard IPv6 requires a minimum MTU of 1280 bytes (RFC 2460). IEEE 802.15.4 frames only carry a maximum payload of 127 bytes.
  • Solution (RFC 4944 & RFC 6282): An intermediate Adaptation Layer situated between the 802.15.4 MAC layer and the IPv6 Network layer.
System Architecture / Concept DiagramHorizontal Scroll Enabled
+--------------------------------------------------------+
|                IPv6 Network Layer                      |
+--------------------------------------------------------+
|   6LoWPAN ADAPTATION LAYER                             |
|   - Stateless & Stateful Header Compression (IPHC)    |
|   - Packet Fragmentation and Reassembly                |
|   - Mesh Routing (Mesh Under vs Route Over)           |
+--------------------------------------------------------+
|                IEEE 802.15.4 MAC Layer                 |
+--------------------------------------------------------+
  • Key Functions of 6LoWPAN:
  1. Header Compression: Standard IPv6 (40 bytes) + UDP (8 bytes) = 48 bytes of header. 6LoWPAN compresses this down to 6 bytes (or even 3 bytes when link-layer addresses are derived from MAC IEEE 64-bit addresses).
  2. Fragmentation & Reassembly: If an IPv6 datagram exceeds the 127-byte frame, 6LoWPAN divides it into fragments. A 4-byte First Fragment (FRAG1) header or 5-byte Subsequent Fragment (FRAGN) header tracks datagram size and offset.
  3. Mesh Under vs Route Over:
  • Mesh-Under: 6LoWPAN layer routes packets using link-layer addresses before presenting a reassembled packet to the IP layer.
  • Route-Over: Routing occurs at the IP network layer (using RPL protocol); each intermediate hop reassembles and re-fragments the packet.

2.4 Low-Power Wide Area Networks (LPWAN): LoRa and LoRaWAN

  • LoRa (Physical Layer):
  • Proprietary Chirp Spread Spectrum (CSS) modulation technology owned by Semtech.
  • Transmits data on continuously varying chirp frequencies, achieving outstanding resistance to multipath fading and Doppler shifts.
  • Operates on Sub-GHz license-free ISM bands: 868 MHz (Europe), 915 MHz (USA), 433 MHz / 865-867 MHz (India).
  • Spreading Factor (SF): Ratio between chip rate and symbol rate (SF7 to SF12). Higher SF increases transmission range and receiver sensitivity (up to -148 dBm) at the expense of lower data rates (0.3-50 kbps) and higher airtime.
  • LoRaWAN (MAC & Network Architecture):
  • Open MAC protocol standardized by the LoRa Alliance.
  • Star-of-Stars topology: End Nodes -> Gateways (Packet Forwarders) -> Network Server -> Application Server.
  • Device Classes:
  • Class A (All Devices): Bi-directional communication. Downlink transmission possible only immediately following an uplink transmission (2 short receive windows, RX1 and RX2). Lowest power consumption.
  • Class B (Beacon): Opens scheduled downlink receive windows synchronized by periodic gateway beacons. Moderate power.
  • Class C (Continuous): Receiver is continuously listening except when transmitting. Lowest downlink latency, but requires continuous mains power.

2.5 Constrained Application Protocols: MQTT vs CoAP

System Architecture / Concept DiagramHorizontal Scroll Enabled
+------------------------------------------------------------------------+
| CRITERIA           | MQTT (ISO/IEC 20922)       | CoAP (RFC 7252)      |
+------------------------------------------------------------------------+
| Architecture       | Publish / Subscribe        | Request / Response   |
| Central Entity     | Centralized Broker         | Direct Client-Server |
| Transport Layer    | TCP (Port 1883 / 8883 TLS) | UDP (Port 5683 / 5684|
| Header Overhead    | 2-byte fixed header        | 4-byte fixed header  |
| Payload Format     | Binary agnostic (JSON, raw)| Binary agnostic/CBOR |
| QoS Levels         | QoS 0, QoS 1, QoS 2        | Confirmable (CON) /  |
|                    |                            | Non-Confirmable(NON) |
| Communication Mode | Asynchronous Many-to-Many  | Synchronous / Async  |
| Caching Support    | Retained messages only     | Full HTTP-like cache |
| REST Integration   | Requires custom translation| Native URI mapping   |
+------------------------------------------------------------------------+
✓Topic 2 covered: 2. Comprehensive Core Theoretical Architecture & In-Depth Concept Decomposition
Next: 3. Section A: Short Answer Question Bank (10 Questions x 2 Marks)↓

3. Section A: Short Answer Question Bank (10 Questions x 2 Marks)

3. Section A: Short Answer Question Bank (10 Questions x 2 Marks)

What is the maximum physical frame size in IEEE 802.15.4

Ans. The maximum physical frame size (Physical Layer Service Data Unit - PSDU) in IEEE 802.15.4 is strictly 127 bytes. After subtracting the MAC header and security overhead, the maximum available payload for upper layers is between 102 and 118 bytes.

Why is traditional IPv6 unable to run directly over IEEE 802.15.4 without 6LoWPAN

Ans. Standard IPv6 specification (RFC 2460) mandates a minimum link Maximum Transmission Unit (MTU) of 1280 bytes, whereas IEEE 802.15.4 frames can carry at most 127 bytes. 6LoWPAN bridges this incompatibility via an adaptation layer providing header compression and packet fragmentation/reassembly.

The three Quality of Service (QoS) levels in MQTT

Ans.

  1. QoS 0 (At most once): Best-effort delivery; message sent without acknowledgment (fire and forget).
  2. QoS 1 (At least once): Guarantees delivery via PUBACK; message may be duplicated if ack is delayed.
  3. QoS 2 (Exactly once): Four-step handshake (PUBLISH -> PUBREC -> PUBREL -> PUBCOMP) ensuring no duplicates.

Confirmable (CON) and Non-Confirmable (NON) messages in CoAP

Ans. A Confirmable (CON) message requires an explicit Acknowledgment (ACK) from the receiver; if no ACK is received within a timeout, the message is retransmitted using exponential backoff. A Non-Confirmable (NON) message is sent without requiring an acknowledgment (used for frequent, non-critical sensor broadcasts).

What is a Spreading Factor (SF) in LoRa modulation

Ans. The Spreading Factor (ranging from SF7 to SF12) represents the number of chirps used to encode each symbol (2^SF chips per symbol). A higher SF increases receiver sensitivity and transmission distance, but decreases the bit rate and increases channel airtime and battery usage.

Zigbee Coordinator (ZC), Zigbee Router (ZR), and Zigbee End Device (ZED)

Ans.

  • ZC (Coordinator): Exactly one per network; initiates network formation, stores security keys, and manages routing.
  • ZR (Router): Mains-powered node that forwards data packets across the mesh.
  • ZED (End Device): Battery-powered sensor node; communicates only with its parent router/coordinator and sleeps to conserve energy.

The role of the 6LoWPAN Header Compression (IPHC)

Ans. 6LoWPAN IPHC (RFC 6282) compresses the standard 40-byte IPv6 header down to as few as 2 bytes by eliding redundant fields, omitting version/traffic class, and inferring IPv6 source and destination addresses directly from the underlying IEEE 802.15.4 64-bit MAC addresses.

What is the function of the MQTT Keep-Alive and PINGREQ mechanism

Ans. The Keep-Alive timer (defined during connection) is the maximum time interval allowed between client transmissions. If no application messages are published, the client sends a 2-byte PINGREQ frame to the broker, which replies with PINGRESP. If the broker receives nothing within 1.5 * Keep-Alive, it closes the TCP socket and triggers the client's Last Will and Testament (LWT).

The difference between LoRa and LoRaWAN

Ans. LoRa is the proprietary physical-layer radio frequency modulation (Chirp Spread Spectrum) developed by Semtech. LoRaWAN is the open, upper-layer Media Access Control (MAC) and network protocol standard developed by the LoRa Alliance that governs device addressing, encryption, frequency hopping, and cloud architecture.

What is BLE Advertising and Connection Interval

Ans. In Bluetooth Low Energy, a peripheral broadcasts short discovery packets across 3 dedicated advertising channels (Channels 37, 38, and 39) at set Advertising Intervals. Once connected, data is transferred at set Connection Intervals (7.5 ms to 4.0 s); between these events, both radios enter deep sleep.

✓Topic 3 covered: 3. Section A: Short Answer Question Bank (10 Questions x 2 Marks)
Next: 4. Section B: Analytical, Derivational & Procedural Question Bank (5 Questions x 5 Marks)↓

4. Section B: Analytical, Derivational & Procedural Question Bank (5 Questions x 5 Marks)

4. Section B: Analytical, Derivational & Procedural Question Bank (5 Questions x 5 Marks)

Analyze the header compression mechanism of 6LoWPAN from standard IPv6/UDP down to constrained frame formats

Ans.

  • Baseline Overhead:
  • Standard IPv6 Base Header = 40 bytes.
  • Standard User Datagram Protocol (UDP) Header = 8 bytes.
  • Total Uncompressed Network + Transport Header = 48 bytes.
  • When placed inside an 802.15.4 frame (127 bytes total - 25 bytes MAC overhead = 102 bytes payload), uncompressed headers consume nearly 50% of the payload capacity.
  • 6LoWPAN IPHC Header Compression Breakdown (RFC 6282):
System Architecture / Concept DiagramHorizontal Scroll Enabled
+-----------------------------------------------------------------------+
| Field in Standard IPv6  | Compression Technique in 6LoWPAN IPHC       |
+-----------------------------------------------------------------------+
| Version (4 bits)        | Completely elided (Always IPv6, binary 0110)|
| Traffic Class & Flow Lbl| Elided if zero (common in sensor traffic)   |
| Payload Length (16 bits)| Elided (Computed directly from MAC frame)   |
| Next Header (8 bits)    | Replaced with 1-bit dispatch flag           |
| Hop Limit (8 bits)      | Compressed to 2 bits (1, 64, 255, or inline)|
| Source Address (128 b)  | Derived from 802.15.4 64-bit link MAC address|
| Dest Address (128 b)    | Derived from 802.15.4 64-bit link MAC address|
+-----------------------------------------------------------------------+
  • Compressed Result: The 40-byte IPv6 header compresses to 2 bytes. The 8-byte UDP header compresses to 4 bytes (ports compressed to 4 bits each). Thus, total header overhead drops from 48 bytes to 6 bytes, restoring payload efficiency to >94%.
✓Topic 4 covered: 4. Section B: Analytical, Derivational & Procedural Question Bank (5 Questions x 5 Marks)
Next: 5. Section C: Comprehensive Long Answer Question Bank (3 Questions x 10-15 Marks)↓

5. Section C: Comprehensive Long Answer Question Bank (3 Questions x 10-15 Marks)

5. Section C: Comprehensive Long Answer Question Bank (3 Questions x 10-15 Marks)

Provide an exhaustive architectural exposition of the 6LoWPAN protocol suite. Detail header compression (RFC 4944 vs RFC 6282), packet fragmentation algorithms, and routing strategies (Mesh-Under vs Route-Over)

Ans.

Internet Protocol version 6 (IPv6) provides a 2^128 address space, ensuring every sensor in the world can possess a globally routable IP. However, running IPv6 over IEEE 802.15.4 introduces critical challenges:

  • 802.15.4 frame capacity is 127 bytes.
  • Standard 802.15.4 MAC header + AES-CCM security consumes 25 to 33 bytes, leaving ~94 bytes.
  • Uncompressed IPv6 header (40 bytes) + UDP header (8 bytes) consumes 48 bytes, leaving only 46 bytes for actual sensor data.
  • RFC 2460 mandates that every IPv6 link must support an MTU of at least 1280 bytes.

2. The 6LoWPAN Adaptation Layer Architecture

6LoWPAN sits between the Data Link and Network layers:

System Architecture / Concept DiagramHorizontal Scroll Enabled
           +-----------------------------------------------+
           |               Application Layer               |
           +-----------------------------------------------+
           |         Transport Layer (UDP / TCP)           |
           +-----------------------------------------------+
           |           Network Layer (IPv6 / RPL)          |
           +-----------------------------------------------+
================== 6LoWPAN ADAPTATION LAYER =================
|  [ RFC 6282 Header Compression ]                         |
|  [ RFC 4944 Fragmentation & Reassembly ]                  |
|  [ Mesh Addressing & Link-Layer Forwarding ]             |
=============================================================
           |             IEEE 802.15.4 MAC Layer           |
           +-----------------------------------------------+
           |             IEEE 802.15.4 PHY Layer           |
           +-----------------------------------------------+

3. Header Compression Evolution: RFC 4944 (LOWPANHC1) vs RFC 6282 (LOWPANIPHC)

  • RFC 4944 (HC1): Compressed IPv6 headers to 2 or 3 bytes, but only worked if IPv6 addresses matched link-local prefixes (FE80::/64). It could not compress global unicast addresses.
  • RFC 6282 (IPHC - State-of-the-Art): Introduces context-based address compression for both link-local and global unicast addresses. When source and destination use global prefixes registered in a shared 6LoWPAN context table, and addresses are derived from 802.15.4 MAC addresses, the entire 40-byte IPv6 header shrinks to 2 bytes.

4. Fragmentation and Reassembly Algorithm

When an IPv6 packet exceeds 127 bytes, the 6LoWPAN layer breaks it into fragments using FRAG1 (4 bytes) and FRAGN (5 bytes) headers. A 16-bit datagram_tag correlates fragments until the full datagram is reassembled at the destination.

Provide an architectural breakdown of the MQTT protocol specification (ISO/IEC 20922). Explain the binary packet structure, QoS handshakes, session state maintenance

Ans.

1. Binary Packet Architecture

An MQTT control packet consists of a 2-byte fixed header, an optional variable header, and an optional payload. The first byte encodes Packet Type (1=CONNECT, 3=PUBLISH, etc.), DUP flag, QoS level (0, 1, or 2), and RETAIN flag. The second byte uses variable-length encoding for remaining length.

2. Detailed QoS Handshake Mechanisms

  • QoS 0 (At Most Once): Fire and forget. No acknowledgment.
  • QoS 1 (At Least Once): Sender transmits PUBLISH with Packet ID. Receiver acknowledges with PUBACK. Retransmitted if unacknowledged.
  • QoS 2 (Exactly Once): Four-step handshake: PUBLISH -> PUBREC -> PUBREL -> PUBCOMP. Guaranteed zero duplicates.

3. Session State Maintenance

When CleanSession is false, the broker maintains client subscriptions, unacknowledged messages, and queues incoming messages while the client is disconnected. If a client disconnects abnormally, the broker broadcasts its Last Will and Testament (LWT) payload to a designated topic.

Provide a comprehensive architectural evaluation of LoRa and LoRaWAN. Differentiate between Class A, Class B, and Class C device profiles, derive the Time-on-Air (ToA) equation, and explain Adaptive Data Rate (ADR)

Ans.

1. LoRa Physical Layer Modulation

LoRa uses Chirp Spread Spectrum (CSS) modulation, shifting carrier frequency linearly across bandwidth BW over duration Ts = (2^SF) / BW, creating up-chirps and down-chirps. Spreading Factors range from SF7 to SF12. Higher SF values trade transmission speed for extraordinary range and sensitivity (down to -148 dBm).

2. LoRaWAN Device Classes Comparison

  • Class A: Battery life up to 10 years. Downlink only occurs during two short receive windows (RX1, RX2) immediately following an uplink transmission.
  • Class B: Periodic beacon-synchronized ping slots for predictable downlink latency.
  • Class C: Continuous receive listening. Requires continuous mains power; offers instantaneous downlink capability.

3. Adaptive Data Rate (ADR)

The Network Server monitors SNR across the last 20 frames from a node. If link quality is strong, it sends LinkADRReq to command the node to decrease its Spreading Factor (e.g. from SF12 to SF7) and reduce transmission power, optimizing airtime and quadrupling battery life.

✓Topic 5 covered: 5. Section C: Comprehensive Long Answer Question Bank (3 Questions x 10-15 Marks)
Next: 6. High-Yield Exam Revision Matrix & Architectural Cheat Sheet↓

6. High-Yield Exam Revision Matrix & Architectural Cheat Sheet

6. High-Yield Exam Revision Matrix & Architectural Cheat Sheet

Standard / ProtocolLayerKey Attribute / FormulaHigh-Yield Exam Takeaway
IEEE 802.15.4PHY / MAC2.4 GHz, 250 kbps, Max 127B frameBaseline standard for low-rate wireless personal area networks (Zigbee/6LoWPAN).
6LoWPANAdaptationIPHC Header Compression (RFC 6282)Compresses 48B IPv6/UDP header down to 6B; provides MTU fragmentation.
MQTTApplicationTCP Port 1883/8883, 2B headerPub-Sub model with Broker; QoS 0, 1, 2; LWT ensures offline detection.
CoAPApplicationUDP Port 5683/5684, 4B headerRESTful Request-Response over UDP; native URI mapping to HTTP; CON/NON reliability.
LoRa ModulationPhysicalChirp Spread Spectrum (CSS)Long range (up to 15 km), deep penetration, trade-off between SF and Time-on-Air.
LoRaWAN Class AMAC2 Downlink RX windows post-uplinkLowest power consumption profile; 10+ year battery operation on coin cells.
LoRaWAN Class CMACContinuous RX listeningLowest latency downlink; requires continuous external mains power.
BLE GATTApplicationProfile -> Service -> CharacteristicHierarchical attribute structure using 16/128-bit UUIDs over short-range links.
Adaptive Data RateMAC (LoRaWAN)Dynamic SF and Tx power scalingNetwork Server commands nodes with strong link budgets to switch to lower SFs.
Practice Ready

Ready to practice Unit 2?

You've read the core concepts. Take the balanced 10-question practice set to test your mastery!

Save progress