Overview
This is a Getting Started Tutorial with ESP32 CAM Board as well as Video Streaming Over WiFi. The ESP32-CAM is a small camera module with the ESP32-S chip that costs approximately $10. Besides the OV2640 camera and several GPIOs to connect peripherals, it also features a microSD card slot that can be useful to store images taken with the camera.
In this tutorial, we will go through its features, pins description, and the method to program this device using FTDI Module. Also, we will see the beginner guide on setting up Arduino IDE for the ESP32 Camera Module. We will then use the ESP32 CAM basic example code for Video Streaming Over Wifi.
A powerful alternative to ESP32-CAM is Realtek AMB82-Mini IoT AI Camera Board which is fast reliable and secure.
The ESP32 CAM Getting Started Tutorial is very important because we will be doing so many projects using this Module. The project includes Streaming Live Video Online Worldwide, Smart Door Bell or Surveillance cameras. Apart from these, we can also make Face Recognition System based projects for Security Applications as well as Color Detection Project using OpenCV.
Bill of Materials
Following are the list of components for Getting Started with ESP32 CAM Board. You can purchase all the components online from Amazon.
| S.N. | Components | Quantity | Purchase Links |
|---|---|---|---|
| 1 | ESP32-CAM Board AI-Thinker | 1 | Amazon | AliExpress |
| 2 | FTDI Module | 1 | Amazon | AliExpress |
| 3 | Micro-USB Cable | 1 | Amazon | AliExpress |
| 4 | Jumper Wires | 10 | Amazon | AliExpress |
Introducing the ESP32-CAM
The ESP32-CAM is a very small camera module with the ESP32-S chip. The module has an OV2640 camera. It also has several GPIOs to connect peripherals. The ESP32-CAM module is developed by so many manufacturers but the board developed by AI-Thinker is the most popular one.
The controller is based on a 32-bit CPU with a frequency of up to 240MHz. It has a built-in 520 KB SRAM with an external 4M PSRAM. It has a combined 802.11b/g/n Wi-Fi + Bluetooth/BLE SoC module. It supports image WiFI upload and Embedded Lwip and FreeRTOS. There is an onboard voltage regulator IC and a PSRAM Chip.
The board has a single reset button and is breadboard friendly. But if you place the Module on the breadboard, you won’t have access to the Reset button as it’s placed at the bottom. So, it is recommended to use jumper wires while connecting any sensors or modules with the Board. There is an LED on the board that can be used as an indication.
This module has already an antenna attached. But if you want to use an external antenna of better power and better range, you can connect an antenna to the IPEX connector. To use that antenna, you need to connect a jumper or a zero-ohm resistor on the PCB near the Antenna.
OV2460 Camera
The most important part of ESP32 CAM is the Camera Module. The Camera Module that you can use is the OV2640 Camera Module which has a 24 Pin Camera Holder. It has the highest Camera Resolution up to 1600 × 1200.
There is a gold-plated connector strip. Using this connector, you can connect this camera with the ESP32. To connect it, push this slide in opposite direction. And then you will see the pins for connecting the camera. Simply insert the camera marked with a gold plate at the bottom side and then pull this slide. Now the Camera is connected to this module. You are now ready to use this module.
SD Card Support
On the backside, there is an SD Card Holder which supports SD Card up to 4GB. But I found even a 16GB SD Card working fine with this module.
The SD card is used for storing images while making images based projects. For learning, you can use a 4GB SD Card. You can simply slide and insert the SD Card into the SD Card Adapter.
ESP32 CAM GPIO Pins
There are several GPIOs Pins that have support like UART, SPI, I2C, PWM, ADC, and DAC. You can get a 3.3V VCC pin as well as a 5V Pin from this module. There are multiple GND Pins as well.
The following pins are internally connected to the microSD card reader:
GPIO 14: CLK
GPIO 15: CMD
GPIO 2: Data 0
GPIO 4: Data 1 (also connected to the on-board LED)
GPIO 12: Data 2
GPIO 13: Data 3
ESP32-CAM FTDI Connection
For programming the board, you need any USB-to-TTL Converter Module or an FTDI Module. There are so many FTDI Module available based on CP2102 or CP2104 Chip or any other chip.
For getting started with ESP32 CAM Module, make a following connection between FTDI Module and ESP32 CAM module.
| ESP32-CAM | FTDI Programmer |
|---|---|
| GND | GND |
| 5V | VCC (5V) |
| U0R | TX |
| U0T | RX |
| GPIO 0 | GND |
Connect the 5V & GND Pin of ESP32 to 5V & GND of FTDI Module. Similarly, connect the Rx to UOT and Tx to UOR Pin. And the most important thing, you need to short the IO0 and GND Pin together. This is to put the device in programming mode. Once programming is done you can remove it.
Project PCB Gerber File & PCB Ordering Online
If you don’t want to assemble the circuit on a breadboard and you want PCB for the project, then here is the PCB for you. The PCB Board for ESP32 CAM Board is designed using EasyEDA online Circuit Schematics & PCB designing tool. The PCB looks something like below.
The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from ALLPCB at 1$ only.
You can use this Gerber file to order high quality PCB for this project. To do that visit the ALLPCB official website by clicking here: https://www.allpcb.com/.
You can now upload the Gerber File by choosing the Quote Now option. From these options, you can choose the Material Type, Dimensions, Quantity, Thickness, Solder Mask Color and other required parameters.
After filling all details, select your country and shipping method. Finally you can place the order.
You can assemble the components on the PCB Board.
Setting Up ESP32 CAM Board on Arduino IDE
Now, let’s start the ESP32 CAM programming part. For that, open your Arduino IDE. Go to tools. Then select the ESP32 Board. And from the list select AI-Thinker ESP32-CAM.
Then connect the FTDI Module to your Computer and select the COM Port.
Source Code & Getting Started with ESP32 CAM
Go to the files menu and then select examples. From the examples menu, select the ESP32 and then Camera. Then finally open the CameraWebServer Sketch.
So this the example code for Basic Video Streaming. The code is very complicated and has so many files.
You need to modify this code a little bit. Select the Camera Module by uncommenting the model that you are using. If you are using AI-Thinker Board uncomment the AI-Thinker Part and comment rest of the part.
|
1 2 3 4 5 6 7 8 |
//#define CAMERA_MODEL_WROVER_KIT // Has PSRAM //#define CAMERA_MODEL_ESP_EYE // Has PSRAM //#define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM //#define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM //#define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM //#define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM #define CAMERA_MODEL_AI_THINKER // Has PSRAM //#define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM |
You also need to change your WiFi SSID and Password.
|
1 2 |
const char* ssid = "*********"; const char* password = "*********"; |
Now you can upload the code. The code will take more than a minute to compile and upload.
ESP32 CAM Video Streaming Over WiFi
Once code uploads completely, you can open the Serial Monitor. At this instance, if you press the reset button the Serial Monitor will show the device is in downloading mode.
To disable the downloading mode, remove the IO0 GND Jumper from the ESP32 CAM Module. Now again press the reset button. So the device will try connecting to the WiFi Network. Once the device connects to the WiFi, it will display its local IP Address.
Copy this IP Address Link and paste it on your favorite web browsers like Chrome or Mozilla.
So the web page will appear with all the camera settings on the left side. You can go through each setting manually.
At the bottom part you can see there is an option to start streaming, you can click con Start Streaming and see yourself in the video. Maximize the resolution using the Camera Option.
You can move the camera in any direction to see yourself in the video. The Video data is live and you can observe it on the local WebServer always.
There is an option to capture the image as well. The image will be stored on SD Card. Simply click on Get Still.
So this is how you can use ESP32 CAM for Video Streaming & stream the videos online using the local webserver. The advantage of this project is you can use the ESP32 CAM as a surveillance camera. You can place it outside your house and use it as a Security Device. You can also automatically upload ESP32 CAM captured images to Google Drive.


























6 Comments
I want to use ESP32 cam module as live video input in Visual Studio C++. The project is object detection and ESP32 Cam should act as a camera input.
How to do this instead of using webserver for video streaming?
Please help!!!
Looks good. Would it be possible to turn this into a webcam for Skype/Zoom/Teams/Google Meet?
did you get a reply to this question?
I have programmed my ESP32 with the Arduino “example” and it streams while connected to the esp32cam-MD programmer. If I remove the programmer and connect +5V and gnd wires it no longer streams. What’s missing please?
I have the Esp32 working independently of its programmer. Silly mistake sorry.
Where is source code?can u help me