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

4 People Made This Project!

Recommendations

  • Pocket-Sized Speed Challenge

    Pocket-Sized Speed Challenge
  • Super-Size Speed Challenge

    Super-Size Speed Challenge
  • Audio Challenge 2020

    Audio Challenge 2020

17 Discussions

0
MattiV
MattiV

10 days 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

5 months 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

3 months 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 7 weeks 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

0
cjanner
cjanner

3 months 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.

1
PedroA64
PedroA64

4 months ago


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

0
bcs111cc
bcs111cc

Question 4 months ago on Step 8

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

1
dr_sollo
dr_sollo

5 months ago

Hi! How to set default resolution for video (e.g. 800x600) at the start of ESP32 ?

0
doug.crawford.1253
doug.crawford.1253

7 months ago

My sketch looks good and camera is ready .. but still fighting the issue not having an IP address .. I have tried including a static IP and still have no luck .. here is a copy from my serial monitor: ANY IDEAS what I can do to solve this issue?

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
WiFi connected
Starting web server on port: '80'
Starting stream server on port: '81'
Camera Ready! Use 'http://0.0.0.0' to connect

0
claudiasmith2881
claudiasmith2881

Reply 6 months ago

The following forum is explanatory and commendable.I have an issue with streaming in my Arlo pro 2 and I am unable to check the ARP tables to cross the reference Mac and the IP addresses.I have tried out the following functions https://netgears.support/arlo-security-camera/.Guide us what to do next?

0
shariq azim
shariq azim

Question 8 months ago

Can we use it without esp board? Or board is absolutely required..
Also how to connect to a local wifi network please explain?

0
dmiba
dmiba

Question 11 months 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
markshancock
markshancock

Answer 9 months 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
pradeepv16
pradeepv16

Question 11 months ago on Introduction

can this device serve as an access point and stream video directly through RTSP to the android phone without the need for network connectivity? if possible please help me with my project !

0
markshancock
markshancock

Answer 9 months ago

The ESP32-CAM can do whatever you code it to do. It is a camera connected to a processor (w/ a 2.4GHz radio). The one I purchased recently came loaded with code that creates an open WiFi access point and streams video to it. Now I just have to find the source for that code.

0
OwenC31
OwenC31

10 months ago

Same issue as @dmiba

EDIT: I had four boards, the first two I tried both failed, the next two worked (after I wrote this). So my comment that maybe it was the boards turned out correct.
Appears to be defective OV2640 units, one gave a single frame and died, the other didn't even do that. Swapping them between the ESP-CAM boards makes the problem move with the camera from board to board; so it is v.cheap/counterfeit camera modules causing the problem.

It is, however, exaggerated by the ESP libraries hanging (rather than exiting with an error) for this particular hardware condition, leading me to incorrectly think the network etc might be at fault.

-- IGNORE -- ORIGINAL:
My board is correctly jumpered for the PCB antenna, not the external one (a common 'intermittent wifi' issue on these boards, worth googling for and double-checking)

I can reload the index.html from port 80 fine; downloading on the commandline with curl also works. So the webserver is up and running and responding.
Similarly port 81 is open; and I get a 404 if I try to visit the base URL there. I f I try to visit a image capture URL I get the same.
But on Port :81/stream ; the response simply hangs.
After a few failed connection attempts port 81 closes; I'm guessing it's out of connections.

Anyway..
EDIT: NOT TRUE.. I'm using latest ESP board package on the working units I have:
From what I can tell the example sketch no longer works, and the latest ESP board libraries (1.02) seem to be the culprit; there are a number of discussions on other projects that re-use the example which have turned into a morass of people reporting issues like this, and then reporting issues with broken IDE (*).

Alternatively my board is too cheap, and broke after a single frame. Not inconcievable; it was 6Euros including shipping.

(*) Downgrading is not as easy as the Board manager makes it appear, the ESP hardware definitions in the IDE's appdata structure break and have to be deleted then the board package reinstalled via the GUI. I just went through that loop and it was not fun.