ESP32 BASICS · LESSON 10
The ESP32 as a Wi-Fi Access Point
Turning the board into its own hotspot so a phone or laptop can connect directly to it.
Instead of joining a network, the ESP32 can create its own — useful for a project's first-time setup screen, or anywhere there's no existing Wi-Fi to join.
wifi_ap.ino
#include
const char* ap_ssid = "ESP32-Setup";
const char* ap_password = "configure123";
void setup() {
Serial.begin(115200);
WiFi.softAP(ap_ssid, ap_password);
Serial.print("Access point IP: ");
Serial.println(WiFi.softAPIP());
}
void loop() {
}
Once running, a phone or laptop can connect to "ESP32-Setup" like any other Wi-Fi network, then reach the board at the printed IP address — typically 192.168.4.1.
Access point vs station mode
A board can even run both at once, joining your home network while also broadcasting its own — handy for a device that needs a one-time setup screen before it connects to your real network for good.
KEY IDEA
An access-point password under 8 characters isn't accepted by softAP() — Wi-Fi's WPA2 minimum applies even to a temporary setup network.