Wi-Fi & 802.11 · Study deck
ESP32 Wi-Fi: Provisioning and Recovery Workflows
A field device needs a safe path when its saved network no longer exists.
Radio Remi is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Handle scans, timeouts, retries, and credential recovery.
- Handle scans, timeouts, retries, and credential recovery
- Explain: The ESP32 is a low-cost microcontroller family with integrated Wi-Fi.
- Explain: Its rate ceiling is far below a laptop's, but that is normally acceptable for telemetry, commands, setup pages, and small maintenance transfers.
Major section
The ESP32 Wi-Fi Radio and Its Modes
The ESP32 is a low-cost microcontroller family with integrated Wi-Fi.
- A classic ESP32 design uses an 802.11 b/g/n radio on the 2.4 GHz band, a single spatial stream, and 20/40 MHz channels.
- For review purposes, do not treat an example sketch as the implementation.

Major section
The ESP32 Wi-Fi Radio and Its Modes (continued)
Its rate ceiling is far below a laptop's, but that is normally acceptable for telemetry, commands, setup pages, and small maintenance transfers.
- Choosing the mode is the first decision in any ESP32 Wi-Fi project, but the mode choice is only the start.
- A usable implementation also needs a state model for scanning, joining, address assignment, service readiness, outage, retry, setup, reset, and stopped behavior.
- The basic question is whether the firmware can prove the specific service path it claims to support.
- In each case the evidence should separate radio join, network address, application reachability, credential handling, and recovery.
Major section
The ESP32 Wi-Fi Radio and Its Modes (continued)
A sensor may need one acknowledged MQTT publish, a maintenance tool may need a local controller command, and a setup page may need a bounded onboarding window.
- That separation keeps a serial log that says "connected" from being mistaken for a release decision.
- The record should name the firmware build, SDK path, board, antenna, test access point, and service endpoint.
- The reviewer should still confirm the exact module or variant, because security modes, coexistence behavior, antenna layout, and SDK support can differ across boards.
Major section
The Event-Driven Connection Flow
The critical subtlety: STA_CONNECTED means the radio associated, but the device has no usable IP yet.
- Application sockets must wait for IP_EVENT_STA_GOT_IP.
- Opening a socket on connection rather than on got-IP is a classic beginner bug.
- A practitioner implementation should also put policy around those events.
- Provisioning needs the same discipline.
Major section
The Event-Driven Connection Flow (continued)
If data is created during an outage, record whether it is buffered, summarized, dropped, or marked stale.
- A setup access point should start only under a defined condition such as missing credentials, a physical reset gesture, or an explicit support command.
- It should close after onboarding or timeout, and it should leave a clear failure state when credentials are wrong.
- Worked example.: A firmware opens an MQTT socket inside the STA_CONNECTED handler and it fails intermittently.
Major section
The 802.11 Association Sequence Beneath the Events
A wrong password fails at the 4-way handshake, a hidden SSID needs an active probe, and weak signal can produce repeated association timeouts.
- The state machine also protects the rest of the firmware.
- Sensors, actuators, watchdogs, local storage, and user feedback should not freeze while Wi-Fi retries.
Major section
The 802.11 Association Sequence Beneath the Events (continued)
A clean implementation records the last network stage, the disconnect reason, retry count, next retry time, and whether application traffic is allowed.
- That evidence lets a reviewer distinguish a radio problem from a DHCP problem, a DNS problem, an authorization problem, or a broker outage.
- Reading the reason code instead of blindly retrying turns “Wi-Fi will not connect” into a precise fix.
- The release record should show the failed stage, the corrected key or mode, the retest result, and whether the support state changed from retrying to usable service.
Deck summary
Key takeaways
The ESP32 is a low-cost microcontroller family with integrated Wi-Fi.
- Its rate ceiling is far below a laptop's, but that is normally acceptable for telemetry, commands, setup pages, and small maintenance transfers.
- A sensor may need one acknowledged MQTT publish, a maintenance tool may need a local controller command, and a setup page may need a bounded onboarding window.
- The critical subtlety: STA_CONNECTED means the radio associated, but the device has no usable IP yet.
- If data is created during an outage, record whether it is buffered, summarized, dropped, or marked stale.
Retrieval practice
Recall check 1 of 5

Radio Remi says: answer from memory, then check your reasoning.
Q1An ESP32 reports that it is connected to Wi-Fi, but telemetry never reaches the intended broker. What is the strongest review conclusion?
Show answer
Answer: B ESP32 Wi-Fi readiness requires both station join evidence and usable-service evidence.
Retrieval practice
Recall check 2 of 5

Radio Remi says: answer from memory, then check your reasoning.
Q2A device starts a setup access point on every boot and leaves it running after it joins the normal network. What is the best review response?
Show answer
Answer: B Setup access point behavior should be limited to onboarding or support conditions and should not remain open during normal operation.
Retrieval practice
Recall check 3 of 5

Radio Remi says: answer from memory, then check your reasoning.
Q3Which Wi-Fi capabilities does a classic ESP32 provide?
Show answer
Answer: C The ESP32 is a 2.4 GHz b/g/n single-stream radio with STA, AP, and combined modes. (Also: usable as station, SoftAP, or both.).
Retrieval practice
Recall check 4 of 5

Radio Remi says: answer from memory, then check your reasoning.
Q4On an ESP32 station, when should application sockets be opened?
Show answer
Answer: A Layer-2 association precedes DHCP; sockets need the IP from GOT_IP, not just CONNECTED -- STA_CONNECTED does not yet provide a usable IP address.
Retrieval practice
Recall check 5 of 5

Radio Remi says: answer from memory, then check your reasoning.
Q5An ESP32 associates successfully but then disconnects with a 4-way-handshake-timeout reason code. What does that indicate?
Show answer
Answer: D Reaching association then failing the 4-way handshake points to the key/security stage, which the reason code names.
Print reference
Answers 1 of 2
Answer key.
- B · ESP32 Wi-Fi readiness requires both station join evidence and usable-service evidence.
- B · Setup access point behavior should be limited to onboarding or support conditions and should not remain open during normal operation.
- C · The ESP32 is a 2.4 GHz b/g/n single-stream radio with STA, AP, and combined modes. (Also: usable as station, SoftAP, or both.).
Print reference
Answers 2 of 2
Answer key.
- A · Layer-2 association precedes DHCP; sockets need the IP from GOT_IP, not just CONNECTED -- STA_CONNECTED does not yet provide a usable IP address.
- D · Reaching association then failing the 4-way handshake points to the key/security stage, which the reason code names.