ESP32-CAM: Set Access Point (AP) using Arduino IDE | Random Nerd Tutorials (2024)

This tutorial shows how to set your ESP32-CAM as an Access Point (AP) for your web server projects. This way, you don’t need to be connected to a router to access the web server. We’ll program the ESP32-CAM using Arduino IDE.

ESP32-CAM: Set Access Point (AP) using Arduino IDE | Random Nerd Tutorials (1)

Access Point vs Station

In previous ESP32-CAM web server projects, we connect the ESP32-CAM to a wireless router. In this configuration, we can access the ESP32-CAM board through the local network.

In this scenario, the router acts as an access point and the ESP32-CAM board is set as a station. So, you need to be connected to your router (local network) to control and access the ESP32-CAM web server.

ESP32-CAM: Set Access Point (AP) using Arduino IDE | Random Nerd Tutorials (2)

In some cases, this might not be the best configuration (when you don’t have a router nearby). But if you set the ESP32-CAM boards as an access point (hotspot), you can be connected using any device with Wi-Fi capabilities without the need to connect to your router.

ESP32-CAM: Set Access Point (AP) using Arduino IDE | Random Nerd Tutorials (3)

Basically, when you set the ESP32-CAM as an access point you create its own Wi-Fi network and nearby Wi-Fi devices (stations) can connect to it (like your smartphone or your computer).

Soft Access Point

Because the ESP32-CAM doesn’t connect further to a wired network (like your router), it is called soft-AP (soft Access Point).

This means that if you try to load libraries or use firmware from the internet, it will not work (like including JavaScript libraries). It also doesn’t work if you try to make HTTP requests to services on the internet (like sending an email with a photo, for example).

ESP32-CAM Video Web Server Access Point (AP)

In this tutorial, we’ll show you how to set the ESP32 as an access point. As an example, we’ll modify the CameraWebServer project that comes with the Arduino IDE. Then, you should be able to modify any of your projects to set the ESP32-CAM as an access point.

In your Arduino IDE, go to File > Examples > ESP32 > Camera > CameraWebServer.

Then, modify the code to act as an access point as we’ll explain.

Customize the SSID and Password

You need to define an SSID name and a password to access the ESP32-CAM access point. In this example we’re setting the ESP32 SSID name to ESP32-CAM Access Point. You can modify the name to whatever you want. The password is 123456789, but you can and should also modify it.

const char* ssid = "ESP32-CAM Access Point";const char* password = "123456789";

Setting the ESP32-CAM as an Access Point

In the setup(), remove the following lines (set the ESP32 as a station):

WiFi.begin(ssid, password);while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print(".");}Serial.println("");Serial.println("WiFi connected");

And add the following to set the ESP32 as an access point using the softAP() method:

WiFi.softAP(ssid, password);

There are also other optional parameters you can pass to the softAP() method. Here’s all the parameters:

softAP(const char* ssid, const char* password, int channel, int ssid_hidden, int max_connection)
  • ssid (defined earlier): maximum of 63 characters;
  • password (defined earlier): minimum of 8 characters; set to NULL if you want the access point to be open
  • channel: Wi-Fi channel number (1-13)
  • ssid_hidden: (0 = broadcast SSID, 1 = hide SSID)
  • max_connection: maximum simultaneous connected clients (1-4)

This is what you need to include in your web server sketches to set the ESP32-CAM as an access point.

You can download the complete code here.

Connecting to the ESP32-CAM Access Point

After uploading the code, you can connect to the ESP32-CAM access point to access the web server. You don’t need to connect to a router.

In your smartphone open your Wi-Fi settings and tap the ESP32-CAM Access Point network:

ESP32-CAM: Set Access Point (AP) using Arduino IDE | Random Nerd Tutorials (4)

Type the password you’ve defined earlier in the code.

ESP32-CAM: Set Access Point (AP) using Arduino IDE | Random Nerd Tutorials (5)

Open your web browser and type the IP address 192.168.4.1. The video streaming web server page should load:

ESP32-CAM: Set Access Point (AP) using Arduino IDE | Random Nerd Tutorials (6)


To connect to the access point on your computer, go to the Network and Internet Settings, select the “ESP32-Access-Point“ and insert the password.

ESP32-CAM: Set Access Point (AP) using Arduino IDE | Random Nerd Tutorials (7)

