ESP32-CAM Video Streaming and Face Recognition with Arduino IDE

This article is a quick getting started guide for the ESP32-CAM board. We’ll show you how to setup a video streaming web server with face recognition and detection in less than 5 minutes with Arduino IDE.

Note: in this tutorial we use the example from the arduino-esp32 library. This tutorial doesn’t cover how to modify the example.

Related project: ESP32-CAM Video Streaming Web Server (works with Home Assistant and Node-Red)

Watch the Video Tutorial

You can watch the video tutorial or keep reading this page for the written instructions.

Parts Required

To follow this tutorial you need the following components:

You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!

Introducing the ESP32-CAM

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.

The ESP32-CAM doesn’t come with a USB connector, so you need an FTDI programmer to upload code through the U0R and U0T pins (serial pins).

Features

Here is a list with the ESP32-CAM features:

  • The smallest 802.11b/g/n Wi-Fi BT SoC module
  • Low 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 card
  • Supports multiple sleep modes
  • Embedded Lwip and FreeRTOS
  • Supports STA/AP/STA+AP operation mode
  • Support Smart Config/AirKiss technology
  • Support for serial port local and remote firmware upgrades (FOTA)

ESP32-CAM Pinout

The following figure shows the ESP32-CAM pinout (AI-Thinker module).

There are three GND pins and two pins for power: either 3.3V or 5V.

GPIO 1 and GPIO 3 are the serial pins. You need these pins to upload code to your board. Additionally, GPIO 0 also plays an important role, since it determines whether the ESP32 is in flashing mode or not. When GPIO 0 is connected to GND, the ESP32 is in flashing mode.

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

Video Streaming Server

Follow the next steps to build a video streaming web server with the ESP32-CAM that you can access on your local network.

1. Install the ESP32 add-on

In this example, we use Arduino IDE to program the ESP32-CAM board. So, you need to have Arduino IDE installed as well as the ESP32 add-on. Follow one of the next tutorials to install the ESP32 add-on, if you haven’t already:

2. CameraWebServer Example Code

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

The following code should load.

If you can’t find the code in your Arduino IDE, you can download it from our GitHub repository. After downloading, unzip the folder, and open the CameraWebServer.ino file.

Before uploading the code, you need to insert your network credentials in the following variables:

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

Then, make sure you select the right camera module. In this case, we’re using the AI-THINKER Model.

So, comment all the other models and uncomment this one:

#define CAMERA_MODEL_AI_THINKER

Now, the code is ready to be uploaded to your ESP32

ESP32-CAM Upload Code

Connect the ESP32-CAM board to your computer using an FTDI programmer. Follow the next schematic diagram:

Important: GPIO 0 needs to be connected to GND so that you’re able to upload code.

To upload the code, follow the next steps:

  1. Go to Tools > Board and select ESP32 Wrover Module
  2. Go to Tools > Port and select the COM port the ESP32 is connected to
  3. In Tools > Partition Scheme, select “Huge APP (3MB No OTA)
  4. Press the ESP32-CAM on-board RESET button
  5. Then, click the upload button to upload the code.

Important: if you can’t upload the code, double-check that GPIO 0 is connected to GND and that you selected the right settings in the Tools menu. You should also press the on-board Reset button to restart your ESP32 in flashing mode.

Getting the IP address

After uploading the code, disconnect GPIO 0 from GND.

Open the Serial Monitor at a baud rate of 115200. Press the ESP32-CAM on-board Reset button.

The ESP32 IP address should be printed in the Serial Monitor.

Accessing the Video Streaming Server

Now, you can access your camera streaming server on your local network. Open a browser and type the ESP32-CAM IP address. Press the Start Streaming button to start video streaming.

You also have the option to take photos by clicking the Get Still button. Unfortunately, this example doesn’t save the photos, but you can modify it to use the on board microSD Card to store the captured photos.

There are also several camera settings that you can play with to adjust the image settings.

Finally, you can do face recognition and detection.

First, you need to enroll a new face. It will make several attempts to save the face. After enrolling a new user, it should detect the face later on (subject 0).

And that’s it. Now you have your video streaming web server up and running with face detection and recognition with the example from the library.

Troubleshooting

