←Back to Subject
Notes
Notes
Study material and explanations
Diagrams
Diagrams
Visualize concepts easily
Mnemonics
Mnemonics
Tricks to remember faster
One Night Prep
One Night Prep
Short and focused revision
Revision
Revision
Quick summary and key points
Important Questions
Important Questions
Practice most relevant questions
Revision

Internet of Things · Unit 3 Revision

Quick summary and key points for Unit 3

Design Principles for Web Connectivity in IoT Systems

Overview: For a connected weather station, DNS helps locate the server, a transport carries the bytes and HTTP defines the request.

Introduction: Why Regular Web Protocols Struggle in IoT

  • The World Wide Web was built using protocols like HTTP (Hypertext Transfer Protocol), which were made for desktop computers and smartphones…
  • A temperature or soil sensor has only a few kilobytes of RAM and runs on a tiny ₹20 coin-cell battery that is expected to last for…
  • It transmits data over low-power wireless links where bandwidth is low and signal drops are common.

Core Design Principles for IoT Web Connectivity

  • Identify the resource, message format and way a device will reach the service.
  • 1. Minimal Packet Overhead Headers must be short binary numbers (2 to 4 bytes) instead of long text lines.
  • 2. Asynchronous Communication Devices should send data and immediately continue their work without waiting synchronously for replies.
  • 3. Deep Sleep Support Sensors must be able to sleep for hours, wake up for 10 milliseconds to transmit, and return to sleep.
  • 4. Tolerance to Lossy Networks Must handle dropped packets smoothly without slow, energy-draining TCP connection handshakes.

View diagram · The Four Pillars of IoT Web Connectivity Design

Why Standard HTTP is Inefficient for Low-Power IoT

  • Standard web communication uses the Client-Server Request-Response model running over HTTP/1.1 or HTTP/2:
  • Three Big Problems with Standard HTTP in IoT: Huge Header Overhead:
  • A standard HTTP request contains long lines of text headers: User-Agent, Host, Accept, Cookie, Content-Type.
  • These headers easily take up 500 to 1,000 bytes!
  • If an agricultural sensor only wants to send a 2-byte temperature reading ("32"), sending 800 bytes of headers means **over 99% of…
  • Heavy TCP Connection Setup:
  • HTTP requires an underlying TCP connection.
  • Starting a connection requires a 3-way handshake (SYN, SYN-ACK, ACK), and closing it requires another 4 packets.

Web Communication Protocols for Connected Devices

  • To solve these problems, two classes of web connectivity protocols are used in IoT:
  • 1. Standard Web Protocols (HTTP / REST) Used for powered devices (Smart TVs, gateways, Raspberry Pi) that have continuous wall power and fast Wi-Fi.
  • 2. Constrained Protocols (CoAP) A binary web protocol designed for tiny battery microcontrollers; uses REST commands (GET/POST) over lightweight UDP.
  • CoAP (Constrained Application Protocol): Brings the simplicity of web REST APIs (GET, POST, PUT, DELETE) down to small 8-bit microcontrollers using compact binary…
  • JSON (JavaScript Object Notation): Has replaced heavy XML as the standard lightweight data format for IoT because it is simple to read and uses much less text.

View diagram · Classes of IoT Web Connectivity Protocols

IoT Message Communication Protocols: MQTT, CoAP, AMQP, and XMPP

Overview: MQTT lets sensors publish to a broker and dashboards subscribe.

Introduction: Why Do We Need Special Protocols for IoT?

  • Normal computer protocols like standard HTTP are heavy and send hundreds of bytes of header text with every single message.
  • MQTT (Message Queuing Telemetry Transport)
  • CoAP (Constrained Application Protocol)
  • AMQP (Advanced Message Queuing Protocol)
  • XMPP (Extensible Messaging and Presence Protocol)

