ESP32 ESP32 Projects guide Project Tech

ESP32-CAM Troubleshooting Guide: Most Common Problems Fixed

ESP32-CAM Troubleshooting Guide: Most Common Problems Fixed

After releasing some tasks with the ESP32-CAM, some readers reported points when making an attempt to make use of the ESP32-CAM. This information is a compilation with the most typical errors when utilizing the ESP32-CAM and tips on how to repair them.

ESP32-CAM Troubleshooting Guide: Most Common Problems Fixed

We’ve launched the next tasks with the ESP32-CAM:

Word: a few of our readers reported errors when making an attempt to comply with the ESP32-CAM challenge with House Assistant. We’ve modified some strains on the code, so a lot of the issues associated with that undertaking must be fastened.

Please observe that we couldn’t reproduce a number of the errors on our finish. Nevertheless, we’ve gathered all the knowledge given by our readers to get solutions to the most typical points.

When you’ve got a unique drawback or a special answer to those points, you’ll be able to share your ideas by writing a remark under.

Commonest errors:

  1. Failed to hook up with ESP32: Timed out ready for packet header
  2. Digital camera init failed with error 0x20001 or comparable
  3. Brownout detector or Guru meditation error
  4. Sketch too huge error – Improper partition scheme chosen
  5. Board at COMX just isn’t out there – COM Port Not Chosen
  6. Psram error: GPIO isr service isn’t put in
  7. Weak Wi-Fi Sign
  8. No IP Handle in Arduino IDE Serial Monitor
  9. Can’t open net server
  10. The picture lags/exhibits plenty of latency

1. Failed to hook up with ESP32: Timed out ready for packet header

ESP32-CAM Failed to connect to ESP32: Timed out waiting for packet header

This error signifies that the ESP32-CAM isn’t in flashing mode or it isn’t related correctly to the FTDI programmer.

Double-check the steps to add code

Double-check that you simply’ve adopted the precise steps to place your ESP32-CAM in flashing mode. Failing to finish one of many steps might end in that error. Right here’s the steps you have to comply with:

Join the ESP32-CAM board to your pc utilizing an FTDI programmer. Comply with the subsequent schematic diagram:

ESP32-CAM FTDI Programmer Wiring connect TX RX GND VCC

Essential: GPIO zero must be related to GND so that you simply’re capable of add code.

To add the code, comply with the subsequent steps:

  1. Go to Instruments > Board and choose ESP32 Wrover Module
  2. Go to Instruments > Port and choose the COM port the ESP32 is related to
  3. In Instruments > Partition Scheme, choose “Large APP (3MB No OTA)“
  4. Press the ESP32-CAM on-board RESET button
  5. Then, click on the Arduino IDE add button to add the sketch
ESP32-CAM select board, partition scheme and Port

GPIO zero have to be related to GND

Essential: in the event you can’t add the code, double-check that GPIO zero is related to GND and that you simply chosen the suitable settings within the Instruments menu. You also needs to press the on-board Reset button to restart your ESP32 in flashing mode. Additionally, verify that you’ve the FTDI programmer jumper cap set to three.3V.

Examine the FTDI programmer you’re utilizing

Considered one of our readers reported the next: “came upon you can program the board with a USB-to-TTL module mannequin CP2102 and that the CH340 mannequin does NOT work“. That is the FTDI programmer we’re utilizing.

Energy the ESP32-CAM with 5V

A few of our readers reported that they might solely add code when the ESP32 was powered with 5V. Nevertheless, we have been all the time profitable offering three.3V provide.

You possibly can’t add code

In case you can’t add code to the ESP32-CAM, comply with the strategies for the earlier difficulty.

2. Digital camera init failed with error 0x20001 or comparable

ESP32-CAM Camera init failed with error 0x20001 or similar

In case you get this actual error, it signifies that your digital camera OVX isn’t related correctly to your ESP32 board or you’ve gotten the fallacious pin task within the code.

