How to Properly Set Up and Run the ESP32-CAM Module Using the Arduino IDE

by sss2022 in Circuits > Cameras

166 Views, 5 Favorites, 0 Comments

How to Properly Set Up and Run the ESP32-CAM Module Using the Arduino IDE

camera_esp32.png

In this project, the main objective is to properly configure and run the ESP32-CAM module using the Arduino IDE.

You will learn how to use the ESP32-CAM (AI Thinker) module to stream live video directly to a web browser, without any additional software.

By using the official CameraWebServer example provided by Espressif, the ESP32-CAM can easily be turned into a Wi-Fi camera accessible from any device on the same network.

Supplies

20260210_140200.jpg
20260210_140213.jpg
20260210_140232.jpg

To complete this project, you will need the following components:

  1. ESP32-CAM (module with OV2640 camera)
  2. ESP32-CAM Expansion Board (to simplify power supply and programming)
  3. USB-A to USB-C cable (good quality, capable of providing stable power)
  4. or USB-C to USB-C cable

⚠️ A poor-quality USB cable may prevent the WiFi and camera from working properly.

Installing ESP32 in Arduino IDE

preferences.png
preferences_esp32.png

1- Open Arduino IDE, then go to File> Preferences

2- Enter the following into the “Additional Board Manager URLs” field:

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

Then, click the “OK” button.

Guide to Set Up ESP32-CAM With Arduino IDE

biblio_esp32_.png
esp32_wrover_module.png
selectboard.png
ai_thinker.png

1- Install the ESP32 Board Package

  1. Open Arduino IDE.
  2. Go to Board Manager: In the search bar, type ESP32 and install “ESP32 by Espressif Systems”.

2- Select a Board to Access Camera Examples

  1. After installation, go to Tools > Board > ESP32 and select ESP32 Wrover Module.
  2. This board selection allows access to the ESP32 camera examples.

3- Open the CameraWebServer Example

  1. Navigate to File > Examples > ESP32 > Camera > CameraWebServer.
  2. Click to open the example.
  3. Important: Camera examples are only visible if an ESP32 board (like Wrover Module) is selected.

4- Change the Board to Match Your Hardware

  1. Go to ESP32 Wrover Module > Select Other Board and Port.
  2. Type AI Thinker in the search bar and select AI Thinker ESP32-CAM.
  3. This step is crucial:
  4. ESP32 Wrover Module → allows opening the CameraWebServer example.
  5. AI Thinker ESP32-CAM → ensures the correct pin configuration for your actual module.

Adjust Settings in Tools for ESP32-CAM

device_manager_.png
port_esp32_cam.png
tools.png

1- Select the Board and Port

  1. On your computer, open the Device Manager to check which COM port your ESP32-CAM board is connected to.
  2. In the Arduino IDE, select the correct Port (e.g., COM4) where your ESP32-CAM is connected.
  3. Make sure Board is set to AI Thinker ESP32-CAM (as shown in your screenshot).

2- Adjust CPU and Flash Settings (optional but recommended)

  1. CPU Frequency: 240MHz (WiFi/BT) → leave as default.
  2. Flash Frequency: 80MHz → leave as default.
  3. Flash Mode: QIO → leave as default.
  4. Partition Scheme: “Huge APP (3MB No OTA / 1MB SPIFFS)” → good for CameraWebServer.

3- Other Useful Options

  1. Erase All Flash Before Sketch Upload: Disabled (can enable if you want a full clean flash).

Program Changes in CameraWebServer

wifi.png
config_esp32_cam.png

1- Enter Your Wi-Fi Credentials

  1. Open the CameraWebServer sketch.
  2. Locate the section for Wi-Fi configuration.
  3. Replace the asterisks with your network info:

const char *ssid = "**********";
const char *password = "**********";

2- Select the Correct Camera Model

  1. Open the board configuration file (usually board_config.h).
  2. Find the camera model definitions.
  3. Comment out the wrong model and uncomment the one for your module:

//#define CAMERA_MODEL_ESP_EYE // Example, leave commented if not used
#define CAMERA_MODEL_AI_THINKER // Has PSRAM
  1. This ensures that the code uses the correct pin configuration for your AI Thinker ESP32-CAM.
  2. Skipping this step can lead to camera not detected errors during compilation or upload.


Upload the Program and Access the Camera Stream

upload_camerawebserver.png
serial_monitor_esp32_cam.png
serial_monitor_wifi.png
camera1.png
camera2.png

1- Upload the Program

  1. Click on the Upload button in Arduino IDE to upload the sketch to the ESP32-CAM.

2- Open the Serial Monitor

  1. Go to Tools > Serial Monitor.
  2. Set the baud rate to 115200.

3- Connect to Wi-Fi

  1. Press the EN button on your ESP32-CAM several times until the board successfully connects to your Wi-Fi network.
  2. In the Serial Monitor, wait until an IP address is displayed.

4- Copy the IP Address

  1. You will see a message like: 'http://192.168.1.65'
  2. Copy this URL (your IP address may be different).

5- Open the Camera Web Interface

  1. Open a web browser (Chrome, Firefox, etc.).
  2. Paste the copied URL and press Enter.

6- Start the Video Stream

  1. Click on the Start Stream button.
  2. At the top of the page, a small window will appear showing live video from your ESP32-CAM.

Video

How to Properly Set Up and Run the ESP32-CAM Module Using the Arduino IDE