If you’re getting any of the following errors, read our ESP32-CAM Troubleshooting Guide: Most Common Problems Fixed

  • Failed to connect to ESP32: Timed out waiting for packet header
  • Camera init failed with error 0x20001 or similar
  • Brownout detector or Guru meditation error
  • Sketch too big error – Wrong partition scheme selected
  • Board at COMX is not available – COM Port Not Selected
  • Psram error: GPIO isr service is not installed
  • Weak Wi-Fi Signal
  • No IP Address in Arduino IDE Serial Monitor
  • Can’t open web server
  • The image lags/shows lots of latency

Wrapping Up

The ESP32-CAM provides an inexpensive way to build more advanced home automation projects that feature video, taking photos, and face recognition.

In this tutorial we’ve tested the CameraWebServer example to test the camera functionalities. Now, the idea is to modify the example or write a completely new code to build other projects. For example, take photos and save them to the microSD card when motion is detected, integrate video streaming in your home automation platform (like Node-RED or Home Assistant), and much more.

We hope you’ve find this tutorial useful. If you don’t have an ESP32-CAM yet, you can grab it here.

If you like this project, you may also like other projects about cameras:

Learn more about ESP32: Learn ESP32 with Arduino IDE (video course and ebook).


Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »

Learn how to program and build projects with the ESP32 and ESP8266 using MicroPython firmware DOWNLOAD »


Enjoyed this project? Stay updated by subscribing our weekly newsletter!