Typically, unplugging and plugging the FTDI programmer a number of occasions or restart the board a number of occasions, may clear up the difficulty.

Digital camera not related correctly

The digital camera has a tiny connector and you should guarantee it’s related within the the instantly and with a safe match, in any other case it’s going to fail to determine a connection.

Fallacious pin task within the code

Once you get this error, it may additionally imply that you simply didn’t choose the fitting board within the outline part or the pin definition is improper on your board.

Be sure to choose the correct digital camera module in your tasks. You simply have to uncomment the correct digital camera module and remark all of the others:

//#outline CAMERA_MODEL_WROVER_KIT
//#outline CAMERA_MODEL_M5STACK_PSRAM
#outline CAMERA_MODEL_AI_THINKER

On this instance, we’re utilizing the CAMERA_MODEL_AI_THINKER, so it’s the one that’s enabled. In any other case, it’ll fail the pin task and the digital camera will fail to init.

There are various esp32-cam boards being launched (“pretend boards”) that the wiring between the ESP32 and the OV digital camera is perhaps totally different, so choosing the digital camera module, won’t be sufficient. You may have to verify every gpio declaration together with your board pinout.

For instance, M5Stack board with out PSRAM has a special pin task than the M5STACK with PSRAM (outlined on the code by default). So, you’ll want to change the pin definition within the code accordingly to the board pinout.

Not sufficient energy via USB supply

Some ESP32-CAM boards required 5V energy provide to work correctly. We’ve examined all our examples with three.3V they usually labored advantageous. Nevertheless, a few of our readers reported that this situation was fastened once they energy the ESP32-CAM with 5V.

Defective FTDI programmer

Some readers additionally reported this drawback was solved by changing their precise FTDI programmer with this one.

The digital camera/connector is damaged

For those who get this error, it may additionally imply that your digital camera or the digital camera ribbon is damaged. If that’s the case, you might get a brand new OV2640 digital camera probe.

three. Brownout detector or Guru meditation error

Whenever you open your Arduino IDE Serial monitor and the error message “Brownout detector was triggered” is consistently being printed again and again. It signifies that there’s some type of hardware drawback.

It’s typically associated to one of many following points:

  • Poor high quality USB cable;
  • USB cable is just too lengthy;
  • Board with some defect (dangerous solder joints);
  • Dangerous pc USB port;
  • Or not sufficient energy offered by the pc USB port.

Answer: 

  • attempt a special shorter USB cable (with knowledge wires)
  • use a special pc USB port or use a USB hub with an exterior energy provide
  • some readers reported that when powering the ESP32-CAM with 5V, the difficulty was fastened.

Additionally, comply with the recommendations described in concern three.

four. Sketch too huge error – Mistaken partition scheme chosen

ESP32-CAM Sketch too big error Wrong partition scheme selected

Once you get the next error:

Sketch too massive; see http://www.arduino.cc/en/Guide/Troubleshooting#size for recommendations on decreasing it.
Error compiling for board ESP32 Dev Module.

It signifies that you haven’t chosen the suitable partition scheme. Ensure you choose the fitting partition scheme. In your Arduino IDE, go to Instruments > Partition Scheme, choose “Large APP (3MB No OTA)“.

5. Board at COMX just isn’t obtainable – COM Port Not Chosen

ESP32-CAM COM Port Not Selected

In case you get the next error or comparable:

serial.serialutil.SerialException: couldn’t open port ‘COM8’: WindowsError(2, ‘The system can’t discover the file specified.’)
Did not execute script esptool
the chosen serial port Did not execute script esptool
doesn’t exist or your board is just not related
Board at COM8 just isn’t obtainable

It signifies that you haven’t chosen the COM port within the Instruments menu. In your Arduino IDE, go to Instruments > Port and choose the COM port the ESP32 is related to.

It may additionally imply that the ESP32-CAM shouldn’t be establishing a serial connection together with your pc or it isn’t correctly related to the USB connector.

