Join Wi-Fi
Wi-Fi Station join
Join an existing router and get an IP. Almost every cloud product starts here.
Join Wi-Fi
Join a router
ESP32 / S2 / S3 / C3 / C6 (Wi-Fi parts)
Official path: examples/wifi/getting_started/station
01 Overview
The chip runs as STA and joins an AP. This sits under almost every ESP32 cloud product.
Use when: the site already has Wi-Fi, and the device needs internet or LAN access.
Skip when: no router (SoftAP / provisioning) or phone-only control (BLE).
Official proves: SSID/password, printed IP, retries then fail log.
Official does not: provisioning UI, encrypted storage, antenna certification.
Real products need to add provisioning, reconnection, and secure storage on top.
02 Hardware
- Chip: Wi-Fi ESP32 parts (ESP32, S2, S3, C3, C6). H2 has no Wi-Fi.
- Minimum parts: module (with antenna), 3.3V supply, reset circuit. Antenna on the module.
- Layout: keep-out under antenna; metal housings need a window.
- Power: TX current spikes; add decoupling caps to avoid resets.
- Power supply: use a low-dropout regulator for stable 3.3V.
- Connectors: if external antenna, use IPEX with impedance matching.
- Other: add LED for Wi-Fi status indication for debugging.
03 Software flow
1. Init NVS (required by Wi-Fi driver).
2. Register STA events including GOT_IP and disconnect.
3. Load SSID/password from menuconfig, start WIFI_MODE_STA.
4. State machine: init → auth → assoc → run.
5. Products wait for GOT_IP before MQTT/HTTP; never ship hardcoded credentials.
6. Implement reconnection strategy with backoff after disconnection.
7. Use event loop to handle post-IP business logic.
04 Core points
- Hardcoded passwords cannot ship.
- Associated is not “cloud ready”.
- Retry policy is a battery decision.
- Custom work: provisioning, reconnect policy, antenna layout, cloud stack.
- Be aware of Wi-Fi behavior differences across chips; test accordingly.