827  Wi-Fi MAC Layer and IoT Applications

827.1 Learning Objectives

By the end of this chapter, you will be able to:

  • Understand CSMA/CA: Explain carrier sense multiple access and collision avoidance mechanisms
  • Analyze MAC Performance: Evaluate how contention affects throughput in dense deployments
  • Apply QoS Differentiation: Configure traffic priorities for different IoT applications
  • Design for Use Cases: Select appropriate Wi-Fi configurations for smart home, industrial, agriculture, and healthcare deployments

827.2 Prerequisites

Before diving into this chapter, you should be familiar with:

NoteKey Takeaway

In one sentence: Wi-Fi uses CSMA/CA to share the medium, with hidden terminal mitigation via RTS/CTS, and QoS differentiation (802.11e) to prioritize time-sensitive traffic.

Remember this rule: Enable RTS/CTS for mesh networks with hidden terminals; use 5 GHz for high-bandwidth devices (cameras) and 2.4 GHz for range-constrained sensors.

827.3 MAC Layer and Channel Access

Wi-Fi uses CSMA/CA to share the medium. Hidden and exposed terminal problems can cause collisions or unnecessary backoff; RTS/CTS can mitigate hidden terminals. QoS and MAC performance depend on contention, interference, and client mix.

Wi-Fi Architecture Diagram 3

Wi-Fi Architecture Diagram 3
Figure 827.1: Wi-Fi CSMA/CA channel access with carrier sense and backoff

827.3.1 802.11 Channel Access Procedure

Flowchart showing 802.11 CSMA/CA channel access procedure with carrier sense, DIFS waiting, random backoff timer, frame transmission, and ACK receipt stages
Figure 827.2: IEEE 802.11 channel access mechanism using CSMA/CA for collision avoidance. The diagram shows a station sensing the channel carrier signal. If idle, the device waits for DIFS duration plus random backoff, then transmits the frame and waits for ACK acknowledgment. If busy, the station defers transmission and enters exponential backoff, preventing collisions through randomized retry timing.

Original textbook diagram showing IEEE 802.11 CSMA/CA channel access mechanism with carrier sense, DIFS, random backoff, and ACK procedures from CP IoT System Design Guide Chapter 4

Original 802.11 channel access diagram from CP IoT System Design Guide

Source: CP IoT System Design Guide, Chapter 4 - Networking

827.3.2 Hidden Terminal Problem

Network diagram showing hidden terminal problem with two stations A and B on opposite sides of access point, both transmitting simultaneously, causing collision at AP because A and B cannot hear each other
Figure 827.3: Hidden terminal problem where two stations cannot sense each other’s transmissions (due to distance, obstacles, or low SNR) but both can reach the same access point. If they transmit at the same time, their frames can collide at the AP, causing retransmissions and wasted airtime.

827.3.3 Exposed Terminal Problem

Network topology showing exposed terminal problem where Node B unnecessarily defers transmission because it senses Node A transmitting, even though B's transmission to Node C would not cause interference
Figure 827.4: Exposed terminal problem where a node unnecessarily defers transmission. Node B is within range of transmitting Node A and detects A’s transmission. B defers its own transmission to Node C even though B to C transmission would not interfere with A’s transmission to the AP. This reduces network efficiency as B unnecessarily waits when parallel transmissions are possible. Occurs when CSMA sensing is overly conservative.

827.3.4 RTS/CTS Handshake

Sequence diagram of RTS/CTS handshake showing four-step process: RTS request, CTS broadcast, NAV timer setting, and protected data transmission
Figure 827.5: RTS/CTS handshake mechanism for collision avoidance in Wi-Fi. The four-way handshake prevents hidden terminal collisions: (1) Sender transmits Request-To-Send with duration, (2) Receiver responds with Clear-To-Send heard by all nearby nodes, (3) Other nodes set NAV timer and defer transmission, (4) Sender transmits data frame safely. CTS broadcast alerts hidden terminals to wait, reducing collisions at the cost of additional overhead. Essential for mesh networks with multi-hop hidden terminals.

827.3.5 MAC Performance Characteristics

Performance graph showing 802.11 MAC throughput vs number of stations, with curves for saturation throughput, collision rate, and average delay as node count increases from 1 to 100
Figure 827.6: 802.11 MAC layer performance characteristics and metrics. The figure illustrates that as the number of contending stations increases (often modeled under saturation assumptions), collision probability and backoff overhead rise and effective throughput per station decreases. Exact curves depend on PHY rate, frame sizes, retry limits, and traffic patterns.

Original textbook graph showing 802.11 MAC layer performance characteristics including throughput vs station count, collision probability curves, and backoff delay metrics from CP IoT System Design Guide Chapter 4

Original 802.11 MAC performance diagram from CP IoT System Design Guide

Source: CP IoT System Design Guide, Chapter 4 - Networking

827.4 Wi-Fi Architecture for IoT

~20 min | Intermediate | P08.C33.U01

827.4.1 Infrastructure Mode (Most Common)

Wi-Fi Architecture Diagram 4

Wi-Fi Architecture Diagram 4
Figure 827.7: Wi-Fi infrastructure mode with access point connecting devices to Internet

This variant shows the same three Wi-Fi architectures from a spatial coverage perspective - emphasizing how each mode extends or limits coverage area.

Diagram: INFRA

Diagram: INFRA
Figure 827.8: Wi-Fi architectures compared by coverage area: Infrastructure (single room), Direct (two devices), Mesh (whole building)

Key Insight: Choose architecture based on coverage needs: Infrastructure for single room with good AP placement, Wi-Fi Direct for temporary device-to-device links, Mesh for large areas with multiple rooms or floors. Mesh eliminates dead zones through overlapping coverage.