6. Psram error: GPIO isr service is just not put in

ESP32-CAM Psram error GPIO isr service is not installed

You’re utilizing a board with out PSRAM and also you get the next error or comparable:

E (161) gpio: gpio_isr_handler_remove(380): GPIO isr service shouldn’t be put in, name gpio_install_isr_service() first
Digital camera init failed with error 0x101

when the board was initialized with the next settings:

config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;

Including the next fixes the problems (it lowers the picture decision so it gained’t want a lot area to retailer pictures. Nevertheless, in consequence, you can’t get some excessive decision codecs because of the restricted reminiscence):

if(psramFound())
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;

Observe: face recognition and detection doesn’t work with boards with out PSRAM. Nevertheless, you possibly can nonetheless use all the opposite functionalities of the board. For instance, though you’ll be able to’t use the face recognition and detection options of this challenge (ESP32-CAM Video Streaming and Face Recognition with Arduino IDE), you’ll be able to nonetheless play with the instance and discover the board options so long as you’ve got the suitable pin task within the code.

7. Weak Wi-Fi Sign

Some readers reported that after powering the ESP32-CAM with 5V, they’ve gotten a extra secure Wi-Fi sign.

Moreover, the ESP32-CAM board comes with a connector so as to add an exterior antenna. This may enhance sign power.

eight. No IP Handle in Arduino IDE Serial Monitor

f you simply see dots printed within the serial monitor (……), it signifies that your ESP32-CAM shouldn’t be establishing a Wi-Fi connection together with your router.

Double-check your community credentials

You should just remember to’ve typed your actual community credentials (SSID and password) within the following variables:

const char* ssid = “REPLACE_WITH_YOUR_SSID”;
const char* password = “REPLACE_WITH_YOUR_PASSWORD”;

Choose the appropriate baud price within the Arduino IDE Serial Monitor

For those who don’t choose the suitable baud fee within the Arduino IDE Serial Monitor, you gained’t get your board IP tackle otherwise you’ll simply get rubbish on the display.

Ensure you choose the fitting baud price. In our examples with the ESP32-CAM, we use 115200 baud price.

Reset the board a number of occasions

You may also have to press the ESP32-CAM on-board RESET button a number of occasions to restart your ESP and print the IP handle throughout boot.

RX and TX swapped

Double-check the connections between your ESP32 board and the FTDI programmer. RX goes to TX and TX goes to RX. If these connections are swapped, the ESP32-CAM is just not capable of set up a serial communication together with your pc.

Wi-Fi Vary

If the router is way away out of your ESP32 board, it won’t have the ability to catch the Wi-Fi sign. Be sure that your ESP32-CAM is pretty near your router.

9. Can’t open net server

If the ESP32-CAM is printing the IP tackle in your Arduino IDE Serial Monitor, however once you attempt to open the online server in your net browser you see a clean display, it often means that you’re making an attempt to entry the ESP32-CAM net server with a number of net browser tabs.

In the meanwhile, these ESP32-CAM sketches solely work with one shopper related at a time.

10. The picture lags/exhibits plenty of latency

Having some latency is regular for such a small and low cost digital camera. Some readers have recommended the next to scale back latency:

  • Energy the ESP32-CAM with a standalone 5V energy provide
  • Scale back the body measurement with the next in your code:
    config.frame_size = FRAMESIZE_SVGA or config.frame_size = FRAMESIZE_VGA

Utilizing bigger microSD card sizes

In response to he datasheet, the ESP32-CAM ought to solely helps 4GB microSD playing cards.

Nevertheless, we’ve examined with 16GB microSD card and it really works properly.

You won’t have the ability to retailer greater than 4GB, despite the fact that you have got 16GB. We haven’t examined storing greater than 4GB, so we’re unsure about this.

Are these tasks suitable with M5Stack board?

Sure, the M5Stack ESP32 board is suitable with out tasks. Nevertheless, you will need to verify your digital camera pinout to make sure you have the suitable task within the code.

