ESP32-CAM Video Streaming Web Server (works with Home Assistant)

In this project we’re going to build an IP surveillance camera with the ESP32-CAM board. The ESP32 camera is going to host a video streaming web server that you can access with any device in your network.

You can integrate this video streaming web server with popular home automation platforms like Home Assistant or Node-RED. In this tutorial, we’ll show you how to integrate it 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 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 less than $10. You can read our getting started guide for the ESP32-CAM and learn how to use the Video Streaming and Face Recognition example.

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. Video Streaming Web Server Code

After that, copy the code below to your Arduino IDE.

  Rui Santos
  Complete project details at
   - Select Board "ESP32 Wrover Module"
   - Select the Partion Scheme "Huge APP (3MB No OTA)
   - GPIO 0 must be connected to GND to upload a sketch
   - After connecting GPIO 0 to GND, press the ESP32-CAM on-board RESET button to put your board in flashing mode
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files.

  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.

#include "esp_camera.h"
#include <WiFi.h>
#include "esp_timer.h"
#include "img_converters.h"
#include "Arduino.h"
#include "fb_gfx.h"
#include "soc/soc.h" //disable brownout problems
#include "soc/rtc_cntl_reg.h"  //disable brownout problems
#include "dl_lib.h"
#include "esp_http_server.h"

//Replace with your network credentials
const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";

#define PART_BOUNDARY "123456789000000000000987654321"

// This project was tested with the AI Thinker Model, M5STACK PSRAM Model and M5STACK WITHOUT PSRAM

// Not tested with this model

  #define PWDN_GPIO_NUM    -1
  #define RESET_GPIO_NUM   -1
  #define XCLK_GPIO_NUM    21
  #define SIOD_GPIO_NUM    26
  #define SIOC_GPIO_NUM    27
  #define Y9_GPIO_NUM      35
  #define Y8_GPIO_NUM      34
  #define Y7_GPIO_NUM      39
  #define Y6_GPIO_NUM      36
  #define Y5_GPIO_NUM      19
  #define Y4_GPIO_NUM      18
  #define Y3_GPIO_NUM       5
  #define Y2_GPIO_NUM       4
  #define VSYNC_GPIO_NUM   25
  #define HREF_GPIO_NUM    23
  #define PCLK_GPIO_NUM    22

  #define PWDN_GPIO_NUM     -1
  #define RESET_GPIO_NUM    15
  #define XCLK_GPIO_NUM     27
  #define SIOD_GPIO_NUM     25
  #define SIOC_GPIO_NUM     23
  #define Y9_GPIO_NUM       19
  #define Y8_GPIO_NUM       36
  #define Y7_GPIO_NUM       18
  #define Y6_GPIO_NUM       39
  #define Y5_GPIO_NUM        5
  #define Y4_GPIO_NUM       34
  #define Y3_GPIO_NUM       35
  #define Y2_GPIO_NUM       32
  #define VSYNC_GPIO_NUM    22
  #define HREF_GPIO_NUM     26
  #define PCLK_GPIO_NUM     21

  #define PWDN_GPIO_NUM     -1
  #define RESET_GPIO_NUM    15
  #define XCLK_GPIO_NUM     27
  #define SIOD_GPIO_NUM     25
  #define SIOC_GPIO_NUM     23
  #define Y9_GPIO_NUM       19
  #define Y8_GPIO_NUM       36
  #define Y7_GPIO_NUM       18
  #define Y6_GPIO_NUM       39
  #define Y5_GPIO_NUM        5
  #define Y4_GPIO_NUM       34
  #define Y3_GPIO_NUM       35
  #define Y2_GPIO_NUM       17
  #define VSYNC_GPIO_NUM    22
  #define HREF_GPIO_NUM     26
  #define PCLK_GPIO_NUM     21

  #define PWDN_GPIO_NUM     32
  #define RESET_GPIO_NUM    -1
  #define XCLK_GPIO_NUM      0
  #define SIOD_GPIO_NUM     26
  #define SIOC_GPIO_NUM     27
  #define Y9_GPIO_NUM       35
  #define Y8_GPIO_NUM       34
  #define Y7_GPIO_NUM       39
  #define Y6_GPIO_NUM       36
  #define Y5_GPIO_NUM       21
  #define Y4_GPIO_NUM       19
  #define Y3_GPIO_NUM       18
  #define Y2_GPIO_NUM        5
  #define VSYNC_GPIO_NUM    25
  #define HREF_GPIO_NUM     23
  #define PCLK_GPIO_NUM     22
  #error "Camera model not selected"

static const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
static const char* _STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
static const char* _STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n";

httpd_handle_t stream_httpd = NULL;