Characteristics:

Detailed 802.11 frame structure diagram showing MAC header fields including frame control, duration, three address fields, sequence control, frame body payload section, and 4-byte FCS checksum
Figure 827.9: IEEE 802.11 frame structure showing MAC header, frame body, and FCS components. The frame consists of three main parts: (1) MAC Header with frame control, duration, addresses (source, destination, BSSID), and sequence control totaling 24-30 bytes, (2) Frame Body containing 0-2312 bytes of payload data with encryption if enabled, (3) Frame Check Sequence (FCS) providing 4-byte CRC32 checksum for error detection. Key header fields include frame type (management, control, data), fragmentation bits, retry flag, power management bit, and QoS priority fields.

Original textbook diagram showing IEEE 802.11 MAC frame structure with detailed header fields, frame body, and FCS components from CP IoT System Design Guide Chapter 4

Original 802.11 frame structure diagram from CP IoT System Design Guide

Source: CP IoT System Design Guide, Chapter 4 - Networking

  • Centralized access point (AP) or router
  • All devices connect to AP
  • AP provides DHCP, routing, internet access
  • Most common for home/office IoT

827.4.2 Wi-Fi Direct (Peer-to-Peer)

Diagram: PHONE

Diagram: PHONE
Figure 827.10: Wi-Fi Direct peer-to-peer connections with smartphone as group owner

Characteristics: - Direct device-to-device connection - No router required - One device acts as soft AP - Use cases: Camera to phone, phone to printer

827.4.3 Wi-Fi Mesh Networks

Diagram: GATEWAY

Diagram: GATEWAY
Figure 827.11: Wi-Fi mesh network with gateway and satellite nodes extending coverage

Characteristics: - Multiple access points form a mesh - Self-healing, automatic routing - Extended coverage for large areas - Standards/implementations: IEEE 802.11s, vendor mesh systems, ESP32 frameworks (ESP-IDF ESP-Wi-Fi-MESH, Arduino painlessMesh)

827.5 QoS and Traffic Differentiation

QoS traffic differentiation diagram showing four access categories (Voice, Video, Best Effort, Background) with different AIFS waiting periods and contention window ranges, illustrating priority-based channel access in 802.11e
Figure 827.12: Statistical traffic differentiation for QoS in Wi-Fi networks. The diagram shows how 802.11e QoS assigns different priority levels to traffic types using four Access Categories (AC): (1) AC_VO (Voice) highest priority with shortest wait times for VoIP calls, (2) AC_VI (Video) second priority for streaming video with bounded latency, (3) AC_BE (Best Effort) standard priority for web browsing and file transfer, (4) AC_BK (Background) lowest priority for bulk data transfers and backups. Each category uses different AIFS (Arbitration Inter-Frame Space) and contention window sizes - higher priority classes wait shorter AIFS before transmitting, increasing their probability of channel access.

827.6 Videos

NoteWi-Fi and the Protocol Stack
Wi-Fi and the Protocol Stack
Lesson 4 β€” layering fundamentals that underpin 802.11 networking.

827.7 Real-World IoT Applications

827.7.1 Smart Home Automation

Diagram: BAND_24

Diagram: BAND_24
Figure 827.13: Smart home dual-band Wi-Fi with 2.4 GHz and 5 GHz device separation

Use Case: Wi-Fi connects all smart home devices to central hub - Lights: 2.4 GHz (low bandwidth, range important) - Cameras: 5 GHz (high bandwidth video streaming) - Sensors: 2.4 GHz (battery-powered, need range)

827.7.2 Industrial IoT Monitoring

Application: Factory sensor network - Devices: 100+ sensors monitoring machines - Network: Wi-Fi 6 with OFDMA for dense deployment - Security: WPA2-Enterprise with 802.1X authentication - Topology: Mesh network for large facility coverage

827.7.3 Smart Agriculture

Application: Greenhouse monitoring - Sensors: Soil moisture, temperature, humidity (ESP32) - Power: Deep sleep mode, wake every 15 minutes - Connectivity: Wi-Fi 4 (2.4 GHz for range) - Data: MQTT over Wi-Fi to cloud platform

827.7.4 Healthcare Wearables

Application: Patient monitoring devices - Devices: Wearable sensors (heart rate, SpO2) - Connection: Wi-Fi Direct to smartphone gateway - Security: WPA3 with end-to-end encryption - Power: Wi-Fi modem sleep when idle

827.9 Summary

This chapter covered Wi-Fi MAC layer and IoT applications:

  • CSMA/CA Channel Access: Carrier Sense Multiple Access with Collision Avoidance prevents simultaneous transmissions through listen-before-talk, but hidden terminals cause collisions without RTS/CTS
  • RTS/CTS Handshake: Request To Send / Clear To Send mitigates hidden terminal collisions by reserving airtime (other nodes defer), improving reliability at the cost of additional overhead
  • QoS Differentiation: 802.11e provides four access categories (Voice, Video, Best Effort, Background) with different AIFS and contention windows
  • Smart Home: Use 2.4 GHz for range-constrained sensors, 5 GHz for bandwidth-intensive cameras
  • Industrial IoT: Wi-Fi 6 with OFDMA handles dense sensor deployments; mesh extends coverage
  • Agriculture: Deep sleep + periodic wake works for low-data sensors; consider LPWAN for outdoor range
  • Healthcare: Wi-Fi Direct to smartphone gateway; WPA3 security essential

827.10 What’s Next

The next chapter explores Wi-Fi Design and Exercises, covering common deployment pitfalls, worked examples for roaming configuration and backhaul planning, and hands-on exercises for mesh setup and hidden terminal analysis.