MQTT (Message Queuing Telemetry Transport)

  • MQTT was created by IBM in 1999 to monitor oil pipelines over slow satellite links.
  • Key Characteristics of MQTT: Architecture: Uses the Publish - Subscribe model centered around an MQTT Broker (e.g.
  • Transport Layer: Runs on top of TCP (port 1883, or port 8883 for secure TLS encryption).
  • Tiny Header: The base header size is only 2 bytes!
  • Topic Hierarchy: Topics use slashes like website URLs (e.g., home/bedroom/fan).
  • Single-level wildcard (+): home/+/fan (matches the fan in any room).
  • Multi-level wildcard (#): home/# (receives all messages from the entire house).
  • The Three Quality of Service (QoS) Levels in MQTT: MQTT lets you choose how reliably a message must be delivered:

View diagram · MQTT Publish-Subscribe Architecture

CoAP (Constrained Application Protocol)

  • While MQTT uses Publish-Subscribe over TCP, CoAP brings the simplicity of Web REST APIs (GET, POST, PUT, DELETE) to tiny, low-power…
  • Key Characteristics of CoAP: Standardized by: IETF (RFC 7252).
  • Transport Layer: Runs over UDP (port 5683), which avoids the slow connection setup of TCP.
  • Header Size: Fixed binary header of only 4 bytes!
  • Architecture: Client-Server Request-Response model (just like HTTP, but formatted in binary numbers instead of heavy text).
  • CoAP Message Types: Confirmable (CON): Important message that requires an immediate acknowledgment (ACK) from the receiver.
  • Non-Confirmable (NON): Sent without asking for any ACK.
  • Acknowledgment (ACK): The confirmation packet returned to acknowledge a CON message.

AMQP (Advanced Message Queuing Protocol)

  • An enterprise-level messaging protocol designed for high-reliability systems like banking and logistics.
  • Core Architecture: Built around Exchanges, Bindings, and Message Queues.
  • Pros: Strong security, reliable delivery, and guaranteed message ordering.
  • Drawback in IoT: Headers are much larger and heavier than MQTT; it is mainly used between cloud servers (like RabbitMQ) rather than on…

XMPP (Extensible Messaging and Presence Protocol)

  • Originally created for instant chat applications (like Google Talk or Jabber).
  • Key Feature: Presence Detection — devices can easily broadcast when they come online or go offline.
  • Drawback in IoT: Uses verbose XML text tags, which creates heavy network traffic and quickly drains battery on small microcontrollers.

Summary Comparison Table

  • Communication Model: Publish - Subscribe
  • Transport Layer: TCP
  • Header Size: 2 Bytes (Minimal)
  • Reliability: 3 QoS Levels (0, 1, 2)
  • Best Hardware: Microcontrollers (ESP32, Arduino)

Web Connectivity: SOAP vs. REST, HTTP Restful, and WebSockets

Overview: REST treats a resource such as a room temperature as something a client can request.

Introduction: Web Services in the World of IoT

  • When an IoT device needs to talk to a mobile app or a cloud server (for example, letting you turn on a room AC using your phone), it uses a…

SOAP vs. REST: Why REST Won the IoT Revolution

  • SOAP defines a message envelope for exchanging structured data.
  • SOAP (Simple Object Access Protocol) Strict, heavy XML envelopes, high RAM & CPU usage.
  • REST (Representational State Transfer) Flexible, lightweight JSON messages, uses standard HTTP verbs.
  • Type: Formal, rigid Protocol with strict XML rules
  • Data Format: Exclusively XML (Heavy, complex tags)
  • Payload Size: Extremely Heavy: XML tags add 500+ bytes of unnecessary text
  • CPU & Memory: Requires heavy RAM and processing to parse XML trees
  • Transport: Can run over HTTP, SMTP, TCP

View diagram · SOAP vs. REST Architectural Styles

HTTP RESTful Architecture for IoT

  • In a RESTful IoT architecture, every sensor, actuator, or setting is treated as a Resource with its own unique URL address (called a…
  • Example URI for a smart AC: https://api.myhome.com/devices/ac_unit/temperature
  • Standard REST Verbs in IoT: GET (Read Sensor Data):
  • Request: GET /sensors/living_room/humidity
  • Response: 200 OK: {"humidity": 55, "unit": "%"}
  • POST (Register New Device):
  • Used when a new sensor connects for the first time to register its details with the cloud.
  • PUT (Update Device State / Actuate):

WebSockets: Full-Duplex Real-Time Communication

  • While REST is great for occasional checks, it is too slow for live, real-time control because the client must constantly poll the server.
  • Why WebSockets Work So Well in IoT: Instant Server Push: If a factory sensor detects smoke or overheating, the cloud can send a shutdown command to the actuator in **under 2…
  • Tiny Header Overhead: After the initial handshake, each message carries only 2 to 10 bytes of header overhead (compared to 500+ bytes in HTTP).
  • Live Streaming Telemetry: Perfect for real-time dashboards (such as tracking a flying drone, streaming patient heartbeat graphs, or tracking a live…

View diagram · WebSocket Handshake and Data Flow

Internet Connectivity & IP Addressing in IoT: IPv4 vs. IPv6

Overview: An address identifies an interface, while a router helps packets reach a different network.

Introduction: Giving Every “Thing” a Global Address

  • Just like every house in Indore or Bhopal needs a postal pin code and house number for delivery packages, every smart device connected to the…

Principles of Internet Connectivity in IoT

  • How does a small sensor in a field actually connect to the Internet?
  • Direct IP Connectivity: The device has built-in Wi-Fi or cellular hardware (like an ESP32 or a 4G SIM module) and connects directly to the Internet…
  • Gateway-Mediated Connectivity: Tiny, battery-powered sensors (using Bluetooth or Zigbee) do not have the power or memory to run full IP software.

View diagram · The Three Stages of IoT Internet Connectivity

The Great Addressing Problem: IPv4 vs. IPv6

  • An IPv4 address has 32 bits and an IPv6 address has 128.
  • IPv4 (32-Bit Address Space) Total addresses: 2³² ≈ 4.3 Billion.
  • IPv6 (128-Bit Address Space) Total addresses: 2¹²⁸ ≈ 3.4 × 10³⁸.
  • Address Length: 32 bits (4 bytes)
  • Notation Format: Dotted Decimal: 192.168.1.1
  • Total Address Pool: 4.29 Billion (Exhausted!)
  • Address Setup: Manual or via DHCP server
  • Header Size: Variable (20 to 60 bytes)

View diagram · Address Space Comparison: IPv4 vs. IPv6

Why is IPv6 Mandatory for the Future of IoT?

  • No More NAT (Network Address Translation):
  • In IPv4, all your home smart bulbs and plugs hide behind your single home Wi-Fi router’s IP address.
  • IPv6 gives every single bulb, sensor, and plug its own permanent global address, allowing true direct communication!
  • SLAAC (Auto Configuration):
  • If you install 1,000 smart streetlights across a city, setting IP addresses manually is impossible.
  • With IPv6 SLAAC, a device turns on, reads the local router’s prefix, and automatically configures its own unique IP address!
  • Better Multicast Support:
  • IPv6 allows sending a single firmware update to thousands of smart electric meters at the exact same time without slowing down the network.

Static vs. Dynamic IP Addressing in IoT

  • Static IP Addressing: The device is permanently configured with a fixed IP address that never changes.
  • Used for: Central IoT Gateways, MQTT Brokers, and Web Servers so client devices always know where to send readings.
  • Dynamic IP Addressing: The device is given a temporary IP address by a router or DHCP server.
  • Used for: Smartwatches, mobile wearables, and connected cars that move between different Wi-Fi networks and mobile towers.

6LoWPAN: IPv6 over Low-Power Wireless PAN Adaptation Layer

Overview: Small low-power radio frames leave limited space for a normal IPv6 header and payload.

What is 6LoWPAN?

  • 6LoWPAN stands for IPv6 over Low-Power Wireless Personal Area Networks.
  • We want all smart sensors to connect to the Internet using IPv6 because IPv6 provides unlimited IP addresses.
  • At the same time, battery-powered sensors use the low-power wireless standard IEEE 802.15.4 because it uses very little battery.
  • A standard IPv6 packet requires a minimum size of 1,280 bytes!
  • But an IEEE 802.15.4 wireless frame can hold a maximum of only 127 bytes!
  • To make matters worse, normal IPv6 headers (40 bytes) and UDP headers (8 bytes) take up 48 bytes by themselves.

View diagram · The 6LoWPAN Adaptation Layer Position

Core Functions of the 6LoWPAN Adaptation Layer

  • To fit large IPv6 packets into tiny 127-byte radio frames, 6LoWPAN performs three core functions:
  • 1. Header Compression Compresses 40-byte IPv6 + 8-byte UDP headers down to just 2 to 4 bytes !
  • 2. Fragmentation & Reassembly Splits 1,280-byte IPv6 packets across multiple 127-byte frames and reassembles them at the receiver.
  • 3. Mesh Routing (Layer 2.5) Passes packets hop-by-hop between battery-operated sensor nodes to reach the gateway.
  • A. Header Compression (How it Shrinks Headers): How does 6LoWPAN compress a 48-byte header into just 2 to 4 bytes?
  • Removes Predictable Data: Many fields in a local sensor network never change (for example, the IP version is always 6, and traffic priority is 0).
  • Uses MAC Addresses: The sender and receiver IP addresses are automatically calculated from the hardware MAC addresses of the radios.
  • By replacing repeated fields with simple 1-bit flags, the bulky 48-byte header shrinks down to only 2 to 4 bytes, leaving plenty of…

View diagram · The Three Core Mechanisms of 6LoWPAN

Advantages of 6LoWPAN

  • Direct Internet Connection: Sensor nodes talk genuine IPv6.
  • Open Standard: Standardized by the IETF, which means products from different manufacturers work together seamlessly.
  • Low Memory Footprint: Very lightweight software that easily runs on tiny microcontrollers with only 32 KB of code memory and 4 KB of RAM.

Media Access Control (MAC) in IoT: IEEE 802.15.4, BLE, and LoRaWAN

Overview: A battery sensor saves energy when it can sleep between assigned transmission slots.

What is Media Access Control (MAC) in IoT?

  • Imagine a classroom where 50 students start shouting their answers at the exact same second.

Contention-Based vs. Scheduled-Based MAC Protocols

  • Scheduled access reserves transmission turns and can make sleep times predictable.
  • 1. Contention-Based (Random Access) Devices compete for the channel using CSMA/CA (Listen before talk).
  • 2. Scheduled-Based (Time-Slotted) Uses TDMA (Time Division Multiple Access).

View diagram · The Two MAC Channel Access Paradigms

The Main Standard: IEEE 802.15.4 MAC Layer

  • The IEEE 802.15.4 standard is the worldwide wireless standard for low-power, low-data-rate sensor networks (the foundation of Zigbee and…
  • A. Non-Beacon Enabled Mode (Simple CSMA/CA): Uses Unslotted CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance):
  • Listen: The sensor node checks if anyone else is transmitting on the radio frequency.
  • Send: If the channel is free and silent, it sends its data packet immediately.
  • Wait: If the channel is busy, it waits for a short random time and checks again.
  • Advantage: Great for battery life.
  • B. Beacon-Enabled Mode (Superframe Structure): A master coordinator node sends regular synchronization signals called Beacons.
  • The time between beacons is organized into a Superframe divided into 16 time slots:
  • Radio Frequency: 2.4 GHz, 868/915 MHz
  • Typical Range: 10 to 100 meters
  • Data Rate: 250 kbps
  • Channel Access: CSMA/CA & Slotted GTS
  • Battery Life: Very High (Months/Years)
  • Network Type: Mesh, Star

LoRaWAN MAC Classes (Class A, B, and C)

  • LoRaWAN defines three device classes depending on how much battery power is available:
  • Class A (Battery-Optimized): Default mode.
  • Class B (Scheduled Listening): Opens extra scheduled receive windows at fixed intervals, synchronized with gateway beacons.
  • Class C (Always Listening): Keeps its receiver turned ON continuously.