static esp_err_t stream_handler(httpd_req_t *req){
  camera_fb_t * fb = NULL;
  esp_err_t res = ESP_OK;
  size_t _jpg_buf_len = 0;
  uint8_t * _jpg_buf = NULL;
  char * part_buf[64];

  res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);
  if(res != ESP_OK){
    return res;

    fb = esp_camera_fb_get();
    if (!fb) {
      Serial.println("Camera capture failed");
      res = ESP_FAIL;
    } else {
      if(fb->width > 400){
        if(fb->format != PIXFORMAT_JPEG){
          bool jpeg_converted = frame2jpg(fb, 80, &_jpg_buf, &_jpg_buf_len);
          fb = NULL;
            Serial.println("JPEG compression failed");
            res = ESP_FAIL;
        } else {
          _jpg_buf_len = fb->len;
          _jpg_buf = fb->buf;
    if(res == ESP_OK){
      size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len);
      res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);
    if(res == ESP_OK){
      res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);
    if(res == ESP_OK){
      res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));
      fb = NULL;
      _jpg_buf = NULL;
    } else if(_jpg_buf){
      _jpg_buf = NULL;
    if(res != ESP_OK){
    //Serial.printf("MJPG: %uB\n",(uint32_t)(_jpg_buf_len));
  return res;

void startCameraServer(){
  httpd_config_t config = HTTPD_DEFAULT_CONFIG();
  config.server_port = 80;

  httpd_uri_t index_uri = {
    .uri       = "/",
    .method    = HTTP_GET,
    .handler   = stream_handler,
    .user_ctx  = NULL
  //Serial.printf("Starting web server on port: '%d'\n", config.server_port);
  if (httpd_start(&stream_httpd, &config) == ESP_OK) {
    httpd_register_uri_handler(stream_httpd, &index_uri);

void setup() {
  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector
  camera_config_t config;
  config.ledc_channel = LEDC_CHANNEL_0;
  config.ledc_timer = LEDC_TIMER_0;
  config.pin_d0 = Y2_GPIO_NUM;
  config.pin_d1 = Y3_GPIO_NUM;
  config.pin_d2 = Y4_GPIO_NUM;
  config.pin_d3 = Y5_GPIO_NUM;
  config.pin_d4 = Y6_GPIO_NUM;
  config.pin_d5 = Y7_GPIO_NUM;
  config.pin_d6 = Y8_GPIO_NUM;
  config.pin_d7 = Y9_GPIO_NUM;
  config.pin_xclk = XCLK_GPIO_NUM;
  config.pin_pclk = PCLK_GPIO_NUM;
  config.pin_vsync = VSYNC_GPIO_NUM;
  config.pin_href = HREF_GPIO_NUM;
  config.pin_sscb_sda = SIOD_GPIO_NUM;
  config.pin_sscb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 20000000;
  config.pixel_format = PIXFORMAT_JPEG; 
    config.frame_size = FRAMESIZE_UXGA;
    config.jpeg_quality = 10;
    config.fb_count = 2;
  } else {
    config.frame_size = FRAMESIZE_SVGA;
    config.jpeg_quality = 12;
    config.fb_count = 1;
  // Camera init
  esp_err_t err = esp_camera_init(&config);
  if (err != ESP_OK) {
    Serial.printf("Camera init failed with error 0x%x", err);
  // Wi-Fi connection
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("WiFi connected");
  Serial.print("Camera Stream Ready! Go to: http://");
  // Start streaming web server

void loop() {

View raw code

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.

If you’re using the same camera module, you don’t need to change anything on the code.


Now, you can upload the code to your ESP32-CAM board.

3. Uploading the 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:

  • Go to Tools > Board and select ESP32 Wrover Module
  • Go to Tools > Port and select the COM port the ESP32 is connected to
  • In Tools > Partition Scheme, select “Huge APP (3MB No OTA)
  • Press the ESP32-CAM on-board RESET button
  • 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. A page with the current video streaming should load.

Home Assistant Integration

Having just the ESP32-CAM working via IP might be useful for most people, but you can integrate this project with Home Assistant (or with other home automation platforms). Continue reading to learn how to integrate with Home Assistant.


Adding ESP32-CAM to Home Assistant

Open your Home Assistant dashboard and go to the more Settings menu.

Open Configure UI:

Add a new card to your Dashboard:

Pick a card of the type Picture.

In the Image URL field, enter your ESP32-CAM IP address. Then, click the “SAVE” button and return to the main dashboard.

If you’re using the configuration file, this is what you need to add.

After that, Home Assistant can display the ESP32-CAM video streaming.

Taking It Further

To take this project further, you can use one fake dummy camera and place the ESP32-CAM inside.

The ESP32-CAM board fits perfectly into the dummy camera enclosure.

You can power it using a 5V power adapter through the ESP32-CAM GND and 5V pins.

Place the surveillance camera in a suitable place.

After that, go to the camera IP address or to your Home Assistant dashboard and see in real time what’s happening. The following image shows us testing the video streaming camera. Sara is taking a screenshot while I’m filming the camera.

It’s impressive what this little $9 ESP32 camera module can do and it’s been working reliably. Now, we can use the surveillance camera to see in real time what’s happening in my front entrance.

Tip: Node-RED Integration

The video streaming web server also integrates with Node-RED and Node-RED Dashboard. You just need to create a Template node and add the following:

<div style="margin-bottom: 10px;">
<img src="https://YOUR-ESP32-CAM-IP-ADDRESS" width="650px">

In the src attribute, you need to type your ESP32-CAM IP address:

<div style="margin-bottom: 10px;">
<img src="" width="650px">


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

In this tutorial we’ve shown you how to build a simple video streaming web server with the ESP32-CAM board to build an IP camera. The web server we’ve built can be easily integrated with your home automation platform like Node-RED or Home Assistant.

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 with 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!

184 thoughts on “ESP32-CAM Video Streaming Web Server (works with Home Assistant)”

    • Yes. We intend to integrate this with Node-RED too.
      The face recognition and triggering events might be a bit more difficult. We’ll see…

        • Hi.
          Try powering the camera with 5V.
          Some readers reported improvements in wifi signal after powering with 5V.

        • Check the jumper 0K resistor by the antenna connector is in the proper position for the antenna desired. There are 3 little white squares laid out like a “<" with the middle position being common. With board turned so the the pcb antenna up, to use the pcb antenna, the resistor must be on the top position, like this: /

          For the antenna connector, the resistor must be on the bottom position, like this: \

  1. I meant completely integrating it in Node-RED – available on the dashboard as a viewable feed, face recognition triggering events, etc.

  2. I’d like to create a battery powered version that uses the ESP32’s deep sleep mode (with motion detection to wake it up) and low battery notifications.

  3. Dear Sir,
    That’s a lovely project.

    However, I’m not getting the some of the header files used in the arduino sketch. They are esp_camera.h, “esp_http_server.h”,

    Can you please be kind enough to help me getting these header files?

    Thanks in advance..


    S. Bera

  4. Fantastic! Any suggestions on how to use it to capture video? IE: if it could detect motion with a passive IR added in addition to the ESP32 camera…and that motion could trigger the local PC to record for X minutes, that would be FANTASTIC.

      • Hi Sara,

        Most excellent! I look forward to it. Got several of the boards on the way. I’m thinking that instead of putting the board into a security camera housing, I’m going to mount it to the inside of a window facing to the outside. Should work well and not require any environmental sealing. 🙂

        Thanks much,

  5. Hi, I wanted to know if it was possible to reduce the latency of the image, and if it were possible to use an ESP8266. Thank you.

  6. Rui,
    My daughter is into Legos and wants me to help her to develop a Lego Sorter.
    How difficult would it be to adapt the face recognition SW to learn to recognize objects?

    Thanks to you and Sara for all the information and work you do to educate people.



    • Hi Lloyd.
      At the moment, I don’t think it is easy to do that with the ESP32-CAM and arduino IDE. It’s a quite new topic and there aren’t many libraries available to do that.
      There are much more support for object recognition using raspberry pi and its camera at the moment.

  7. HI, I’m using this esp32 camera from

    When the code executes this line:
    fb = esp_camera_fb_get();
    it never returns. I’ve place a Serial.println() before and after the line, and the line after never prints out.

    The only camera model setting that passes the camera init and probe is this: CAMERA_MODEL_M5STACK_PSRAM.

    Here are the things that I’ve tried:
    — created OV2640 config : fails camera init and probe
    — changed jpeg_quality making from a Min of 1 to a max of 12
    — Changed fb_count numbers 1-3

    What would you suggest?

    Thanks in advance,

  8. Hello.
    When I try to upload the sketch to the ESP32 CAM an error mesagge shows “Failed to connect to ESP32: Timed out waiting for packet header”.
    I’ve checked the connections, pressed Reset before and during the upload attempt, connected to 3.3v and 5v, used //#define CAMERA_MODEL_WROVER_KIT and #define CAMERA_MODEL_AI_THINKER.
    Please, I’ll be glad to know if you have any suggestions of something else to try.
    Best wishes.

    • Hi Marcelo.
      I’m sorry you’re having trouble with your board.
      Please verify that you have the ESP32 GPIO0 connected to GND during the uploading.
      Also, make sure that in the arduino ide settings, you select Tools > Partition Scheme, select “Huge APP (3MB No OTA)“.
      It this doesn’t work, it is very difficult for me to understand what might be wrong.

  9. Wow, what a brilliant, inspiring idea !!!

    Just last week I received some of these camera’s. I ordered them from China some time ago, but it took some time before they were shipped.
    (I guess they are very popular)

    Yesterday I assembled and programmed the ESP-CAM and found out that it works well when you use a powerbank, you can just walk around with it !
    (also found out that you can program the board with a USB-to-TTL module model CP2102 and that the CH340 model does NOT work)
    Then I searched the whole house for my old dummy camera’s..
    and found them today, haha. They are not as easy to use as yours,
    but some are ‘workable’.

    Surprisingly enough, I managed to build my first dummy-ESP-CAM today !
    I use it to watch my front door, it’s battery operated (3xAA-rechargable-2000mAh) and it works very well !
    They is some (a few seconds) time-lag (latency ?) between what happens and it showing up on screen, but other than that the camera works fine and I love that I can see who’s at my front door before I open it !
    Now we will have to learn by experience how long these batteries will last…

    Your explanation was very easy to follow and my ESP-CAM was up and running before I knew it…. getting it into my old dummy-cam was (a lot) more work…

    Thank you again, for another inspiration ! I had a great day building it !

    • Hi Gerrit.
      Thank you so much for your nice words.
      I’m really happy when I see that our readers can actually make our projects and put them working in a real world scenario.
      Then, let me know how long your batteries last.
      Thank you for your interest and enthusiasm in our projects.

  10. I ordered the components from Maker Advisor but received an unknown model of the ESP32CAM, with which none of the three camera settings work. Since the serial monitor reports: “[D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled”
    I guessed this must be the M5STACK_PSRAM model, but booting with this setting sends the error message “Camera init failed with error 0x20001”.

    The WROVER_KIT setting als returns these errors: “SCCB_Write [ff]=01 failed; SCCB_Write [12]=80 failed; Camera init failed with error 0x20001”

    And the AI_THINKER setting complains about an illegal instruction, reboots and then gives no more information after the “PSRAM enabled” message.

    Any ideas?


  11. I ordered the components from Maker Advisor but received an unknown model of the ESP32CAM, with which none of the three camera settings work. Since the serial monitor reports: “[D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled”
    I guessed this must be the M5STACK_PSRAM model, but booting with this setting sends the error message “Camera init failed with error 0x20001”.

    The WROVER_KIT setting als returns these errors: “SCCB_Write [ff]=01 failed; SCCB_Write [12]=80 failed; Camera init failed with error 0x20001”

    And the AI_THINKER setting complains about an illegal instruction, reboots and then gives no more information after the “PSRAM enabled” message.

    Any ideas?


    (my earlier message about being unable to flash are obsolete now, they were due to a faulty FT232)

  12. Rui,

    I purchased three ESP32-CAM modules from Banggood with camera.

    I have tried everything I could find on internet to program anything on them. I keep getting “Timed out waiting for packet header” error. Nothing ever get programmed? Even used an external power supply and nothing works.

    These modules do not say “AI-THINKER” on them. Might be a different module but cannot prove it this way.

    Any more ideas:

    Thanks, Joe L.

    • Hi Joseph.
      That error means that your ESP is not in flashing mode.
      Please check that you’ve wire the RX and TX pins properly to the FTDI programmer, and that the ESP32 GPIO0 is connected to GND.

      • Sara,

        I have TX going to RX etc. and GPI0 going to gnd. I press boot buton before programming and serial says “waiting for download”. How can I know if ESP32 in flashing mode?

        Tried every mode possible and same result.

        The programmer works ok on other standard ESP32 modules.

        Thanks Joe L.

  13. Hi Rui,

    I purchased two ESP32-CAM modules from Banggood with camera; they are exactly same than yours.
    I tried everything I found on your kind blog to program on them.
    I keep getting ever “Timed out waiting for packet header” error as follows: v2.6-beta1
    Serial port COM8

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

    I have TX going to RX etc. and GPI0 going to gnd.
    I pressed boot button before programming.
    Tried every mode possible and same result.
    The programmer works fine on other standard ESP32 modules.

    Any idea Sara/Rui?

    • I purchased my esp32-cam from banggood they do not say Ai-Thinker on them.
      Ihave yet to get it to work but was able to get the program loaded.I was getting the same error as you.In the if you are using Windows in the Control Panel check to make sure you have a good Driver for the COM port you are using try updating the driver.

    • I had exactly the same problem. Used another type of FT232 board (bought on Amazon) and the communication problems were solved. But my ESP32 cam boards from Banggood are also of an unknown type that does not work with the software provided in this article…

    • I had this problem and it was not enough power through USB source I fed +5 to Vcc pin and that fixed it. It was brown out in my case.

    • Hi Domenico.
      That error means that the ESP32 is not in flashing mode.
      You have to follow the exact same instructions we have in our tutorial.
      By what you’re describing, it seems that you’re doing everything right. If you’re doing as we describe in our tutorial and it doesn’t work, I don’t know what can be the problem.

      Also, as Richard said “If you are using Windows in the Control Panel check to make sure you have a good Driver for the COM port you are using try updating the driver.”

      I’m sorry that I can’t help much. Meanwhile, if you find out the problem let us know. We’re planning to write a troubleshooting guide for the ESP32-CAM.

          • Hi Sara, the flashing is now Okay; but I got this error ; could be it due to cam related. Right?
            PS: I purchased my esp32-cam from banggood they do not say Ai-Thinker on them, but they are exactly same than yours. Any idea to solve in case not exactly the AI-Thinker camera?

            18:46:14.539 -> configsip: 0, SPIWP:0xee
            18:46:14.539 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
            18:46:14.539 -> mode:DIO, clock div:1
            18:46:14.539 -> load:0x3fff0018,len:4
            18:46:14.539 -> load:0x3fff001c,len:1100
            18:46:14.539 -> load:0x40078000,len:10088
            18:46:14.539 -> load:0x40080400,len:6380
            18:46:14.539 -> entry 0x400806a4
            18:46:16.939 -> Guru Meditation Error: Core 0 panic’ed (LoadProhibited). Exception was unhandled.
            18:46:17.059 -> Core 0 register dump:
            18:46:17.059 -> PC : 0x4014284b PS : 0x00060830 A0 : 0x80140b67 A1 : 0x3ffd3150
            18:46:17.059 -> A2 : 0x3ffc8c08 A3 : 0x401417d8 A4 : 0x00000002 A5 : 0x00000005
            18:46:17.059 -> A6 : 0x0000000b A7 : 0x00000003 A8 : 0x80142845 A9 : 0x3ffd3130
            18:46:17.059 -> A10 : 0x4000446c A11 : 0x400041fc A12 : 0x3ffc8c50 A13 : 0x00000007
            18:46:17.059 -> A14 : 0x3ffae0c0 A15 : 0x00000008 SAR : 0x0000001c EXCCAUSE: 0x0000001c
            18:46:17.059 -> EXCVADDR: 0x00000002 LBEG : 0x4008d664 LEND : 0x4008d67c LCOUNT : 0x00000000
            18:46:17.059 ->
            18:46:17.059 -> Backtrace: 0x4014284b:0x3ffd3150 0x40140b64:0x3ffd3180 0x4014105c:0x3ffd31a0 0x400dd8a6:0x3ffd3260 0x400ddb56:0x3ffd3290 0x40115439:0x3ffd32c0 0x4011553c:0x3ffd32f0 0x4011583e:0x3ffd3320 0x401159b3:0x3ffd3350 0x4008b5c8:0x3ffd3370 0x40091b11:0x3ffd33b0
            18:46:17.059 ->
            18:46:17.059 -> Rebooting…
            18:46:17.059 -> ets Jun 8 2016 00:22:57
            18:46:17.059 ->
            18:46:17.059 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
            18:46:17.059 -> configsip: 0, SPIWP:0xee
            18:46:17.059 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
            18:46:17.059 -> mode:DIO, clock div:1
            18:46:17.059 -> load:0x3fff0018,len:4
            18:46:17.059 -> load:0x3fff001c,len:1100
            18:46:17.059 -> load:0x40078000,len:10088
            18:46:17.059 -> load:0x40080400,len:6380
            18:46:17.059 -> entry 0x400806a4
            18:46:18.739 -> SCCB_Write [ff]=01 failed
            18:46:18.739 -> SCCB_Write [12]=80 failed
            18:46:18.859 -> Camera init failed with error 0x20001

          • After flashing, you need to remove the connection between GND and IO0. If you see the error (below) – that indicates the ESP-32 is in boot mode, try adding a 10K resistor between IO0 and 3.3V to make sure the state of this pin/input isn’t floating. Once I added the resistor, everything worked for me!

  14. I have the same problem as ‘Domenico’ – I ordered 2 ESP32-CAM modules from Banggood and they also do not recognise the camera…they are also not marked AI Thinker…

    • I had the same issue Chris Parsons. I bought 2 ESP32-CAM modules from Amazon. I paid a premium to get them quickly. They are from DIYMORE. They do not work with the examples here. I replaced them with 2 from Banggood that are labelled AI Thinker and they work just fine

      • I actually bought my modules from Banggood – the advert shows ‘AI Thinker’ but they sent what I suspect is an ‘equivalent’ that doesn’t work – so now I will have to convince them to refund me and send the correct ones – and wait another 2 weeks 🙁

        Guess you must have been lucky?

        • I have tried convincing Banggood to refund in another issue that seemed crystal clear (ordered a shutter up/down switch and received a light dimmer 🙂 and got only a fraction of my money back. Trying to get this module to work will probably be easier than claiming a refund

  15. I am trying to edit the code of the esp32 on access point mode. But it work. The wifi is up and running. But the website is not loading. Is this code compatible with accesspoint wifi?

    • Hi.
      I don’t see why it wouldn’t be compatible, but I haven’t tried it.
      Please note that you can only access the video streaming at one place at a time. Make sure you don’t have the web server opened in another tab.

  16. Hi Rui..Sara can you make an update on the code to fix the Camera init failed with error 0x20001 ERROR CODE ? Thanks a lot lot lot. 🙂

  17. Hello
    It works, but …
    when I run the ip I have a picture every 30 seconds or so.
    Is it possible to block the IP fixed?

  18. I too received boards with a different chip from Bang Good, however mine work fine with the AI Thinker selection. I did have issues in the beginning when setting them up and finally figured out they are really picky about their power. They need a lot and are extremely intolerant of noise or low voltage. Try using the 5V pin and the ground next to it rather than the 3.3V. They seem to be happier when using their own onboard voltage converter.

  19. I too received a unmarked unit from banggood (also 1 from AliExpress) and had the same error, Camera init failed with error 0x20001. But as an earlier poster said, I too switch the jumpier from 3.3v to 5v and that solved the problem.

    NOTE: both my units, were unmarked (images on websites showed AI-Thinker) but required 5 volts. So that was the problem not anything in the code.

    • Unfortunately, this solution doesn’t work for me. After flashing, I switched to 5V, the reset LED now keeps burning faintly and after reset, the serial monitor does not show anything, not even an error message. Scanning the ports on my local network also does not show a new server added…

  20. Dear Rui, thanks for the tutorial.
    I would like to be able to turn on a light from my cell phone, a light attached to a relay controlled by the ESP32.
    How would do that?

  21. HI RUi, excellent, now works fine! It was a power issue, you have to connect to 5VDC not 3.3V !

    • Is this when you are programming it? I have a different FTDI programmer with a 3.3v or 5v switch?

      I did wonder if the ESP32 would get enough power via the FTDI programmer which is connected to a USB port on my PC?


  22. Hi Rui, a quick question not fully understood; can I check the cam (accessing the video streaming server) from outside the house, not using the same IP address????

  23. Hi rui…I tried an answer by myself and found the OpenVPN could be a way to reach from outside of the home to inside it the web cam video streaming. Am I wrong?

    • Yes. Using a setup like that should definitely make your ESP32-CAM web server available from anywhere.

  24. Hi,
    Referring to the this tutorial with the ESP-32 CAM.
    I would like to be able to switch on a lamp while watching the streaming video from the camera.
    How can it be done?

  25. bonjour,
    merci pour les infos j’ai bloqué l’IP et l’image est plus fluide avec une bonne antenne.
    Mon souhait serait de pouvoir capturer une image et l’envoyer par mail .
    Une idée ?

  26. Gave up on using the non ‘AI Thinker’ boards and bought another one that was marked AI Thinker…uploaded the code, and finally got the message showing the IP address in the monitor, but no web server on the same LAN!

    Tried a reboot and even reloading the code but get garbage in the monitor and sometimes a message about ‘Camera init failed with error 0x20002’

    I have tried disconnecting the power to the board and connecting 5v and GND instead but get the same results, reflashing the firmware (with 3.3v connected) but nothing…did you ever produce the help guide?

    • Hey, try reflashing with 5V (connect to the 5V pin of course). Programming with 3.3V here has also resulted in tons of error messages. With 5V flashing&running, everything is find.

      • I just got one and followed the instructions and had problems programming.
        I connected to the 5v line and it programed ok.
        I since realised that my FTDI programer outputs 5 volts ONLY on the VCC line. It can switch between 3.3v and 5v only on the DATA lines.
        I was therefore pumping 5v directly to the 3.3v line, so was lucky not to damage the EPS32 or camera.
        Actually, I may have as there are lots of moving horizontal lines on the image and both camer and EPS32 get very hot.
        Many people suggest bumping up the power to help remove many of the lines, but I wonder how many tried to program with 5v onto the 3.3v line at the begining!

  27. Hi and thanks for the tutorial. Really needed it!
    Took a while to get everything working.
    My main problems were power issues as well.
    I found I could flash the code via USB at 3.3 and 5, but then trying to run the code would constantly crash in different ways.
    So I powered the device with an external 5v power supply, disconnected the USB power (but not the ground). With that, everything worked great.
    Don’t give up on this device … it’s really impressive once you get it going!
    Thanks again for your article!

  28. I’ve bought also from aliexpress 3 ESP32-cam non-AI-thinker boards.
    I’ve found out that the boards come with pre-installed fw.
    if you look with phone or PC for WiFi networks, you’ll find an “ESP32_CAM” ssid, which belong to it. just click on connect, no-pwd and go to :

    that’s all. i’m figuring out how to connect to the board and flash another fw.
    I’ll keep you update.

  29. I found the problem. I had upgraded the boards to Version 1.0.2 and no ESP32 code would compile.

    Thanks to a post by stankusaudrius on the ESP32 Github, I looked in
    and found a folder for the older version (1.0.1). Deleting the folder for 1.0.1 fixed the problem.

  30. Your stuff is great as usual!
    Worked first try… Unfortunately I bought mine off Alliexpress and of course the quality of the image is poor. But – it did work first try and still fun to play with.
    Thanks for your great work.

  31. Hi, Once again another fantastic tutorial which help me enormously. I got it working after changing to the 5v connections and was a little disappointed with the picture lag. I managed to overcome this by changing the: ‘config.frame_size = FRAMESIZE_UXGA;’ to: VGA (config.frame_size = FRAMESIZE_VGA;). The picture quality is not as sharp but it is much more responsive. Also, this camera works with the motion eye os setup. A much cheaper alternative to the pi-zero option with camera. Thanks.

    • Hi guy, the cam works perfect at 5 voltages; also, I tried successfully to streaming out using service. On my application the port 80 is fine. Thanks rui and Sara.

  32. Hi Sara and Rui
    I too got an unmarked ESP32 cam board from China and set it up as an AI Thinker following your excellent tutorial. I was originally running it on 3.3 volts via the USB adaptor board and although it flashed and worked just fine, it was a bit iffy at connecting to the wifi network and there was a lot of latency and coloured lines across the picture. I have now changed to a stand alone 5 volt supply and it is much much better, so it would seem that these unbranded Chinese boards want to run at 5 volts. On a slightly different note, I would really like one of my external camera viewer apps to be able to ‘see’ this camera. I should be able to integrate it manually from the network IP address, port numbers involved and if I know the format of the video stream. Do you happen to know what it is and what port I would need to be looking for / forwarding ?

      • Thanks Sara. I’m going away for a few days so won’t get an opportunity to try anything for a while. Is it possible to have more than one of these camera modules loaded with the tutorial software, running at once ? The router would presumably issue a different IP address to each module but would it just produce a conflict on port 80 ? Sorry if these are dumb questions, but I’m very new to all this. I have several remote viewer apps that I have tried to use with this module but I have been unable so far to get any of them to ‘see’ the module. The apps all seem to have settings for ‘generic’ IP cameras, but there are a lot of them. Is there anything else about the format of the data other than “MJPEG” that’s known that would help me find a setting that allowed the camera to be recognised ? Aircam is the app I would like to use as this works fine with my existing USB cameras and is able to operate with IP cameras as well if you can get them recognised. Thanks again for the excellent tutorials and taking the time to help old dinosaurs like me ! 🙂

  33. Hi, I’ve just got my esp32-cam and managed to make it work in no time, thanks to your explantion – thanks!
    Just wondering about the camera – the picture quality is pretty low – it needs lots of light and I have blue and yellow horizontal lines, flickering all over the image. Is it just my camera, or is it a known problem?

    • Hi Danny.
      The quality of the picture is low, but I didn’t get horizontal lines.
      Some readers reported that powering the ESP32 with 5V through the 5V pin can help solve that issue.

  34. What do I wrong?
    Wn10 environment
    RPI 3B
    No pblm with the installation of the ESP. It works and gives me the IP address.
    But impossible to install Home assistant.
    I’ve loaded the file “hassos_rpi2-2.12.img.gz”. Extracted it gives me he file “hassos_rpi2-2.12.img”.
    I load this file with Etcher on a (new) 64GB SD card.
    Etcher comes back with “all fine” after a few minutes.
    But the SD card is empty and asks to be formatted…
    Nothing has been copied on the SD card…
    I’ve also used “Win32DiskImager” with same results.
    Tested several times.
    Any idea?

  35. Unlike most of your projects, this one was a disaster…I have bought three ESP32-CAM boards and none of them have yet to produce an image. I have tried running them off both 3.3v and 5v and can get a wireless connection but no image is displayed. I have also tried the ESP32 WebCameraServer example and this didn’t work either (‘camera not supported’ message)

    Bit disappointed I have wasted my money but I guess perhaps the boards and cameras vary although they all advertised as the same!

    I did manage to get one board where the chip was marked ‘AI Thinker’ but this didn’t work either 🙁

    • Chris.
      The camera not supported message could be an indication that the camera ribbon cable is not connected correctly. On the ribbon cable should be a line, when connected if you can see that line, the cable is not pushed in far enough.
      I had the same problem, and fixed it with reconnecting the ribbon cable correctly.
      Please try reconnecting again and see if this fixes the problem.
      Hope this helps.

    • I had similar problems initially using just a cheap Chinese version from an eBay seller. I have found that it definitely needs to be be powered from 5v not 3.3v and you need to have a good wifi connection. If necessary, configure the antenna link and use an external antenna – dirt cheap from eBay sellers. The camera connects every time now for me with no “camera not supported” error messages and stays reliably connected. I have to say that the picture quality is very good – easily as good as other cameras that I have that were much more expensive. The second issue that I had was with the browser that I tried to use to look at the camera output. Under Windows 10, my preferred IE v10 will have none of it. Although it connects and all looks to be well, the picture window is just blank. However, both Chrome under W10 and Safari under IOS on my iPhone produce an excellent picture as soon as “Start Stream” is clicked

  36. Hi Rui and Sara,
    I like your website a lot. I love your Raspberry Pi 20 Easy Projects book, very useful and easy to follow!
    I wanted to try this project with the ESP32 and the camera, but I need some help. I am having issues uploading the programm using the Arduino IDE. I get this error:

    Arduino: 1.8.9 (Windows 7), Board: “ESP32 Wrover Module, Huge APP (3MB No OTA), QIO, 80MHz, 921600, None”

    Sketch uses 774606 bytes (24%) of program storage space. Maximum is 3145728 bytes.
    Global variables use 47912 bytes (14%) of dynamic memory, leaving 279768 bytes for local variables. Maximum is 327680 bytes. v2.6
    Serial port COM6

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

    • Hi again,
      It is working! I just forgot to set the jumper from the FTDI programmer to 3V3 (it was on 5V). Thanks for this tutorial! 🙂

      • I’m glad you’ve found out the problem.
        Thank you for following our work, specially our Raspberry Pi book.

  37. Hi,
    I have been able to install everything. Not as easy as described…
    Now I’ve a pblm to retrieve the images taken with the OV2640 and put them in HomeAssistant.
    You write simply to add the url ( in your ex.) but this is no working in my case.
    If I want to get an image in HA, I’ve to use the complete url like found in the image source file of OV2640 application.
    This is what I’ve to use: “”
    BUT this is not working automatically. I’ve to update the address manually.
    Not the best solution.
    Do you have a idea how to improve?
    Thanks in advance for any help

    • Hi Jean.
      I’m sorry for the delay in our response.
      We receive lots of comments, questions and emails every day. It is very difficult to keep track of everything. I hope you understand.

      Regarding your question.
      We’ve got everything working fine by just copying the URL. So, I don’t know what can be the issue in your case.
      If you go to the IP address, outside Home Assistant, can you see the video streaming properly?


      • Most Home Assistant users are not using the Lovelace UI, so I don’t know if the yaml code is any different. This works in my cameras.yaml file:

        # ESP32-CAMERA
        – platform: mjpeg
        name: ESP32-CAM

        Of all my WiFi cameras, this one interfaces with my Home Assistant easier than all others.

      • Hi Sara,
        We all have the same prblm… time.
        Let me a few time to test it again, I’m in an other (of your) project actually.

  38. I got this working on a chinese no-brand ESP-CAM – works well, though lots of latency and the occasional vertical line – but running at 5v has helped somewhat.

    I think the latency is due to the sheer size of the image – 1600×1200. Is there any way to get a reduced image size from the CCD – or maybe force a slower refresh rate of 1 frame per second.


    • Solved:

      config.frame_size = FRAMESIZE_SVGA;

      This makes it 800×600. A bit better, but still a bit wobbly. I suspect there isn’t enough CPU there to handle lots of movement.

      • Hi Aris.
        Thanks for sharing that information.
        Yes, the ESP32 may not have enough CPU to process movement.

  39. Hi Sara,
    I have two questions. When I install the program and run it, everything works fine. However, if I detach it from the programmer and power it with the 5V powersupply, I cannot seem to connect to it anymore. Do you have any suggestions? Another questions is regarding Octoprint. It has a feature to use a camera stream to monitor 3D prints. I was wondering if you could use this setup as a stream in Octoprint in stead of the fixed Raspberry Pi camera?


    • Hi Peter.
      What external power supply are you using? I’ve experimented with a phone portable charger and it worked fine.
      You can have just one client at a time, so if you have a previous tab open, when you try to connect again, it won’t show anything in the new tab. You need to close the previous tab.
      Also, make sure that when you are powering it with the external power supply, the ESP32 is within the wi-fi range of your router.
      If the octoprint software provides the option to add an ip cam, it would probably be compatible. You just need to pass the streaming URL.

    • You can monitor it via FTDI while being powered by external cable.
      Just do not connect power line from ftdi to camera, leave it unconnected.
      Then connect external power supply to either 5V or 3V depending on your external power supply voltage (probably 5). And then make a common ground. Just connect gnd from ftdi to one of the ground pins, while also connecting ground from your external supply to some other gnd pins. And voila, the ftdii is able to monitor it and display the output in terminal. You can then check, what is happenning.

  40. Thank you for this tutorial! I recently purchased two of these boards with cameras and am anxious to get them up and running. I believe I’ve installed everything correctly for the IDE but when I go to compile the sample code I get this error message:

    Board esp32doit-devkit-v1 (platform esp32, package esp32) is unknown
    Error compiling for board DOIT ESP32 DEVKIT V1.

    Thank you for any help and guidance…

  41. Hi Sara

    My ESP camera worked a treat whilst I was away and provided a good security picture of my house. Couple of questions that I hope you might be able to answer. First, where is the user interface located ? Is it a piece of software built into the camera that the Arduino sketch interacts with, or is it part of one of the Arduino libraries that is used in the sketch ? Can the “Start Stream” button effectively be ‘pressed’ in software i.e. without having to click on the button so that the camera is streaming immediately from when it connects ? Also, where is the post number that it is outputting on defined ? Can it be changed from 80 so that more than one ESP 32 cam module can be active on different IP addresses. I’m sure others must want to do this as more than one camera would be really useful. These are probably dumb questions but I’m pretty new to all this and am just pleased that I have gotten as far as I have already with your tutorial and help 🙂

  42. Great tutorial – I was able to upload the code just fine to my AI-Thinker esp32, however when I disconnect the GPIO0 connected to GND and reset, if I watch it in Serial Monitor it never connects to the WiFi.

    I’ve tried three different WiFi’s that I have here, all different SSIDs, but none of them ever connect.

    This is what I get, looks like it’s just fine, but that last row of ……. dots just go on forever!

    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    mode:DIO, clock div:1
    entry 0x400806a8

    Any ideas?

    • Hi Don.

      Some of our readers reported that if your network credentials have more than 11 characters, it will not work.

      Also, I’ve recently discovered through one of our readers, that some ESP32-CAM boards come connected to the external antenna instead of the internal antenna. Here’s what he said that might be useful:

      “Check the jumper 0K resistor by the antenna connector is in the proper position for the antenna desired. There are 3 little white squares laid out like a “<" with the middle position being common. With board turned so the the pcb antenna up, to use the pcb antenna, the resistor must be on the top position, like this: / For the antenna connector, the resistor must be on the bottom position, like this: \ " The board provides a connector for an external antenna and has an onboard antenna as well. If your ESP32 comes with the external connector enabled, you can try adding an external antenna. Or solder/unsolder to use the internal antenna. I hope this helps. Regards, Sara

  43. Hey. Hope this might help someone. The ESP32 cam units cannot connect to a WiFi hotspot where the SSID has more than 11 characters in the name. Mine had 12 and I was tearing my hair out trying to work out what was wrong, as everything else seemed perfect. Found this snippet on another forum, I hope it aids someone.

      • Hi Sara,

        If this the case, do you have a suggestion?
        I’m not able to change the SSID.
        And even if I could do it I should have to change all the systems connected…

        • Hi Berrier.
          Some of our readers have done that, but I don’t know how to do that. Maybe a google search can help with that.
          Some routers also provide the option to create guest networks. That can be a better alternative because you won’t have to change the systems that are already connected (if your router allows that).
          Bur before trying it, take a look at our troubleshooting guide to ensure that you’ve done all the steps to make it work:

          • Hi Sara,
            I’ve exploited your guide already (excellent!). but w/o help.
            I’ll try Google and keep you informed.

            BR, jean-Luc

  44. My board looks just like the AI Thinker, but it is an HW-297 which I got from Amazon for $12.99. I followed the instructions and got the code loaded OK but it wouldn’t work. Just gave lots of errors. When I powered it with 5V (on the 5V pin) instead of 3.3V (on the 3.3V pin), it began to work. Amazing little thing!

  45. For anyone having “Camera init failed with error 0x20004” try for flash and power up the board using 5v pin instead 3v, its worked for me.

  46. Excellent tutorial!! I really want to thank you for posting this. As always, you do an excellent job of explaining all the steps. Thank you so much for your hard work and for sharing your knowledge with the community.

    • I got it working already under Domoticz. If you have ESP tools installed in the Arduino IDE, there will be a CameraWebServer sketch that has more options under File > Examples > ESP32 > Camera. Edit this just like the sketch mentioned in this post and flash it. Setup a new camera in Domoticz Settings > More Options > Cameras, give it a name, enter the IP address of the ESP32CAM, leave the Port number blank and enter ‘capture’ as the imageURL.

      • Hi Pierre. Thanks for your instructions on getting the cameras to view in Domoticz. I now have this running on a Widows 10 PC and it’s the first application that I have been able to get to see multiple instances of the ESP 32 cam board each on a different local address.

        Can I now set this up on my iPhone so that I can view the cameras remotely from anywhere in the world ? Please bear with me. I’m very new to all this !

        • You can remotely view the cams directly by setting up port forwarding on your router, however since they have no security at all, anyone can access them, so I wouldn’t do that.

        • In stead, I suggest you install Domoticz on a Raspberry Pi that will act as a server and can stay on permanently. This way, the camera’s are only connected to your local network, but you can access them from outside through the Domoticz server, which is protected.

          • Hi Pierre. Thanks for your input. I have a Pi that I may well set up as you say. At the moment, the W10 machine whose network they are connected to, runs continuously and already has the router set up for forwarding. I now have two ESP32 cam boards set up and visible in a copy of Domoticz running on that Win10 machine. I have a copy of Domoticz now installed on my iPhone, and would like to be able to view the cameras on that phone, either via a 4G connection or any other wifi network that I might be connected to with the phone, for instance when I am away. However, I don’t know what I have to do to set up that remote viewing for the cameras – or any other device – on the iPhone copy. I just have a page with “HTTPS” and a port number on it, an empty field called “Directory”, “username” and “password” and a couple of other bits. Do I need to fill some parameters in here or go straight to “next”. As I said, I’m very new to all this, although very experienced in electronic service work. Thanks for your time and feel free to contact me direct if you would rather

          • You can Just open a browser window on your phone and from there, see Domoticz and the camera’s. I do that on my Android phone since the Domoticz app (which is also available for iPhone) for some unknown reason doesn’t show the camera streams at all.

          • OK. Pity that the app doesn’t work in that respect. I was rather hoping that it would. So what URL do I use in the browser to get to my data through Domoticz ? I’m starting to get a bit confused now …

          • Add a port forwarding rule in your browser in which your public ip address with a port of your choice will be forwarded to the local address of your Domoticz server. There are numerous guides about port forwarding available on the internet.

  47. Hi, I loaded the script in my newly arrived ESP32-CAM but the video fps seems to be very low.
    I started ping -t (ip acquired by my ESP32-CAM) and the response time rums at 1000ms, 1300ms, some times 18ms, etc

    Can I make the size of the picture on screen half its current size?

    If I want to have a button to activate an external light how could I put this button at the same screen as the image?

    Thanks a lot


  48. Hi Rui and Sara,

    I’am having problems with my camera to expose it’s ip-address.
    This is what I get from the serial monitor:

    ets Jun 8 2016 00:22:57

    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    mode:DIO, clock div:1
    entry 0x400806a8
    Camera init failed with error 0x20004

  49. I could not program mine yet I have exactly the same FTDI as you link to.
    I looked at your trouble shooting section and one was to use 5v, so I connected the FTDI direct to the 5v line and worked fine.
    In hindsight, the FTDI supply output IS 5v not 3.3v, only the data lines (RX/TX) are switchable between 3.3v and 5v, but the supply is always 5v volts.
    This means I put 5v directly onto the ESP32 bypassing the onboard regulator which could have damaged the ESP32.
    May I suggest that you re-draw you diagram to show a connection to 5v as currently using that FTDI you are connecting 5v to a 3.3v input even though you have labeled the supply on the diagram as 3.3v, it is actually 5v.
    Hope I have saved someone from destruction.
    Great article.

    • Hi Martin.
      Thank you for following our work.
      My FTDI programmer outputs around 3.4V on the VCC pin when it is switched to 3.3V with the jumper cap. So, I didn’t have any problem powering the ESP32-CAM through the 3.3V pin using the VCC output of the FTDI programmer (outputs 3.4V). Maybe yours isn’t exactly like ours…

  50. Great article.
    I see various people have trouble with the “Banggood model”
    Obviously I am not sure which model they got, but I presume it is the dirt cheap Geekcreit model (6 euro’s or something).
    I got one and didnt really have much trouble with it. It has an AI-Thinker chip on it, and that setting seems to work for me.
    If you freshly get that model, you may be in luck that it already has a working camera program in it, which is a good way to check if your model is actually working.
    What you need to do is to go to your WiFi AP list and select the camera AP (I forgot the exact name, but you will recognize it) connect to that. Subsequently go to and or /jpg to get either streaming or stills.
    That way you know your camera works fine or not.
    I reflashed mine, simply because I found the built in program a bit limited, mainly because it was on its own network.
    For the reflashing many good tips are given already:
    connect GPIO0 to ground and then reset.
    Use 5 Volt Vcc (but 3V3 FTDI module).
    Make sure you operate it with a decent PSU, decent in terms of current it can supply and cleanliness of the powerlines

    • Hi Ed.
      Thanks for sharing that tip. It is a great way to check if the camera is operating properly. However, we don’t know if all cameras come with a program in it.
      We have some ESP32-CAM boards from Banggood and they all work well.

      • That is totally correct. I checked again and the AP to show up (if a program is provided with it is ESP32_CAM
        And the webpages to go for are indeed, for streaming video and for stills.
        Do not expect a WiFimanager on (too bad)
        Thanks for all yr excellent articles, going to get some more ESP32-cams

  51. The one I got was this one:
    but I see it is no longer on sale for 6 Euro, but now costs a bit over 11 euro.
    Ofcourse I cannot garantee that on delivery it will be exactly the same model I got

  52. Correction, the above model still available for 6 Euro’s till end juli……if you select CN rather than UK as the sender

  53. I found that increasing the size of part_buf to 256 bytes greatly improved the speed of JPEG streaming. Just two lines to change:

    char * part_buf[64]

    if(res == ESP_OK){
    size_t hlen = snprintf((char *)part_buf, 256, _STREAM_PART, _jpg_buf_len);
    res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);

  54. I’ve finally found an easy to use free app that connects to multiple instances of the ESP32 cam board without issue, and allows remote viewing over the internet on a smartphone. It has all sorts of useful features like zoned motion detection that I haven’t had time to investigate yet. to download the desktop part of the app.

    Add cameras using the “Custom URL” tab in the “Add Source” window. Format is


    where the address is whatever your router has assigned to each ESP32 cam board.

    Hope that’s useful to others

    • Hi Geoff.
      Thank you for sharing. This is definitely something that our readers are looking for and are interested in.

  55. As always, great work! I have a comment and a question. There is an option under the board manager for AI Thinker ESP 32 Cam. When I used that instead of the ESP32 Wrover Module my camera worked. Before that I was getting an error message. The question I have is that I can view the camera from Home Assistant only when I am connected in my network at home. If I am away, I can’t see the camera. Any ideas? Thanks again for all that you do. Great work!

    • Hi John.
      You can only access the web server on your local network.
      I think home assistant has some options to access the dashboard from anywhere in the world.
      However, at the moment I don’t have any tutorial about that subject.
      Thank you for following our work

  56. I really appreciate all the effort you invest into these tutorials and videos. I tried this and I followed all your instructions and it worked after I selected the AI Thinker ESP 32 Cam option under the board manager. With this option you can only view the camera within your network and only one viewer at a time. Since this was not a solution what I wanted to implement, I look further into this and I found that you can easily integrate the same camera into Home Assistant using the Esp32 Cam node in EspHome. It’s much easier and now I can view my camera from anywhere and several people can access it at the same time. Thanks again for all your work.

  57. Edit: I just outcommented the dl_lib.h and the Webserver with Accesspoint is working fine.

    Kind regards and greetings from Switzerland 🙂


  58. I decided to buy one of this modules after reading the email from 13 June, but only today got a change to try it.

    I’ve bought my board on Ebay and it is not labeled as an “AI-Thinker” module.

    I’m working under Linux, just because Arduino IDE compile’s “years light” faster then under Windows.

    As usual there was a some troubles:
    1) The example did not compile, because “esp_camera.h” was missing. Solution: update the “esp32 by Espressif Systems version” (under Tools, Board, Boards Manager…) from version 1.0.0 to 1.0.2.
    2) When trying to upload there was an error message saying: “a fatal error occurred: Timed out waiting for packet content”. That one was hard to solve! I just solved it changing the “Upload Speed” (under Tools menu) from 921600 to 115200 (later I tried upper speeds and could got it at 460800); the one to blame it’s, maybe, my ftdi…?

    Finally it all worked as expected!

    Two final notes:
    1) Upload problems can be solved changing the “Upload Speed”.
    2) As John wrote on July 12, changing the Board to “AI Thinker ESP32-CAM” works very well and it removes the “Upload Speed” option from the Tools menu.

  59. Thanks for the tutorial, very useful, got it working after fiddling around a bit with the FTDI and things.

    About the code, I would like to set a lower resolution, say VGA because the default 1600×1200 is too much for the camera, fps is very low and image lagging
    How can I do that?


    • I figured it out, you have to change the FRAMESIZE_ parameter like this:
      config.frame_size = FRAMESIZE_VGA;

      Maybe it helps someone else

  60. I have non AIThinker cam module. There’s AP soft in it, under IP video works, but i can’t upload other soft. Serial monitor says “rst… waiting for upload” and “Failed to connect to ESP32: Timed out waiting for packet header”. I use 3,3V, 5V, Arduino IDE, esp idf, FTDI, CH340, CP2102, Windows 7 x64, Linux mint, IO0+GND, breadboard, female conectors, RST button hold or press … nothing. Serial monitor works on settings: 115200, 40MHz, DIO.
    I read that unplugging the camera or IO2+GND could help. Someone tried? I haven’t tested yet.

  61. Hi Sara
    Thank you for your projects
    Could you make a video tutorial for making a static IP address and post the video stream through it?


  62. Hi,
    Wonderful tutorials here. I followed one to connect my ESP32 Cam with Home Assistant. Is it possible to keep camera in deep sleep mode with a switch (software) to turn it on manually on need basis within Home Assistant? Appreciate any help.

    • Hi.
      I don’t think so.
      At least, at the moment I have no idea how to do that with a software switch. Because it needs to be awake to receive something from Home Assistant (via MQTT for example).

  63. I have a different issue. I get the sketch to upload then it stops with an error message. Same in 3v or 5v

    Chip is ESP32D0WDQ6 (revision 1)
    Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
    MAC: cc:50:e3:95:22:64
    Uploading stub…
    Running stub…
    Stub running…
    Changing baud rate to 921600
    Configuring flash size…
    Warning: Could not auto-detect Flash size (FlashID=0x0, SizeID=0x0), defaulting to 4MB
    Compressed 8192 bytes to 47…

    Writing at 0x0000e000… (100 %)
    Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 2048.0 kbit/s)…

    A fatal error occurred: Timed out waiting for packet header
    A fatal error occurred: Timed out waiting for packet header

  64. Dear Sara and Rui,

    please, do you know, why i cant connect to wifi ? I can see again just this in window. And again, again…

    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
    mode:DIO, clock div:1
    entry 0x400806a8

    Thanks so much

  65. Thanks for the great tutorial, I am looking at using my current build of MotionEyeOS on Raspberry Pi, and a cluster of 4 of these ESP32-cam’s and an old wifi router, to create a low power and dirt cheap backyard wildlife monitor. I will use the ESP32-CAM (x4) simply as wifi/IP cameras, I will probably remove the IR filters, and use some PIR’s with some IR Floodlights to illuminate the area at night. All of the ESP32-cams will connect to the router and the router will feed from the raspberry pi near the back yard. The raspberry pi will also have a Wifi dongle and connect to my home router, for accessing the MotionEyeOS. Then MotionEyeOS on the Raspberry Pi will do the motion detection, image/video storage, and can even do notifications and code executions based on the motion detection algorithm configurations in the software, no PIR’s needed for image or video recording based on motion in the video stream, and it is all accessible in one location.

  66. Hello,
    Super tutorial.
    I wish I could attach an infrared detector (IR) with a remote control, to be able to put the ESP32-CAM dormant and wake up when I want it remotely.
    Do you think it’s possible?
    I tried, but I can not
    Thank you

    • Hello I may have been poorly expressed because I write from France with a machine translation …
      Here, I would like to power my esp32-cam with 4 batteries of 1.2v and to save power, I would like to put the esp32-cam in sleep (deep sleep) with an infrared remote control, but I can not do the .ino program to achieve this, maybe this is not possible.
      My wish :
      Watch the streaming video, then put the esp32-cam on standby when I want, and later be able to put the streaming, all with a remote control and an infrared detector.
      You can tell me if this is possible and also how to do it, please?
      thank you in advance

  67. Hello
    May you have a sample using a esp32-cam to build a web server and take a photo in the microsd card without using the sample?
    Thank You

  68. After a fresh Arduino install (1.8.10) and loading of I got this:

    error: dl_lib.h: No such file or directory

    Upon searching I found someone saying that that library had been eliminated in an recent release, and the sketch would probably compile if the include was removed.

    I commented out the include line and the sketch did compile and download and run properly, with camera streaming.

    Thanks for this tutorial.

  69. Hello,

    I would like to have a fix IP address using my cellphone as personal hostpot. I’ve read the link you sent to me before “” but I’m still not able to make it work..

    Do you have any hints? Its impossible to know my gateway, since its 4G internet

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.