You possibly can examine the M5Stack digital camera connections right here.

The way to set a hard and fast the IP Tackle

To set a static/fastened IP tackle, you’ll be able to comply with the subsequent tutorial:

Setting ESP32-CAM as Entry Level (AP)

You possibly can set your ESP32-CAM as an Entry Level (AP). This implies you’ll be able to hook up with your ESP32-CAM instantly with out having to hook up with your router. You need to use the next code to set your video streaming net server as an Entry Level:

/*********
Rui Santos
Full undertaking particulars at https://RandomNerdTutorials.com

IMPORTANT!!!
– Choose Board “ESP32 Wrover Module”
– Choose the Partion Scheme “Big APP (3MB No OTA)
– GPIO zero have to be related to GND to add a sketch
– After connecting GPIO zero to GND, press the ESP32-CAM on-board RESET button to place your board in flashing mode

Permission is hereby granted, freed from cost, to any individual acquiring a replica
of this software program and related documentation information.

The above copyright discover and this permission discover shall be included in all
copies or substantial parts of the Software program.
*********/

#embrace “esp_camera.h”
#embrace
#embrace “esp_timer.h”
#embrace “img_converters.h”
#embrace “Arduino.h”
#embrace “fb_gfx.h”
#embrace “soc/soc.h” //disable brownout issues
#embrace “soc/rtc_cntl_reg.h” //disable brownout issues
#embrace “dl_lib.h”
#embrace “esp_http_server.h”

// Exchange together with your community credentials
const char* ssid = “ESP32-Entry-Level”;
const char* password = “123456789”;

#outline PART_BOUNDARY “123456789000000000000987654321”

// This undertaking was examined with the AI Thinker Mannequin, M5STACK PSRAM Mannequin and M5STACK WITHOUT PSRAM
#outline CAMERA_MODEL_AI_THINKER
//#outline CAMERA_MODEL_M5STACK_PSRAM
//#outline CAMERA_MODEL_M5STACK_WITHOUT_PSRAM

// Not examined with this mannequin
//#outline CAMERA_MODEL_WROVER_KIT

#if outlined(CAMERA_MODEL_WROVER_KIT)
#outline PWDN_GPIO_NUM -1
#outline RESET_GPIO_NUM -1
#outline XCLK_GPIO_NUM 21
#outline SIOD_GPIO_NUM 26
#outline SIOC_GPIO_NUM 27

#outline Y9_GPIO_NUM 35
#outline Y8_GPIO_NUM 34
#outline Y7_GPIO_NUM 39
#outline Y6_GPIO_NUM 36
#outline Y5_GPIO_NUM 19
#outline Y4_GPIO_NUM 18
#outline Y3_GPIO_NUM 5
#outline Y2_GPIO_NUM four
#outline VSYNC_GPIO_NUM 25
#outline HREF_GPIO_NUM 23
#outline PCLK_GPIO_NUM 22

#elif outlined(CAMERA_MODEL_M5STACK_PSRAM)
#outline PWDN_GPIO_NUM -1
#outline RESET_GPIO_NUM 15
#outline XCLK_GPIO_NUM 27
#outline SIOD_GPIO_NUM 25
#outline SIOC_GPIO_NUM 23

#outline Y9_GPIO_NUM 19
#outline Y8_GPIO_NUM 36
#outline Y7_GPIO_NUM 18
#outline Y6_GPIO_NUM 39
#outline Y5_GPIO_NUM 5
#outline Y4_GPIO_NUM 34
#outline Y3_GPIO_NUM 35
#outline Y2_GPIO_NUM 32
#outline VSYNC_GPIO_NUM 22
#outline HREF_GPIO_NUM 26
#outline PCLK_GPIO_NUM 21

