We will learn in this project how to make a video streaming web server with ESP32-CAM. More ESP32-CAM projects you can find here.
Tag: Project 136b How to make a video streaming web server with ESP32-CAM AI-Thinker
- Libraries used: None
- Code: sketch
In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):
1. ESP32-CAM Development Board with camera 1 set
2. Arduino IDE ( you can download it from here )
3. USB to TTL/Serial adaptor/converter 1 pc
4. Jumper cables F-F
5. Micro SD card and SD card adapter 1 pc
6. WiFi Antenna, Compact Internal WiFi Antenna with U.FL connector and 5.9 inch cable 1 pc (optional)
Understanding the USB to TTL converter
You can read more about them here.
Understanding the ESP32-CAM Development Board with camera
You can read more about it here.
You can find the ESP32-CAM schematic here, ESP32-CAM development board specification is here, camera specification is here.
Signals and connections of the ESP32-CAM Development Board with camera
- GND – ground pin. Connected to Arduino board GND pin.
- 5V – external power supply pin 5VDC 2A
- VCC – power supply pin. Connected to 5V pin.
- 3V3 – power supply pin. Connected to 3V3 pin.
- U0TXD, U0RXD – Serial pins. You need these pins to upload code to your board.
- GPIO 0 – pin which determines whether the ESP32 is in flashing mode or not. When GPIO 0 connected to GND, the ESP32-CAM is in flashing mode.
The following pins are internally connected to the Micro SD 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 module FTDI programmer
U0TXD (GPIO1) RXI
U0RXD (GPIO3) TX0
GND and GPIO0 (for flashing only)
Step by Step instruction
We assume that you have the latest version the Arduino IDE and ESP32 add on installed in your Arduino IDE. You can read how to do it here – Basics: Project 137 Installing the ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux). You can download the latest Arduino IDE version Windows Installer here. We are using PC with Windows 7 64 bit OS.
2.Uploading the code to ESP32-CAM
1.Do wiring. Very important: GPIO 0 (IO 0) must be connected to GND otherwise you will not be able to upload code.
2. Attach WiFi antenna (optional). It will help you to increase WiFi range.
3.Attach OV2640 camera.
4.Plug your FTDI programmer into your PC USB port.
5.Open Arduino IDE.
6.Go to Tools -> Board… -> ESP32 Arduino ->and select AI Thinker ESP32-CAM. Make sure you select the right camera module. In this project we use the AI-THINKER ESP32-CAM Development Board with camera.
7.Go to Tools -> Port and select the COM port the ESP32-CAM Development Board connected to (we have COM3).
6. Open this sketch in your Arduino IDE, modify with your local network data (ssid and password).
8.Click the upload button in Arduino IDE to upload the sketch. When you see Uploading… message press the ESP32-CAM Development Board on-board RST (RESET) button to restart your ESP32 in flashing mode.
9.When uploading completed disconnect GPIO 0 from GND.
10.Open the Serial Monitor of Arduino IDE (Tools -> Serial Monitor) at the baud rate of 115200. Press the ESP32-CAM Development board on-board RST (RESET) button.
11.The ESP32-CAM Development board IP address should be printed in the Serial Monitor (We have 192.168.0.113).
12.You can access your camera streaming server on your local network. Open any internet browser (IE,Google Chrome,..) (We used Google Chrome) and type the ESP32-CAM Development board IP address (we have http://192.168.0.113).
13. That’s it. You are ready for next project with ESP32-CAM now.
If you don’t follow the previous instructions exactly, you may get the following errors:
1.Failed to connect to ESP32: Timed out waiting for packet header.
This error means that the ESP32-CAM is not in flashing mode or it is not connected properly to the FTDI programmer.
2. Brownout detector or Guru meditation error.
When you open your Arduino IDE Serial Monitor and the error message “Brownout detector was triggered” is constantly being printed over and over again. It means that there’s some sort of hardware problem.
It’s often related to one of the following issues:
- Poor quality USB cable;
- USB cable is too long;
- Board with some defect (bad solder joints);
- Bad computer USB port;
- Or not enough power provided by the computer USB port.
- Try a different shorter USB cable (with data wires);
- Use a different computer USB port or use a USB hub with an external power supply;
- Try to power the ESP32-CAM with 5V instead 3.3V.
3.Board at COMX is not available – COM Port not selected.
It means that you haven’t selected the COM port in the Tools menu. In your Arduino IDE, go to Tools -> Port and select the COM port the ESP32-CAM connected to.
It might also mean that the ESP32-CAM is not establishing a serial connection with your computer or it is not properly connected to the USB connector.
For a more extensive list of the most common problems with the ESP32-CAM and how to fix them, check out in our Basics: Project 084d ESP32-CAM Development Board with camera – Troubleshooting
Before uploading the code, you need to insert your local network credentials in the following variables:const char* ssid = “yourSSIDhere”;const char* password = “yourPasswordHere”;
We have learnt in this project how to make a video streaming web server with ESP32-CAM.
How to set Access Point (AP) for web server with ESP32-CAM AI-Thinker
How to set static IP address for ESP32-CAM AI-Thinker
How to take and send photos via email with ESP32-CAM