Demo 10: How to turn the Arduino ESP32 into an Access Point

1. Introduction
All the previous demonstrations which are related to WiFi, ESP32 operate in Station mode in which ESP32 will become a client of a WiFi network.  In this demonstration, we will make it an Access Point in which it is a WiFi emission point so that WiFi clients can connect to it. Note that ESP32 can operation in both Station and Access Point mode where it is a WiFi client and emit WiFi as well.
2. Hardware
You do not need any extra hardware.
3. Software
In order to set the WiFi mode for ESP32 we will use the function:
- WiFi.mode(mode): where mode can be: WIFI_OFF (turn off WiFi), WIFI_STA (Station mode), WIFI_AP (Access Point mode), WIFI_AP_STA (both Station and Access Point mode)
- WiFi.begin(ssid, password): use this function to make ESP32 a WiFi client that connect to a network have ssid and password. If we use this function we need not to use WiFi.mode(WIFI_STA).
WiFi.softAP(ssidAP, passwordAP):  use this function to make ESP32 an Access Point that has authentication information are ssidAP and passwordAP. If we use this function we need not to use WiFi.mode(WIFI_AP)
Let's make ESP32 an Access Point with authentication information below:
 - ssid  is "ESP32ap"
 - password is "12345678"
Note: the default IP add ress of ESP32 in AP mode is ""
Create an Arduino project and save as esp32ap with the code:
#include <WiFi.h>

const char *ssid = "ESP32ap";
const char *password = "12345678";
void setup() {
  Serial.print("Configuring access point...");
  /* You can remove the password parameter if you want the AP to be open. */
  WiFi.softAP(ssid, password);

  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");

void loop() {
4. Result
Figure: ESP32 as AP mode with default local IP is
 Figure: from smartphone you will see AP (ESP32ap), fill password and connected

Post a Comment


Unknown said…
Nice tutorial.
I followed all the steps and it showed connnected,but
I could not go on the net with IE or Chrome on my cellphone or my laptop.No pages were loaded.
I tried a few diff wifi connections without any problems.

I wonder if you know what the problem is.

Hi, I do not understand your situation. If i understand well so after connecting to ESP32 your cellphone can not connect to the INTERNET?

Unknown said…
This comment has been removed by the author.
Unknown said…
Thanks for your reply.

On my laptop computer, I can see ESPap32 connected, but on my IE and Chrome browsers

they say no internet connection. I cannot connect to the Internet.

My router is working well because I can connect to a few wifi connections without any problems.

Hi friend,

When ESp is in AP mode, it is similar to a router. Your computer connect to esp, it is similar to connecting to a router but since esp not connect to internet so your computer can not access to internet. I hope i understand properly your question :)

Best regards.

Unknown said…
Hi friend,
Thanks for everything.
It is working finally.

Best regards
Anonymous said…
Great tutorial.
One question: ho do I make the AP secure (SSL, https)?
Hi friend

It is quite complicated.
You should look in the WifiClientSecure to see mbed_tls
and learn how to setup a secure server.


Anonymous said…
Hi guys!

When compiling the esp32, I receive the error 'class WiFiClass' has no member named 'softAP'
Anyone has any solution?

All the best!
Unknown said…
Currently I use ESP32 in STA mode, as a client while using an external AP device to exchange data with other clients. I want to use ESP32 AP_STA mode first to set up a softAP with SSID and Passwd, then connect the same ESP32 as STA to this softAP (in the same ESP32), then connect other clients to this ESP32 softAP also (using the same channel), thus I can remove the external AP device. Anyone has a solution and sample code?

Anonymous said…
By using above code it is not possible to get internet connection can anyone help to get the internet connection. In AP or APSTA mode
It should be station mode.
Drake said…
After using the same coding here, I got an error. It says 'class WiFiClass' has no member named 'softAP'. Im using an ESP32. What should i do?
I m using ESP32 in both AP+Client mode and it already got an IP address and WiFi is connected on ESP32 but When I connect my phone or PC to ESP Network SSID it says no internet access. Did anyone resolved the issue?
Anonymous said…
Hi, how can i make my esp32 as an AP when i use also MQTT broker?
thank you!