103 thoughts on “ESP32-CAM Video Streaming and Face Recognition with Arduino IDE”

  1. TF card 4GB limit. Will larger capacity cards, i.e. 8GB work, but only 4GB will be usable? Smaller cards are getting harder to find. FAT-16 format required?

    • Hi Bruce.
      I haven’t tested with 8GB sd cards. I’ll need to check if those work too.
      It needs to beet FAT-32 format.
      Regards,
      Sara

  2. Thanks very much for this ESP32-CAM project, I am looking forward to learning the camera applications, it is my first.
    Unfortunatly I am getting the following error returned to the serial monitor after reset:

    SCCB_Write [ff]=01 failed
    SCCB_Write [12]=80 failed
    [E][camera.c:1085] esp_camera_init(): Camera probe failed with error 0x20001
    Camera init failed with error 0x20001

    I have updated the arduino IDE to 1.8.9 and ESP32 boards as per instructions, but cant find the problem. If you have any ideas I really appriecate it.

    • Hi James.
      Did you select the right camera module in the code?
      Please double check that your camera is well connected to the board.
      I also found this issue: github.com/espressif/esp32-camera/issues/5
      It seems the same as yours, so it might help.
      Regards,
      Sara

      • Hi Dan, yes I took Sara’s advice and selected the correct camera module in the code but commenting out the ones that don’t apply. I did also find reducing the upload speed made things more stable. I think my programmer is not the best.
        Very happy it works very well. Thanks again

  3. Any update on card sizes??? Brand name 4 GB cards are special order. When I find 4GB they are almost as expensive as 16/32GB sizes. Ebay takes forever anymore, and then you don’t know what you are getting. No name brand on Ali Express or Banggood.

  4. Hi. Great tutorial; worked like a charm once used a separate 5V supply.

    Any way you know of to see the video stream or stills via a TFT display on another ESP through web browser or otherwise? I’ve used ESPNow between ESP12’s or 32’s for display of thermal cam images but they’re much smaller. Avoids need for phone or laptop tied up….
    Thanks
    Mel

  5. Hi, thanks for the tutorial, but I’m getting 2 problems with the code :

    1. I can’t include the zip file through “Add .ZIP library” from Arduino IDE

    2. When I put it manually through extracting the zip file and moved it to my Arduino libraries folder, then compile the code, I got “no headers files (.h) found” error

    Any help would be appreciated, thanks again for the tutorial.

    • Hi Mario.
      You don’t need to install any library. You just need to have the ESP32 add-on installed.
      The zip file that we provide contains all the code that you need.
      You just need to unzip the file, open the CameraWebServer folder and open the CameraWebServer.ino.
      Your arduino IDE should open the code and you’ll see three tabs at the top. Then, you just need to upload the code to your board.
      Alternatively, if you have the latest updated ESP32 add-on, you should have the code in your examples. Go to File > Examples > ESP32 > Camera and open the CameraWebServer example.
      I hope this helps.
      Regards,
      Sara

  6. I was looking for something like this for my recent project, Thanks! Great tutorial! But I think ESP32-CAM is “unofficial” combination of ESP32 with a camera. I think Espressif themselves released a dedicated “official” ESP32+camera board called ESP-EYE with their own “official” software library called ESP-WHO.

    Well I got all the information from here: https://www.ebay.com/itm/254177708782

    Have not tried that board myself. Can you make a tutorial on that as well since that is the “official” hardware and software and would have longer support from Espressif itself.

    Also a comparison between the 2 would be great too.

    I follow a lot of Random Nerd Tutorials. You guys make easy to follow guides. Cheers! Keep it up!

    Thanks!

    • Hi Ryan.
      Thank you for your nice words.
      The ESP-EYE is an Espressif release.
      We haven’t fully tested the ESP-EYE yet. We’ve played with the example firmware that they provide and we made a blog post about it that you can read here: https://makeradvisor.com/esp-eye-new-esp32-based-board/
      At the moment, we don’t have any more tutorials with the ESP-EYE.
      Thank you for your interest in our content.
      Regards,
      Sara

  7. Brownout detector was triggered

    ets Jun 8 2016 00:22:57

    rst:0xc (SW_CPU_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:1100
    load:0x40078000,len:10088
    load:0x40080400,len:6380
    entry 0x400806a4

    What happened? ¿Qué ocurre? Thx

  8. Greetings and congratulations for the tutorial. You are a very nice couple.
    Is it possible to take this captured image to a server on the internet?
    Can I have this camera in my house and see what happens from my work?

    Thank you.

  9. Hi Rui & Sarah,
    How do you set up face recognition ?
    I have the whole thing working as expected, however the Enroll face button does nothing ?

  10. Hi Guys,
    I purchased two units and both fail with the following:

    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:1100
    load:0x40078000,len:10088
    load:0x40080400,len:6380
    entry 0x400806a4
    [D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled

    [E][camera.c:1085] esp_camera_init(): Camera probe failed with error 0x20001
    Camera init failed with error 0x20001
    I’ve selected AI Thinker in the code and reduced the upload to 115200. Anyone have some insights? I have a M5Stack Camera which works pretty well with the code but these two are dead.
    Thanks
    Dan

  11. Hi! good tutorial!, I need to put the upload speed 115200 and the flash frequency in 40Mhz to avoid a Guru Meditation Error: Core 0 panic’ed (InstrFetchProhibited) error if someone have the same problem 🙂

  12. I am having problems getting errors: camera_probe(): Detected camera not supported.
    esp_camera_init(): Camera probe failed with error 0x20003.

    That occurs selecting AI Thinker. The other two options give me the 0x20001 error. I bought the esp camera from DIYMORE.CC. The description in their ad prints AI Thinker on the chip, but my actual device does not have AI Thinker printed. It just has DM-ESP32-S.

    Any ideas?

    • Did you find a solution or the correct IDE setting for your DM ESP32?
      I have the same modules but haven’t used them yet.
      I’d appreciate your input.

  13. Thanks Great Job
    But i have almost the same problem as Neil.
    face recognition works very bad i get almost no yellow square
    how to ficks that?

    • Hi.
      Face recognition is a bit slow, however we managed to make it work fine.
      Please make sure that you have proper lighting to make the face recognition process easier and more efficient. Also, when enrolling a new face, you need to be steady and don’t move much, so that it properly saves your face features and can recognize it in the future.
      Regards,
      Sara

  14. Hi,
    Got my hardware last week from banggood. It had the issue “Brownout detector was triggered”. Seaching the web i found this video where they say to feed by 5v not 3.3v.
    https://www.youtube.com/watch?v=tzmcXZ-irIc ~2:30
    This solved the brownout issue for me.
    Then the web service did not appear in google chrome browser. Error message was something about too much header lines or so. In MS Edge it was ok. But i have no image from the cam. Cam must be broken. So i have to wait another month to get this as spare part. Have also ordered another ESP board with an external antenna hoping to get better connection to the router.

    • Hi Patrick.
      I’m sorry you’re getting trouble using your ESP32-CAM.
      The brownout detector error usually means that the ESP32 is not being powered properly. You can read more about this on our troubleshooting guide, bullet 8: https://randomnerdtutorials.com/esp32-troubleshooting-guide/
      Our camera worked flawlessly following the steps we describe in our tutorial.
      The ESP32-CAM should work fine being powered either with 3.3V through the 3.3V pin or 5V through the 5V pin. You’re probably not providing enough current.
      Also, we didn’t have any trouble accessing the web server on Google Chrome.
      After you get a new camera, let us know how it went.
      Regards,
      Sara

  15. Any ideas what would cause a 20003 error? I have tried all three camera types. The AI Thinker gives 20003. The other two cause a 20001 error

    • Hi John.
      I’m sorry you’re having that issue.
      Those errors usually mean that the camera is not properly connected. So, or your camera module is faulty or it is not properly connected.
      If these are not the reasons, it is very difficult for us to understand what is going on.
      Can you try using a new camera probe?
      Regards,
      Sara

  16. Thanks. The camera came installed. I bought 2 of them, and they both fail. I decided to buy from another source and see if that works.

    I am not sure what you are referring to regarding a new camera probe.

  17. Dear ALL

    ESP32 doesn´t connect with mit Network and no text in Serial Monitor is being printed. SID and PW changed in coding. Any Ideas?
    Message in Arduino 1.8.8:

    Der Sketch verwendet 2233514 Bytes (71%) des Programmspeicherplatzes. Das Maximum sind 3145728 Bytes.
    Globale Variablen verwenden 50692 Bytes (15%) des dynamischen Speichers, 276988 Bytes für lokale Variablen verbleiben. Das Maximum sind 327680 Bytes.
    esptool.py v2.6-beta1
    Serial port COM9
    Connecting…….
    Chip is ESP32D0WDQ6 (revision 1)
    Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
    MAC: cc:50:e3:b6:e5:90
    Uploading stub…
    Running stub…
    Stub running…
    Configuring flash size…
    Auto-detected Flash size: 4MB
    Compressed 8192 bytes to 47…

    Writing at 0x0000e000… (100 %)
    Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 4096.1 kbit/s)…
    Hash of data verified.
    Compressed 17664 bytes to 11528…

    Writing at 0x00001000… (100 %)
    Wrote 17664 bytes (11528 compressed) at 0x00001000 in 1.0 seconds (effective 138.4 kbit/s)…
    Hash of data verified.
    Compressed 2233680 bytes to 1788374…

    Wrote 2233680 bytes (1788374 compressed) at 0x00010000 in 158.5 seconds (effective 112.7 kbit/s)…
    Hash of data verified.
    Compressed 3072 bytes to 134…

    Writing at 0x00008000… (100 %)
    Wrote 3072 bytes (134 compressed) at 0x00008000 in 0.0 seconds (effective 768.0 kbit/s)…
    Hash of data verified.

    Leaving…
    Hard resetting via RTS pin…

    • Hi.
      It seems that your code was uploaded successfully.
      Make sure you open the serial monitor at a baud rate of 115200, so that you can see the text on the serial monitor.
      After uploading the code, you should disconnect GPIO from GND. Open the Serial monitor, and then press the ESP on-board reset button.
      Please make sure you’ve inserted the right network credentials.
      Can you access the web server when you insert the IP address on your browser?
      Regards,
      Sara

  18. Dear Sara,
    may I ask you please to advise on the issue below.
    I purchased an AI Thinker, but it is not printed on the chip.
    This product contains the OV2640 Camera Module.

    Can you please advise on which Camera Model to use?
    The use of #define CAMERA_MODEL_AI_THINKER refers to the error. Also the other led to issues.

    Thanks

    Brownout detector was triggered

    ets Jun 8 2016 00:22:57

    rst:0xc (SW_CPU_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:1100
    load:0x40078000,len:9232
    load:0x40080400,len:6400
    entry 0x400806a8

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

  19. Thank you very much for sharing. Using M5STACKcam I didn’t had image. After troubleshooting and comparing with other codes I changed setting for Y2_GPIO_NUM to 17. Now it works like a sharm 🙂 using ESP32 DevModule with Huge APP for partition scheme.

  20. I faced different problems getting the module working. Since I am using the 5V-supply pin (instead of the 3.3V on the CAMERA_MODEL_AI_THINKER) everything is OK.

  21. Hi . I have an esp32-cam and i went throught all the process to program the board and everything was going fine . At the end i’ve got the message telling me the ip adress to connect my board so i did in my browser and i ‘ve got the viewer that appeared in the screen but but when i press start stream or get still i don’t have any image on the screen !

    I tried with 2 boards and still the same problem . The only things in common is the software …

    Any idea ?

    Thanks .

    • Hello Patrick, unfortunately I can’t replicate that error on my end… The default CameraWebServer scripts works fine for me out of the box.
      Regards,
      Rui

    • Patrick,

      I have the same problem. After I hit the “Start Stream” button, no image shown on the screen.

      Have you resolved the problem ?

      Regards,
      Ong Kheok Chin

  22. Hi, i’m stuck right at the beginning with Arduino IDE 1.8.9 I have to select the board before i see any ESP32 examples – chose ESP32 Wrover module, however examples do not include Camera – any ideas? Thanks

  23. Nice tutorial, everything worked. Could you please show us how we can broadcast the video stream to the internet (so that we can see the video from any computer)? Maybe using port forwarding of the ESP32-cam or using a dedicated service? It would also be great to have an example working offline to record the video on a SD card (I haven’t managed to do that). Thanks!

    • Hi Oli.
      At the moment, we don’t have any tutorial about that subject.
      We’ve also been trying to use the SD card to save photos and record video, but at the moment, without success.
      Regards,
      Sara

  24. Howdy Folks,

    I am getting this major bug in my serial monitor after disconnecting the GPIO0 cable and resetting it:

    Brownout detector was triggered

    ets Jun 8 2016 00:22:57

    rst:0xc (SW_CPU_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:1100
    load:0x40078000,len:9232
    load:0x40080400,len:6400
    entry 0x400806a8
    Guru Meditation Error: Core 0 panic’ed (LoadProhibited). Exception was unhandled.
    Core 0 register dump:
    PC : 0x4012fea1 PS : 0x00060031 A0 : 0xca400000 A1 : 0x3ffe3ac0
    A2 : 0x3ffaff7c A3 : 0x00000080 A4 : 0x3ffbf0ec A5 : 0x40090858
    A6 : 0x02ffffff A7 : 0x00000c00 A8 : 0x4008f290 A9 : 0x3ffe3a90
    A10 : 0x3ffbf0ec A11 : 0x000000fe A12 : 0x00000001 A13 : 0x00000000
    A14 : 0x00000000 A15 : 0x00000000 SAR : 0x0000001d EXCCAUSE: 0x0000001c
    EXCVADDR: 0x03000283 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff

    Backtrace: 0x4012fea1:0x3ffe3ac0 0x4a3ffffd:0x3ffe3ae0 0x400dea6d:0x3ffe3ba0 0x400de992:0x3ffe3bc0 0x40083ec3:0x3ffe3bf0 0x400840f4:0x3ffe3c20 0x40078f2b:0x3ffe3c40 0x40078f91:0x3ffe3c70 0x40078f9c:0x3ffe3ca0 0x40079165:0x3ffe3cc0 0x400806da:0x3ffe3df0 0x40007c31:0x3ffe3eb0 0x4000073d:0x3ffe3f20

    Rebooting…
    unhandled.

    Guru Meditation Error: Core 0 panic’ed (StoreProhibited). Exception was unhandled. {Note that are about 60 of these in my Log}

    Guru Meditation E⸮ets Jun 8 2016 00:22:57

    rst:0x7 (TG0WDT_SYS_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:1100
    load:0x40078000,len:9232
    load:0x40080400,len:6400
    entry 0x400806a8

    Any Ideas?

    • Hello Kurt, here’s what the error: “Brownout detector was triggered” means:

      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.

      Solution: try a different shorter USB cable (with data wires), try a different computer USB port or use a USB hub with an external power supply.

      • Rui, I am using a USB CH340 and also a USB FTDI serial boards that connect directly to a Computer USB port, there are no cables, other than the Jumper wires. I have tried this on 3 different computers and about 3 to 4 USB ports on each one. I have also tested 2 CAM boards with the exact same results.

        The Brownout is the only thing listed on my previous post, there’s also the:

        “Guru Meditation Error: Core 0 panic’ed (StoreProhibited). Exception was unhandled. {Note that are about 60 of these in my Log}”
        Which spawn 60 TO 100 Messages before it Reboots.

        • Hi.
          Some of our readers reported that when they power the ESP32-CAM with 5V, they don’t have the brownout error or guru meditation error anymore.
          Regards,
          Sara

          • When I powered either one of them with 5V through the USB Serial dongle the LED on the ESP board lights up and stays on, while the Serial monitor shows nothing.

  25. HI all,
    I purchased a ESP32-Cam. I have had a lot of problems trying to get it to work.
    I could nbot get the sketch to upload and a couple of other small issues.
    What I found was (
    Its all to do with the voltages…..
    and the pin configuration is different on my usb-TTl compared to the pics on the web. ) –
    1. Set the usb-TTl to 3.3V.
    2. connect it to the ESP32-CAM as shown in all the diagrams, (but put the 3.3V from the usb-Tl to 3.3V on the ESP32-CAM.)
    3. Strap the Io0 and gnd.
    .. make sure the pins you have cables on are correct… very important.
    4. Power up and upload the sketch.
    Now to test the ESP32-CAM.
    1. Remove the IO0 and gnd jumper.
    2. Change the usb-TTl to 5v (changing the pin)
    3. Change the voltage on the ESP32-CAM to 5V pin.
    4. Power up.
    5. Open up the serial monitor.
    6. Press the reset button on the ESP32-CAM.
    7. get the IP address.

    Enter the IP address in your browser. Go to the bottom to Start streaming data.
    And It works like a charm.

    If I do not change the voltage on the pins (3.3v for uploading sketch and %v for operating then I could not get anything to work.

    I hope this helps other people who are having Issues.

  26. Wonderful tutorial, quick set up….I have 1 little issue…Stills OK, Steaming NOT OK…. Everything seems to work well and good but when I press Start Steam, nothing streams. I can tell through the Monitor, and TTL connection that the Steaming mode is going, and when I stop the monitoring shifts down to lower FPS. Still captures work just fine. Am I missing something? Do I need an SD card installed to allow streaming? Arduino 1.8.9, ESP32 Espressif v1.0.2

    • Hi.
      You don’t need SD card to see the streaming.
      I don’t known what can be the problem. Please note that you can only see the streaming on one client at a time. So, make sure that you don’t have any other browser tab making requests to the streaming URL.
      I’m sorry that I can’t help much.
      Regards,
      Sara

  27. I am facing the following error while uploading code. Please help
    A fatal error occurred: Failed to connect to ESP32 cam: Timed out waiting for packet header

    • You probably don’t have the right connections to the FTDI programmer.
      Also GPIO 0 needs to be connected to GND while uploading the code.
      Regards,
      Sara

  28. I edit code to use esp32 as accesspoint.
    on serial monitor show:

    IP address: 192.168.4.1
    Starting web server on port: ’80’
    Starting stream server on port: ’81’
    Camera Ready! Use ‘http://192.168.4.1’ to connect
    E (5687) wifi: addba response cb: ap bss deleted

    • Hi.
      Unfortunately, I don’t know what that message means.
      If you find out, please share with us.
      Regards,
      Sara

  29. Hola a alguien le ha dado el siguiente error
    [E][sccb.c:154] SCCB_Write(): SCCB_Write Failed addr:0x30, reg:0x23, data:0x00, ret:-1
    20:59:56.233 -> [E][camera.c:1215] camera_init(): Failed to set frame size
    20:59:56.233 -> [E][camera.c:1270] esp_camera_init(): Camera init failed with error 0x20002
    No se como solucionarlo, agradesco vuestra ayuda, saludos.

    • Hi Arturo.
      Next time, post your questions in english so that everyone can understand.
      Which camera board are you using?

      • Hello, sorry for my previous message in Spanish.
        the problem is generated on a model plate ESP32-S Al-Thinker.

        • Hi ARturo.
          That error you were referring to usually means that the camera is not properly connected or the ESP32 is not able to recognize the camera. That can be due to the following issues:

          – Camera not connected properly: the camera has a tiny connector and you must ensure it’s connected in the the right away and with a secure fit, otherwise it will fail to establish a connection

          – Not enough power through USB source: Some ESP32-CAM boards required 5V power supply to work properly. We’ve tested all our examples with 3.3V and they worked fine. However, some of our readers reported that this issue was fixed when they power the ESP32-CAM with 5V.

          – Faulty FTDI programmer: Some readers also reported this problem was solved by replacing their actual FTDI programmer with this one: https://makeradvisor.com/tools/ftdi-programmer-board/

          – The camera/connector is broken: If you get this error, it might also mean that your camera or the camera ribbon is broken. If that is the case, you may get a new OV2640 camera probe.

          Also, sometimes, unplugging and plugging the FTDI programmer multiple times or restart the board multiple times, might solve the issue.

          I hope this helps.

          regards,
          Sara

  30. Hi I did everything as explained and if I get ip and I can enter and start the camera but when selecting the face dectector does not work does not happen nothing does not detect the faces, I have remained still to see if it detects the face and does not work , esp32 I have it connected to the 5v pin because when I tried it with 3.3v I did not want to load the code

    • I had the same problem and the camera needs to be in good lighting conditions to get it to do any of the recognition functions…….

  31. hello I did everything as established, I charge the code and it gives me the ip and the entry in my browser and if it enters the platform of the camera and I can start the camera only that when selecting for the face detector it does not work I have been still to see if it detects but nothing appears, and if you notice that the quality of the camera is somewhat low and I do not know if that could be the cause, there is no way to turn on the led that includes the esp32 cam to work as flash

    • Hi Jesus.
      What is the camera module that you’re using?
      If the camera board doens’t have PSRAM, it won’t be able to do face recognition and detection.
      Regards,
      Sara

    • The face recognition and detection should work with that camera.
      Did you follow Neil suggestions?
      You really need to have good lighting, otherwise it won’t be able to recognize faces.
      Regards,
      Sara

  32. Hello! Excellent tutorial, got me started real easy with the ESP32-Cam. I did got a bit stuck though:

    – First time I uploaded the CameraWebServer sample sketch, the upload process worked fine, though I could not see any traces back in the serial, even removing the GPIO 0 to GND jumper and resetting.

    – Then I tried to upload *again* and got only an error back:

    esptool.py v2.6
    Serial port COM5
    Connecting…….._____….._____….._____….._____….._____….._____….._____

    A fatal error occurred: Failed to connect to ESP32: Timed out waiting for
    packet header
    A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

    – Since I had a second ESP32-CAM, I repeated the steps above, and the results were the same: first upload from the IDE succeeded, the next one failed with the error above.

    – I did try to change the upload speed to 115200 bps, but it did not change the results

    – I did not (yet) try pressing the ‘reset’ button in the board, because it is in the back side and I have the module in a protoboard. Since the first upload worked without pressing reset, I’m not sure I need to do it this time, but I’m open for suggestions 🙂

    Thoughts?

    • *Update*: it was indeed the ‘reset’ button underneath; if anyone is facing the same problem, just remember to briefly hit the reset button as you’re about to upload the compiled firmware.

      Everything is working fine here now, thanks again for this nice tutorial.

      • Hi Claudio,
        Yes, you need to press the reset button, otherwise you won’t be able to upload code.
        Regards,
        Sara

  33. Hi, I want to thank you for all your articles, I learned a lot on this site.
    Following this tutorial my ESP32 Cam worked the first try.
    Now the part where I have some problems: I would like to connect some device through I2C like a BME280, a stepper motor and 2 relay but I have some difficult to locate the right pins (if available).
    Could you help me?

    TIA,
    Vince

  34. I have 2 boards and cams and with both i have the same problem:

    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:1100
    load:0x40078000,len:9232
    load:0x40080400,len:6400
    entry 0x400806a8

    ……………………………………………………….

    I get endless dots , that’s it. Camera does not init. If I remove the cams from the boards that is detected and an error is printed.

    • Hi Mirko.
      That usually happens when people forget to insert their network credentials or don’t insert the credentials properly.
      Please make sure that you’ve inserted your network credentials and double-check that they’re correct.
      Also, make sure that the ESP is relatively close to your router so that it is able to catch Wi-Fi signal.
      Some readers reported that powering the ESP32-CAM board with 5V solved the problem.

      Regards,
      Sara

      • Thank you. That solved the problem.
        I was always thinking the ESP32 is opening up a own WiFi hotspot and so inserted credentials for that.
        I did not realize that it wants to connect to my Wifi and needs that credentials.
        I did not even think about that, because I thought that the ……. is a part of the camera initialisation 😉

        So again, thanx for the hint.

        Mirko

  35. hello I still have the same problem that facial recognition does not work when I start it in the arduino ide serial monitor I start marking this

    MJPG: 8205B 209ms (4.8fps), AVG: 210ms (4.8fps), 134+61+0+0=196 0
    MJPG: 8220B 208ms (4.8fps), AVG: 210ms (4.8fps), 133+61+0+0=195 0
    MJPG: 8234B 207ms (4.8fps), AVG: 210ms (4.8fps), 133+61+0+0=195 0
    MJPG: 8253B 208ms (4.8fps), AVG: 210ms (4.8fps), 133+61+0+0=195 0
    MJPG: 8258B 239ms (4.2fps), AVG: 211ms (4.7fps), 136+62+0+0=198 0
    MJPG: 8244B 282ms (3.5fps), AVG: 215ms (4.7fps), 134+62+0+0=196 0

    but nothing appears in the view of the camera and if I give it in enrroll face sometimes I throw this error

    Guru Meditation Error: Core 0 panic’ed (LoadProhibited). Exception was unhandled.
    Core 0 register dump:
    PC : 0x40132f33 PS : 0x00060c30 A0 : 0x801333fb A1 : 0x3ffd5090
    A2 : 0x3ffc73fc A3 : 0x00000000 A4 : 0x00000000 A5 : 0x00000000
    A6 : 0x00000008 A7 : 0x00600002 A8 : 0x80132ea4 A9 : 0x3ffd5070
    A10 : 0x00000000 A11 : 0x0000000b A12 : 0x00000005 A13 : 0x00000020
    A14 : 0x00000020 A15 : 0x3ffbe140 SAR : 0x00000020 EXCCAUSE: 0x0000001c
    EXCVADDR: 0x00000001 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff

    Backtrace: 0x40132f33:0x3ffd5090 0x401333f8:0x3ffd50c0 0x401334a0:0x3ffd50f0 0x40133755:0x3ffd5120 0x40094c89:0x3ffd5150 0x4008dae1:0x3ffd5190

  36. It is also worth to say, that powering the Unit just from the Serial Converter leads to problems (at me) because the Module needs more/quicker Power than my Serial-Converter Module is able to deliver as you can see sometimes on the Serial-Monitor if there is “Brownout Detection …..”

    I just power it from any other “good” Source to work against the “inrush current” that the Module aparently needs to kick in with WiFi.

  37. Hello, thank you for posting this material, it is very explanatory. I would like to report a problem with the ESP32-CAM I’m using. The image was stuck and locked. So I switched the voltage to 5V and now it works fine. Thank you

  38. Hi guys. Thanks a lot for this tutorial. I’m using the esp32-cam without problems. The only question i have for you is: is there any way to rotate the image in 90º?

    Thanks again!

  39. Hello,

    I am having trouble with my diymore esp32 cam. I believe it is a dev module so this is what I pick under boards (there is nothing that says diymore). I am getting connection timeouts using my adafruit programmer friend wired up the same way as the diagram. Using 3v3. Any suggestions?

  40. Has anyone had any luck in integrating this tutorial with MQTT? I’d like to be able to publish a notification via MQTT to a topic when a recognised face is detected so I can integrate this with my Home Automation System – Thanks

  41. Thanks for your post! i´m from Brazil and i trying using a board ESP32CAM of DiyMore but its no work…my first projeto with ESP32CAM was a AI-Thinker and works fine…
    But when i using ESP32CAM DiyMore not work.

    Maybe ESP32CAM DiyMore its a difrent pinout?

  42. my problem as that :

    A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
    A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

    any solutions pleaseee , thanks

Leave a Comment

Download our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.