And it’s done! Now, to access the ESP32-CAM web server page, you just need to type the IP address 192.168.4.1 in your browser.

Wrapping Up

In this tutorial you’ve learned how to set the ESP32-CAM as an access point in your web server sketches. When the ESP32 is set as an access point, devices with Wi Fi capabilities like your smartphone can connect directly to the ESP without the need to connect to a router.

If you like the ESP32-CAM, take a look at our resources:

  • Build ESP32-CAM Projects using Arduino IDE eBook
  • More ESP32-CAM Projects and Tutorials…

Thanks for reading.

ESP32-CAM: Set Access Point (AP) using Arduino IDE | Random Nerd Tutorials (2024)

FAQs

What is the password for ESP32 AP mode? ›

The password is 123456789, but you can also modify it. // You can customize the SSID name and change the password const char* ssid = "ESP32-Access-Point"; const char* password = "123456789"; What is this?

Why is my ESP32 camera not connecting to Wi-Fi? ›

If your ESP32-CAM AI-Thinker has no Wi-Fi connection or poor connection, it might have the external antenna enabled. If you connect an external antenna to the connector, it should work fine. Check if the jumper 0K resistor by the antenna connector is in the proper position for the desired antenna.

What is the difference between ESP32 and ESP32 CAM? ›

The main difference between the ESP32 and the ESP32-CAM is that the ESP32 is a Wi-Fi and Bluetooth chip with a dual core processor, while the ESP32-CAM is a Wi-Fi and Bluetooth chip with a single core processor and an onboard camera. Additionally, the ESP32-CAM has more memory and storage than the ESP32.

How do I use ESP32 as an access point? ›

Set the ESP32 to Access Point mode (AP)

h> . If the chosen password is less than 8 characters, the compiler will return an error. The password must be at least 8 to 63 characters long. You can then connect to the Wi-Fi network by entering the password.

What is AP mode in ESP32? ›

Working as AP

In this mode, the ESP32 is configured as an Access Point (AP) and it's capable of receiving incoming connections from other devices (stations) by providing a Wi-Fi network. This mode can be used for serving an HTTP or HTTPS server inside the ESP32, for example.

What is the range of ESP32 access point? ›

Typical WiFi range is ~50m-200m depending on the antennas.

Does ESP32 CAM have WiFi? ›

The smallest 802.11b/g/n Wi-Fi BT SoC module. Low power 32-bit CPU, can also serve the application processor. Up to 160MHz clock speed, summary computing power up to 600 DMIPS.

How to connect ESP32 to WiFi without coding? ›

After the development and testing by Makerfabs, the wifi information can be transmitted from the phone to ESP32. Set the working mode of ESP32 to AP mode and build wifi that the phone connects it. And the same time set ESP32 to establish the server that the phone can log in to input the wifi information.

Is ESP32 more powerful than Arduino? ›

Arduino boards typically offer lower processing power compared to ESP32 but are often sufficient for many applications. Similar to a devkit, the easy-to-use layout and a range of built-in components make them great for beginners.

Why ESP32 CAM is best? ›

The ESP32-CAM is a low-cost ESP32 development board with an onboard camera. This is an ideal solution for IoT applications, prototype constructions, and DIY projects. Wi-Fi and low-power BLE are integrated on the board, as well as two high-performance 32-bit LX6 CPUs.

Why ESP32 is better than Raspberry Pi? ›

For example, if I'm creating a simple daylight sensor that will turn off my lights automatically, the Raspberry Pi would work, but its size and cost would make it impractical for this application. In this case, the ESP32 would work better as it is smaller, cost-effective, and can get the job done.

Top Articles
Latest Posts
Article information

Author: Arline Emard IV

Last Updated:

Views: 6635

Rating: 4.1 / 5 (72 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Arline Emard IV

Birthday: 1996-07-10

Address: 8912 Hintz Shore, West Louie, AZ 69363-0747

Phone: +13454700762376

Job: Administration Technician

Hobby: Paintball, Horseback riding, Cycling, Running, Macrame, Playing musical instruments, Soapmaking

Introduction: My name is Arline Emard IV, I am a cheerful, gorgeous, colorful, joyous, excited, super, inquisitive person who loves writing and wants to share my knowledge and understanding with you.