esp32-wifi-setup

Configure WiFi station-mode connectivity in ESP32 firmware using ESP-IDF.

Updated Mar 27, 2026
One-click install
npx skills add https://github.com/gmackie/agent-skills --skill esp32-wifi-setup-gmackie
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: esp32-wifi-setup
Source: https://github.com/gmackie/agent-skills/tree/main/skills/esp32-wifi-setup
Command: npx skills add https://github.com/gmackie/agent-skills --skill esp32-wifi-setup-gmackie

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up WiFi on ESP32 microcontrollers requires correctly sequencing NVS initialization, event handlers, and ESP-IDF WiFi APIs, and small mistakes cause connection failures that are hard to debug. ## Core Features & Use Cases - CMakeLists Configuration: Declares the required esp_wifi, nvs_flash, and esp_netif component dependencies. - Station Mode Implementation: Provides complete C code for WiFi event handling, retry logic with event groups, and blocking connection via wifi_init_sta. - Kconfig Integration: Shows how to externalize SSID and password into menuconfig instead of hardcoding credentials. - Use Case: You are building an IoT sensor node on an ESP32 and need it to connect to a WPA2 network on boot with automatic retries before starting your application logic. ## Quick Start Use the esp32-wifi-setup skill to add WiFi station-mode connectivity to my ESP-IDF project with configurable SSID and password.

Frequently Asked Questions about esp32-wifi-setup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I connect an ESP32 to WiFi using ESP-IDF?▼

Initialize NVS first, then call esp_netif_init, create the default event loop, and configure esp_wifi in station mode with your SSID and password. Use FreeRTOS event groups to wait for the IP_EVENT_STA_GOT_IP event before proceeding.

How to store ESP32 WiFi credentials without hardcoding them?▼

Define ESP_WIFI_SSID and ESP_WIFI_PASSWORD entries in a Kconfig.projbuild file so they can be set through menuconfig. Reference them in code via the CONFIG_ESP_WIFI_SSID and CONFIG_ESP_WIFI_PASSWORD macros.

Why does ESP32 WiFi initialization fail on boot?▼

WiFi initialization fails when NVS flash is not initialized first, since the WiFi driver stores calibration data there. Call nvs_flash_init before esp_wifi_init, and erase NVS if it reports no free pages or a new version.

How do I retry WiFi connection on ESP32 after disconnect?▼

Handle WIFI_EVENT_STA_DISCONNECTED in your event handler and call esp_wifi_connect again, tracking attempts with a retry counter. After a maximum retry count, set a failure bit in an event group so app_main can react.

Does ESP-IDF WiFi station mode support WPA2 networks?▼

Yes, set the sta threshold authmode to WIFI_AUTH_WPA2_PSK in the wifi_config_t structure. This ensures the device only connects to access points using WPA2 or stronger security.