#elif outlined(CAMERA_MODEL_M5STACK_WITHOUT_PSRAM)
#outline PWDN_GPIO_NUM -1
#outline RESET_GPIO_NUM 15
#outline XCLK_GPIO_NUM 27
#outline SIOD_GPIO_NUM 25
#outline SIOC_GPIO_NUM 23

#outline Y9_GPIO_NUM 19
#outline Y8_GPIO_NUM 36
#outline Y7_GPIO_NUM 18
#outline Y6_GPIO_NUM 39
#outline Y5_GPIO_NUM 5
#outline Y4_GPIO_NUM 34
#outline Y3_GPIO_NUM 35
#outline Y2_GPIO_NUM 17
#outline VSYNC_GPIO_NUM 22
#outline HREF_GPIO_NUM 26
#outline PCLK_GPIO_NUM 21

#elif outlined(CAMERA_MODEL_AI_THINKER)
#outline PWDN_GPIO_NUM 32
#outline RESET_GPIO_NUM -1
#outline XCLK_GPIO_NUM zero
#outline SIOD_GPIO_NUM 26
#outline SIOC_GPIO_NUM 27

#outline Y9_GPIO_NUM 35
#outline Y8_GPIO_NUM 34
#outline Y7_GPIO_NUM 39
#outline Y6_GPIO_NUM 36
#outline Y5_GPIO_NUM 21
#outline Y4_GPIO_NUM 19
#outline Y3_GPIO_NUM 18
#outline Y2_GPIO_NUM 5
#outline VSYNC_GPIO_NUM 25
#outline HREF_GPIO_NUM 23
#outline PCLK_GPIO_NUM 22
#else
#error “Digital camera mannequin not chosen”
#endif

static const char* _STREAM_CONTENT_TYPE = “multipart/x-mixed-replace;boundary=” PART_BOUNDARY;
static const char* _STREAM_BOUNDARY = “rn–” PART_BOUNDARY “rn”;
static const char* _STREAM_PART = “Content material-Sort: picture/jpegrnContent-Size: %urnrn”;

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 = zero;
uint8_t * _jpg_buf = NULL;
char * part_buf[64];

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

whereas(true)
fb = esp_camera_fb_get();
if (!fb)
Serial.println(“Digital camera seize 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);
esp_camera_fb_return(fb);
fb = NULL;
if(!jpeg_converted)
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));

if(fb)
esp_camera_fb_return(fb);
fb = NULL;
_jpg_buf = NULL;
else if(_jpg_buf)
free(_jpg_buf);
_jpg_buf = NULL;

if(res != ESP_OK)
break;

//Serial.printf(“MJPG: %uBn”,(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 = “/”,
.technique = HTTP_GET,
.handler = stream_handler,
.user_ctx = NULL
;

//Serial.printf(“Beginning net 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, zero); //disable brownout detector

Serial.start(115200);
Serial.setDebugOutput(false);

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;

if(psramFound())
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;

// Digital camera init
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK)
Serial.printf(“Digital camera init failed with error 0xpercentx”, err);
return;

// Hook up with Wi-Fi community with SSID and password
Serial.print(“Setting AP (Entry Level)…”);
// Take away the password parameter, if you need the AP (Entry Level) to be open
WiFi.softAP(ssid, password);

IPAddress IP = WiFi.softAPIP();
Serial.print(“Digital camera Stream Prepared! Hook up with the ESP32 AP and go to: http://”);
Serial.println(IP);

// Begin streaming net server
startCameraServer();

void loop()
delay(1);

View uncooked code

To raised perceive the way it works, you possibly can learn the subsequent tutorial:

Wrapping Up

We hope you’ve discovered this troubleshooting information helpful and also you have been capable of make your ESP32-CAM work with our tasks.

When you have another points or ideas on the best way to repair them, please submit a remark under.

Thanks for studying.

P.S. It is rather obscure what’s flawed together with your challenge once we can’t reproduce the error on our finish. Nevertheless, in case you submit the error, there could be different readers with the identical concern/answer, so we encourage you to work together within the remark’s part.