%%{init: {'theme': 'base', 'themeVariables': {
'primaryColor': '#E67E22',
'primaryTextColor': '#fff',
'primaryBorderColor': '#C0392B',
'lineColor': '#2C3E50',
'secondaryColor': '#16A085',
'tertiaryColor': '#7F8C8D',
'clusterBkg': '#ECF0F1',
'clusterBorder': '#2C3E50',
'fontSize': '14px',
'fontFamily': 'Inter, system-ui, sans-serif'
}}}%%
graph TB
MAC["<b>MAC Protocols</b><br/>Medium Access Control"]
%% Main categories
Contention["<b>Contention-Based</b><br/>(Random Access)"]
Free["<b>Contention-Free</b><br/>(Scheduled Access)"]
Hybrid["<b>Hybrid Schemes</b><br/>(Mixed Strategies)"]
%% Contention-based protocols
ALOHA["<b>ALOHA</b><br/>Simple, inefficient<br/>~18% max throughput"]
CSMA["<b>CSMA</b><br/>Carrier sense before send<br/>Better collision avoidance"]
CSMACA["<b>CSMA/CA</b><br/>Wi-Fi, Zigbee<br/>Collision avoidance"]
CSMACD["<b>CSMA/CD</b><br/>Ethernet<br/>Collision detection"]
%% Contention-free protocols
TDMA["<b>TDMA</b><br/>Time slots<br/>Bluetooth, 802.15.4"]
FDMA["<b>FDMA</b><br/>Frequency slots<br/>LoRa channels"]
CDMA["<b>CDMA</b><br/>Spreading codes<br/>Cellular networks"]
%% Hybrid protocols
Poll["<b>Polling</b><br/>Master-slave<br/>Deterministic access"]
Token["<b>Token Passing</b><br/>Ordered access<br/>CAN bus, Token Ring"]
Reservation["<b>Reservation</b><br/>Request-grant<br/>S-ALOHA, DQDB"]
MAC --> Contention
MAC --> Free
MAC --> Hybrid
Contention --> ALOHA
Contention --> CSMA
Contention --> CSMACA
Contention --> CSMACD
Free --> TDMA
Free --> FDMA
Free --> CDMA
Hybrid --> Poll
Hybrid --> Token
Hybrid --> Reservation
classDef contentionStyle fill:#E67E22,stroke:#C0392B,stroke-width:2px,color:#fff
classDef freeStyle fill:#16A085,stroke:#117A65,stroke-width:2px,color:#fff
classDef hybridStyle fill:#7F8C8D,stroke:#566573,stroke-width:2px,color:#fff
classDef rootStyle fill:#2C3E50,stroke:#1A252F,stroke-width:3px,color:#fff
class MAC rootStyle
class Contention,ALOHA,CSMA,CSMACA,CSMACD contentionStyle
class Free,TDMA,FDMA,CDMA freeStyle
class Hybrid,Poll,Token,Reservation hybridStyle
622 Networking Basics: Protocols and MAC Classification
622.1 Learning Objectives
By the end of this chapter, you will be able to:
- Understand IoT Protocols by Layer: Identify common protocols at each OSI/TCP-IP layer
- Master MAC Protocol Classification: Explain contention-based, contention-free, and hybrid MAC protocols
- Select Appropriate MAC Protocols: Choose MAC protocols based on power, latency, and density requirements
- Apply Protocol Selection: Use decision trees to match protocols to IoT use cases
622.2 Prerequisites
Before diving into this chapter, you should be familiar with:
- Networking Basics: Introduction: Understanding core networking concepts including the layers model, IP addressing, and network types
- Layered Network Models: The OSI and TCP/IP models provide the framework for understanding how protocols operate at different layers
622.3 Common IoT Protocols by Layer
622.3.1 Application Layer (Layer 7)
| Protocol | Transport | Use Case | Overhead |
|---|---|---|---|
| MQTT | TCP/UDP | General IoT messaging | Low |
| CoAP | UDP | Constrained devices | Very Low |
| HTTP/HTTPS | TCP | Web services, REST APIs | High |
| AMQP | TCP | Enterprise messaging | Medium |
| WebSocket | TCP | Real-time bidirectional | Medium |
622.3.2 Network Layer (Layer 3)
| Protocol | Purpose | IoT Application |
|---|---|---|
| IPv4 | Internet routing | Legacy IoT, NAT required |
| IPv6 | Next-gen routing | Modern IoT, 6LoWPAN |
| RPL | Routing for LLNs | Sensor networks |
| ICMP | Error reporting | Ping, traceroute |
622.3.3 Data Link Layer (Layer 2)
| Protocol | Range | Data Rate | Power | Use Case |
|---|---|---|---|---|
| Wi-Fi | 50-100m | 1-1300 Mbps | High | Smart home |
| Bluetooth LE | 10-50m | 1-2 Mbps | Very Low | Wearables |
| Zigbee | 10-100m | 250 Kbps | Very Low | Home automation |
| LoRa | 2-15 km | 0.3-50 Kbps | Ultra Low | Wide area sensors |
| Ethernet | 100m | 10-10000 Mbps | N/A | Wired industrial |
622.4 MAC Protocol Classification
MAC stands for Medium Access Control. Think of it as the “traffic rules” for how devices share a network channel:
- The Problem: Multiple devices want to send data at the same time on the same channel
- The Solution: MAC protocols provide rules so devices can take turns without interfering
- Real-World Analogy: Like people in a meeting raising hands to speak (polling), or taking turns in order (TDMA), or just talking when there’s silence (CSMA)
Different MAC protocols make different trade-offs between fairness, efficiency, and complexity.
At the Data Link Layer, the Medium Access Control (MAC) sublayer determines how devices share access to the physical medium. For IoT, choosing the right MAC protocol directly impacts battery life, latency, and scalability.
622.4.1 MAC Protocol Taxonomy
This variant visualizes the same MAC protocols but arranges them by their key trade-offs: Latency Predictability vs Energy Efficiency. Different IoT use cases prioritize different quadrants.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#E67E22', 'secondaryColor': '#16A085', 'tertiaryColor': '#E8F6F3', 'fontSize': '11px'}}}%%
quadrantChart
title MAC Protocol Trade-offs for IoT
x-axis Low Energy Efficiency --> High Energy Efficiency
y-axis Variable Latency --> Predictable Latency
quadrant-1 Industrial Control
quadrant-2 Real-Time Monitoring
quadrant-3 Smart Home Devices
quadrant-4 Battery-Powered Sensors
TDMA: [0.85, 0.90]
Token: [0.60, 0.85]
Polling: [0.55, 0.80]
CDMA: [0.40, 0.70]
CSMA-CA: [0.50, 0.35]
ALOHA: [0.90, 0.20]
FDMA: [0.70, 0.65]
Reading the Quadrant:
- Top-Right (Best for Battery + Real-Time): TDMA excels - scheduled slots enable deep sleep AND predictable timing
- Bottom-Right (Battery Priority): ALOHA maximizes sleep time but has unpredictable collisions
- Top-Left (Latency Priority): Polling/Token ensure timing but require constant coordination
- Bottom-Left (General Purpose): CSMA/CA offers flexibility at cost of both metrics
622.4.2 MAC Protocol Performance Comparison
| Protocol | Throughput | Latency | Fairness | Energy Efficiency | Best For |
|---|---|---|---|---|---|
| ALOHA | Low (18% max) | Variable, high collisions | Poor | Low overhead | Very simple, low traffic (LoRaWAN Class A) |
| CSMA/CA | Medium (50-70%) | Variable, backoff delays | Fair | Medium | Wi-Fi, Zigbee, general wireless |
| TDMA | High (90%+) | Fixed, predictable | Excellent | Very Low (sleep in unused slots) | Scheduled IoT (Bluetooth, 802.15.4) |
| Polling | Medium | Bounded, depends on cycle | Excellent | Medium (wait for poll) | Deterministic industrial systems |
| CDMA | High | Low, simultaneous | Good | High complexity | Cellular (NB-IoT, LTE-M) |
| Token Passing | High (90%+) | Bounded, token wait | Perfect | Medium | Industrial buses (CAN, Profibus) |
Contention-Based (Orange):
- Pros: Simple, scalable, no synchronization needed
- Cons: Variable latency, collisions waste energy
- IoT Impact: Good for bursty, unpredictable traffic (sensor alerts)
Contention-Free (Teal):
- Pros: Predictable latency, no collisions, excellent for sleep scheduling
- Cons: Requires synchronization, fixed overhead even when idle
- IoT Impact: Best for battery-powered, scheduled reporting (smart meters)
Hybrid (Gray):
- Pros: Combines benefits, adapts to traffic patterns
- Cons: More complex implementation
- IoT Impact: Industrial IoT with mixed traffic (time-critical + best-effort)
622.4.3 IoT MAC Protocol Selection Guide
Low Traffic, Simple Devices (e.g., soil moisture sensor reporting 3x/day):
- Use: ALOHA variants (LoRaWAN Class A)
- Why: 99% of time sleeping, rare collisions, minimal overhead
Scheduled, Predictable Traffic (e.g., smart meter reading every 15 min):
- Use: TDMA (Bluetooth, 802.15.4 beacon mode)
- Why: Devices wake only for assigned slot, predictable latency
Bursty, Unpredictable Traffic (e.g., motion sensor sending alerts):
- Use: CSMA/CA with aggressive sleep (Wi-Fi PSM)
- Why: Flexible access, sleep when idle, listen before send reduces collisions
Real-Time, Deterministic (e.g., industrial robot control):
- Use: TDMA or Polling (TSN, 802.15.4 GTS)
- Why: Guaranteed latency bounds, no collisions
High Density, Interference (e.g., stadium with 10,000+ devices):
- Use: CDMA or FDMA (NB-IoT, LoRa channels)
- Why: Orthogonal access, simultaneous transmissions without collision
622.4.4 Protocol Selection Decision Tree
Use this decision tree to select the appropriate MAC protocol for your IoT application:
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#E67E22', 'secondaryColor': '#16A085', 'tertiaryColor': '#7F8C8D', 'fontSize': '12px'}}}%%
flowchart TD
Start["SELECT MAC PROTOCOL<br/>What are your constraints?"]
Q1{"Battery<br/>Powered?"}
Q2{"Latency<br/>Critical?<br/>(<100ms)"}
Q3{"Traffic<br/>Pattern?"}
Q4{"High<br/>Density?<br/>(>100 devices)"}
Q5{"Real-time<br/>Required?"}
Q6{"Existing<br/>Infrastructure?"}
%% Outcomes
ALOHA["ALOHA/LoRaWAN Class A<br/>Minimal overhead<br/>Sleep 99%+ of time<br/>Best: 10+ year battery"]
TDMA["TDMA (BLE/802.15.4)<br/>Sleep between slots<br/>No collisions<br/>Best: Scheduled sensors"]
CSMA["CSMA/CA (Wi-Fi/Zigbee)<br/>Flexible access<br/>Good for bursty traffic<br/>Best: Smart home"]
POLL["Polling/Token<br/>Deterministic latency<br/>Industrial grade<br/>Best: Factory automation"]
CDMA["CDMA/FDMA (NB-IoT)<br/>Handles density<br/>Orthogonal access<br/>Best: Smart cities"]
Start --> Q1
Q1 -->|"Yes<br/>(years of life needed)"| Q3
Q1 -->|"No<br/>(mains power)"| Q2
Q3 -->|"Infrequent<br/>(<1x/hour)"| ALOHA
Q3 -->|"Scheduled<br/>(every N minutes)"| TDMA
Q3 -->|"Bursty/Random<br/>(event-driven)"| CSMA
Q2 -->|"Yes<br/>(<10ms latency)"| Q5
Q2 -->|"No<br/>(best effort OK)"| Q4
Q5 -->|"Yes<br/>(control systems)"| POLL
Q5 -->|"No<br/>(monitoring only)"| CSMA
Q4 -->|"Yes<br/>(stadium/city)"| CDMA
Q4 -->|"No<br/>(<100 devices)"| CSMA
style Start fill:#2C3E50,stroke:#16A085,color:#fff
style Q1 fill:#E67E22,stroke:#2C3E50,color:#fff
style Q2 fill:#E67E22,stroke:#2C3E50,color:#fff
style Q3 fill:#E67E22,stroke:#2C3E50,color:#fff
style Q4 fill:#E67E22,stroke:#2C3E50,color:#fff
style Q5 fill:#E67E22,stroke:#2C3E50,color:#fff
style ALOHA fill:#16A085,stroke:#2C3E50,color:#fff
style TDMA fill:#16A085,stroke:#2C3E50,color:#fff
style CSMA fill:#16A085,stroke:#2C3E50,color:#fff
style POLL fill:#16A085,stroke:#2C3E50,color:#fff
style CDMA fill:#16A085,stroke:#2C3E50,color:#fff
622.4.5 Real-World Examples
Wi-Fi (CSMA/CA):
- Listen for silence (carrier sense)
- Wait random backoff if busy
- Send when clear
- Acknowledgment required
- IoT Use: Smart home devices with AC power
Bluetooth LE (TDMA):
- Central device assigns 1.25ms time slots
- Peripheral transmits only in assigned slot
- Sleep between slots
- IoT Use: Wearables, sensors with predictable 1-second updates
LoRaWAN Class A (ALOHA):
- Device transmits whenever it wants
- No carrier sense (ultra-low power radio off between sends)
- Accepts ~1% packet loss due to collisions
- IoT Use: Agricultural sensors, asset tracking (battery life > 10 years)
CAN Bus (CSMA/CR - Collision Resolution):
- Listen before send (like CSMA)
- If collision, highest priority message wins
- Losers retry immediately
- IoT Use: Automotive, industrial control (deterministic, fault-tolerant)
Scenario: 100 battery-powered sensors, 1 reading/hour
ALOHA:
- Device wakes, transmits immediately, sleeps
- Average energy: ~5 mJ/transmission
- Collision rate: ~1% (99 devices sleeping)
- Battery life: 5-10 years (dominant factor is sleep current)
CSMA/CA:
- Device wakes, listens for clear channel, sends, waits for ACK
- Average energy: ~15 mJ/transmission (3x ALOHA due to listening)
- Collision rate: <0.1%
- Battery life: 2-3 years (listening overhead significant)
TDMA:
- Device wakes only at assigned slot (e.g., slot 47 of 100)
- Average energy: ~3 mJ/transmission (no listening, no collisions)
- Collision rate: 0%
- Battery life: 10+ years (minimal overhead, perfect sleep scheduling)
Verdict: For ultra-low-power IoT with infrequent transmissions, TDMA or ALOHA variants dominate.
622.5 Knowledge Check
622.6 What’s Next
Now that you understand protocols and MAC classification, continue to learn about:
- Networking Basics: Hands-On Configuration - Network configuration, port numbers, troubleshooting, security, and bandwidth considerations
- Networking Basics: Labs and Practice - Interactive labs, Python implementations, and comprehensive knowledge checks
You can also return to the Networking Basics Overview for navigation to all related chapters.