ESP 32 Camera Streaming Video Over WiFi |Getting Started With ESP 32 CAM Board

Introduction: ESP 32 Camera Streaming Video Over WiFi |Getting Started With ESP 32 CAM Board

About: I am an engineering student and i just love doing electronic (mcu's) and programming (C,C++,JAVA) based projects.

The ESP32-CAM is a very 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 or to store files to serve to clients.

Step 1: Components Required :

Step 2: Pin Configuration & Features

The smallest 802.11b/g/n Wi-Fi BT SoC moduleLow

power 32-bit CPU,can also serve the application processor

Up to 160MHz clock speed, summary computing power up to 600 DMIPS

Built-in 520 KB SRAM, external 4MPSRAM

Supports UART/SPI/I2C/PWM/ADC/DAC

Support OV2640 and OV7670 cameras, built-in flash lamp

Support image WiFI upload

Support TF cardSupports multiple sleep modes

Embedded Lwip and FreeRTOSSupports STA/AP/STA+AP operation mode

Support Smart Config/AirKiss technology

Support for serial port local and remote firmware upgrades (FOTA)

Pins used for microSD card reader:
GPIO 14: CLKGPIO 15: CMDGPIO 2: Data 0GPIO 4: Data 1 (also connected to the on-board LED)GPIO 12: Data 2GPIO 13: Data 3

Step 3: Install ESP 32 Boards in Arduino IDE

Please refer this video to add ESP32 Boards in Arduino IDE

ESP 32 Boards Link : https://dl.espressif.com/dl/package_esp32_index.json

Step 4: Code

In your Arduino IDE, go to File > Examples > ESP32 > Camera and open the CameraWebServer example.

OR Download the code from here :

https://electronicguru.in/wp-content/uploads/2019/...

Step 5: Schematics for Programming the Board

The ESP32-CAM doesn’t have a USB connector, so you need to use FTDI to upload code through the U0R and U0T pins (serial pins) in ESP32 CAM Board.

Please refer the schematics below

Step 6: Uploading of the Code

Before uploading the code, you need to input your wifi credentials in the following part of code:

const char* ssid = "REPLACE_WITH_YOUR_SSID";

const char* password = "REPLACE_WITH_YOUR_PASSWORD";

and make sure you select the right camera module.

As here we’re using the AI-THINKER Model so select the following So, comment all the other models and uncomment this one:

#define CAMERA_MODEL_AI_THINKER

follow these steps to upload the code : Go to Tools > Board and select ESP32 Wrover ModuleGo to Tools > Port and select the COM port the ESP32 is connected toIn Tools > Partition Scheme, select “Huge APP (3MB No OTA)“Then, click the upload button to upload the code.

Step 7: Getting IP From Serial Monitor

Remove the jumper connected between GPIO0 & GND then,

Open the Serial Monitor with the baud rate : 115200. Press the ESP32-CAM on-board Reset button and wait for the IP to appear and wait for few seconds and then hit reset again.

Step 8: Its Time to Check the Video Stream

Open your browser and make sure your PC is connected to same network as ESP32 CAM and then type the IP and click on stream button and you’ll get similar video stream.

For Detailed Info Please watch the video.

IoT Challenge

Participated in the
IoT Challenge

8 People Made This Project!

Recommendations

  • Lamps Challenge

    Lamps Challenge
  • CNC and 3D Printing Contest

    CNC and 3D Printing Contest
  • Rice & Grains Challenge

    Rice & Grains Challenge

27 Comments

0
Al514
Al514

Question 1 year ago on Introduction

Hello, im getting an error about having multiple WiFi libraries, is it necessary to uninstall other Arduino Wifi libraries to use the ESP 32 Camera WebServer? I have used the ESP32 with its IP address for other tasks, ie, turning LEDs on/off etc. But with the Camera Code im getting a Compiling Error, Multiple Libraries were found for "Wifi.h". Im not sure how to resolve this issue in a simple manner. Thanks much.

0
Al514
Al514

Answer 1 year ago

Nevermind, Got it working easy. Its a slow video response on Wifi though

0
Andrew Hannay
Andrew Hannay

Reply 3 months ago

How did you fix the multiple libraries for Wifi.h?

0
d.frasier0951
d.frasier0951

1 year ago on Step 7

I've completed allthese task to the ESP32S-CAM. However,the IP address never comes up. I;ve tried everything except add a capacitor to the board. I know all about the power, wire;s ect... But what do you do when NOTHING works.... Im including a copy of the code I'm getting without any IP address ever showing up.... Please, Please, Please, help me with this, and yes everone is still having the same issue's. Something has to change....

Writing at 0x001a4000... (100 %)
Wrote 2100784 bytes (1661757 compressed) at 0x00010000 in 150.1 seconds (effective 112.0 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 119...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (119 compressed) at 0x00008000 in 0.0 seconds (effective 1536.0 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...

0
Al514
Al514

Reply 1 year ago

Try using the simple LED on/off code with the ESP32, you can get the IP address with the Serial Monitor very easy that way. The camera is a different issue, Im having trouble with it as well, but atleast this way you'll know you have the correct IP address for the board.

0
doumbefritz73
doumbefritz73

Question 1 year ago

bonjour sil vous plaît quand jentres dans le gestionnaire de carte de arduino lesp32 ny est pas comment faire pour l'ajouter en tant que carte ?
Doumbefritz73@gmail.com

0
Rafeul
Rafeul

Question 1 year ago

Device not connecting hotspot and not providing any data on serial monitor

0
Suchitra ns
Suchitra ns

Question 1 year ago

Configuring flash size...
Warning: Could not auto-detect Flash size (FlashID=0x0, SizeID=0x0), defaulting to 4MB
Compressed 8192 bytes to 47...
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 4096.0 kbit/s)...
A fatal error occurred: Timed out waiting for packet header
A fatal error occurred: Timed out waiting for packet header



please help me i am getting this error

0
NaveenK200
NaveenK200

Question 1 year ago

.
WiFi connected
Starting web server on port: '80'
Starting stream server on port: '81'
Camera Ready! Use 'http://192.168.0.112' to connect


I got the IP , but when i load the url, it shows nthng, url is not working

0
dmiba
dmiba

Question 3 years ago on Step 8

I have problem with streaming. I have tried URL: http://esp_ip:81 but there is no stream. Camera URL http://esp_ip works OK with menu. How could I stream video from esp32 camera?

0
mmorlan62
mmorlan62

Answer 1 year ago

If you look near the bottom of the app_httpd.cpp file included with the Arduino code, you will find a void startCameraServer() function. Inside that is a list of each of the URLs to view and control your ESP. It appears that http://esp_ip:81/stream will show a full-frame stream.

0
markshancock
markshancock

Answer 3 years ago

Hook the ESP-32 to USB and then open up the Arduino Serial console. The app will usual provide connection information out the serial port.

0
MattiV
MattiV

2 years ago

not working i has do manytime same what all instruction have but error alltime, Arduino: 1.8.13 (Windows 7), Board: "ESP32 Wrover Module, Huge APP (3MB No OTA), QIO, 80MHz, 921600, None"
sketch\app_httpd.cpp: In function 'esp_err_t capture_handler(httpd_req_t*)':
app_httpd.cpp:286:25: error: 'box_array_t {aka struct tag_box_list}' has no member named 'score'
free(net_boxes->score);

sketch\app_httpd.cpp: In function 'void startCameraServer()':

app_httpd.cpp:632:17: error: 'struct mtmn_config_t' has no member named 'type'

mtmn_config.type = FAST;

app_httpd.cpp:632:24: error: 'FAST' was not declared in this scope

mtmn_config.type = FAST;

app_httpd.cpp:635:17: error: 'struct mtmn_config_t' has no member named 'pyramid_times'

mtmn_config.pyramid_times = 4;

Multiple libraries were found for "WiFi.h"

Used: C:\Users\masawee\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.2\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFipois
exit status 1
'box_array_t {aka struct tag_box_list}' has no member named 'score'



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

0
benoitmorrissette
benoitmorrissette

2 years ago

It works fine on the first try, thank you. Where can i find the displayed web page (the html file) please?

0
KevinG309
KevinG309

2 years ago

The frame rate for me is really low. Have I configured the ESP32 incorrectly?
I'll check on the serial port, but at SVGA I'm only getting 1-2 frames per second.

0
firdoshdiakus26
firdoshdiakus26

Reply 2 years ago

Make sure you use a good psu 5v 2 amps and use an external antenna. This way I get between 8 and 10 frames/s on SVGA

1
cjanner
cjanner

2 years ago

I received the following error:
[E][camera.c:1049] camera_probe(): Detected camera not supported.
[E][camera.c:1249] esp_camera_init(): Camera probe failed with error 0x20004

After switch from 3.3V to 5V it worked.

2
PedroA64
PedroA64

2 years ago


What type of battery could you use with this camera and what voltage and amperage does it contain?

0
bcs111cc
bcs111cc

Question 2 years ago on Step 8

Sir! Please tell me the distance that wifi covers and still connected and support streaming on pc.