{"id":85876,"date":"2019-11-12T10:04:47","date_gmt":"2019-11-12T10:04:47","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=85876"},"modified":"2024-06-15T10:55:46","modified_gmt":"2024-06-15T10:55:46","slug":"esp32-cam-troubleshooting-guide","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp32-cam-troubleshooting-guide\/","title":{"rendered":"ESP32-CAM Troubleshooting Guide: Most Common Problems Fixed"},"content":{"rendered":"\n<p>After releasing some projects with the <a href=\"https:\/\/makeradvisor.com\/tools\/esp32-cam\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"ESP32-CAM (opens in a new tab)\">ESP32-CAM<\/a>, some readers reported issues when trying to use the ESP32-CAM. This guide is a compilation with the most common errors when using the ESP32-CAM and how to fix them.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-Troubleshooting-Guide-Most-common-problems-fixed.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Troubleshooting Guide: Most Common Problems Fixed\" class=\"wp-image-86127\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-Troubleshooting-Guide-Most-common-problems-fixed.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-Troubleshooting-Guide-Most-common-problems-fixed.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-Troubleshooting-Guide-Most-common-problems-fixed.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-Troubleshooting-Guide-Most-common-problems-fixed.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p>We&#8217;ve released the following projects with the <a href=\"https:\/\/makeradvisor.com\/tools\/esp32-cam\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"ESP32-CAM (opens in a new tab)\">ESP32-CAM<\/a>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-video-streaming-face-recognition-arduino-ide\/\" target=\"_blank\" rel=\"noreferrer noopener\">Video Streaming, Face Detection and Face Recognition<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-video-streaming-web-server-camera-home-assistant\/\" target=\"_blank\" rel=\"noreferrer noopener\">ESP32 IP CAM \u2013 Video Streaming (Home Assistant and Node-RED)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-take-photo-save-microsd-card\/\" target=\"_blank\" rel=\"noreferrer noopener\">Take Photo and Save to MicroSD Card<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-pir-motion-detector-photo-capture\/\" target=\"_blank\" rel=\"noreferrer noopener\">PIR Motion Detector with Photo Capture<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-take-photo-display-web-server\/\" target=\"_blank\" rel=\"noreferrer noopener\">Take Photo, Save to SPIFFS and Display in Web Server<\/a> <\/li>\n<\/ul>\n\n\n\n<p class=\"rntbox rntclblue\"><strong>Note: <\/strong> some of our readers reported errors when trying to follow the <a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-video-streaming-web-server-camera-home-assistant\/\">ESP32-CAM project with Home Assistant<\/a>. We&#8217;ve modified some lines on the code, so most of the problems related with that project should be fixed.<\/p>\n\n\n\n<p>Please note that we couldn&#8217;t reproduce some of the errors on our end. However, we&#8217;ve gathered all the information given by our readers to get answers to the most common issues. <\/p>\n\n\n\n<p>If you have a different problem or a different solution to these issues, you can share your tips by writing a comment below.<\/p>\n\n\n\n<p><strong>Most common errors:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Failed to connect to ESP32: Timed out waiting for packet header<\/li>\n\n\n\n<li>Camera init failed with error 0x20001 or similar<\/li>\n\n\n\n<li>Brownout detector or Guru meditation error<\/li>\n\n\n\n<li>Sketch too big error &#8211; Wrong partition scheme selected<\/li>\n\n\n\n<li>Board at COMX is not available &#8211; COM Port Not Selected<\/li>\n\n\n\n<li>Psram error: GPIO isr service is not installed<\/li>\n\n\n\n<li>Weak Wi-Fi Signal<\/li>\n\n\n\n<li>No IP Address in Arduino IDE Serial Monitor<\/li>\n\n\n\n<li>Can\u2019t open web server<\/li>\n\n\n\n<li>The image lags\/shows lots of latency<\/li>\n\n\n\n<li>esp_camera_fb_get(): Failed to get the frame on time!<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">1. Failed to connect to ESP32: Timed out waiting for packet header <\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"1024\" height=\"232\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/fatal-error-occurred-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header.png?resize=1024%2C232&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Failed to connect to ESP32: Timed out waiting for packet header \" class=\"wp-image-85909\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/fatal-error-occurred-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header.png?resize=1024%2C232&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/fatal-error-occurred-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header.png?resize=300%2C68&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/fatal-error-occurred-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header.png?resize=768%2C174&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/fatal-error-occurred-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header.png?w=1184&amp;quality=100&amp;strip=all&amp;ssl=1 1184w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>This error means that the ESP32-CAM is not in flashing mode or it is not connected properly to the FTDI programmer.<\/p>\n\n\n\n<p><strong>Double-check the steps to upload code<\/strong><\/p>\n\n\n\n<p>Double-check that you\u2019ve followed the exact steps to put your ESP32-CAM in flashing mode. Failing to complete one of the steps may result in that error. Here&#8217;s the steps you need to follow:<\/p>\n\n\n\n<p>Connect the ESP32-CAM board to your computer using an FTDI programmer. Follow the next schematic diagram:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"877\" height=\"532\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/06\/ESP32-CAM-FTDI-programmer.png?resize=877%2C532&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM connected to an FTDI Programmer to upload program using Arduino IDE\" class=\"wp-image-159060\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/06\/ESP32-CAM-FTDI-programmer.png?w=877&amp;quality=100&amp;strip=all&amp;ssl=1 877w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/06\/ESP32-CAM-FTDI-programmer.png?resize=300%2C182&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/06\/ESP32-CAM-FTDI-programmer.png?resize=768%2C466&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 877px) 100vw, 877px\" \/><\/figure><\/div>\n\n\n<p class=\"rntbox rntcred\"><strong>Important: <\/strong> <span class=\"rnthl rntclgray\">GPIO 0<\/span> needs to be connected to <span class=\"rnthl rntcblack\">GND<\/span> so that you\u2019re able to upload code.<\/p>\n\n\n\n<p>Many FTDI programmers have a jumper that allows you to select 3.3V or 5V. Make sure the jumper is in the right place to select 5V.<\/p>\n\n\n\n<p><strong>Important:&nbsp;<\/strong>GPIO 0&nbsp;needs to be connected to&nbsp;GND&nbsp;so that you\u2019re able to upload code.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>ESP32-CAM<\/strong><\/td><td><strong>FTDI Programmer<\/strong><\/td><\/tr><tr><td>GND<\/td><td>GND<\/td><\/tr><tr><td>5V<\/td><td>VCC (5V)<\/td><\/tr><tr><td>U0R<\/td><td>TX<\/td><\/tr><tr><td>U0T<\/td><td>RX<\/td><\/tr><tr><td>GPIO 0<\/td><td>GND<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>To upload the code, follow the next steps:<\/p>\n\n\n\n<p>1) Go to&nbsp;<strong>Tools&nbsp;<\/strong>&gt;&nbsp;<strong>Board&nbsp;<\/strong>and select&nbsp;<strong>AI-Thinker ESP32-CAM<\/strong>.<\/p>\n\n\n\n<p>2) Go to&nbsp;<strong>Tools&nbsp;<\/strong>&gt;&nbsp;<strong>Port&nbsp;<\/strong>and select the COM port the ESP32 is connected to.<\/p>\n\n\n\n<p>3) Then, click the upload button to upload the code.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"32\" height=\"32\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/upload-button-arduino-ide.png?resize=32%2C32&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-91745\"\/><\/figure><\/div>\n\n\n<p>4) When you start to see these dots on the debugging window as shown below, press the ESP32-CAM on-board RST button.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1009\" height=\"91\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/dots-uploading-code.png?resize=1009%2C91&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"\" class=\"wp-image-91746\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/dots-uploading-code.png?w=1009&amp;quality=100&amp;strip=all&amp;ssl=1 1009w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/dots-uploading-code.png?resize=300%2C27&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/12\/dots-uploading-code.png?resize=768%2C69&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1009px) 100vw, 1009px\" \/><\/figure>\n\n\n\n<p>After a few seconds, the code should be successfully uploaded to your board.<\/p>\n\n\n\n<p><strong>GPIO 0 must be connected to GND<\/strong><\/p>\n\n\n\n<p class=\"rntbox rntcred\"><strong>Important: <\/strong> if you can&#8217;t upload the code, double-check that <span class=\"rnthl rntclgray\">GPIO 0<\/span> is connected to <span class=\"rnthl rntcblack\">GND<\/span> and that you selected the right settings in the <strong>Tools <\/strong>menu. You should also press the on-board Reset button to restart your ESP32 in flashing mode. Also, check that you have the FTDI programmer jumper cap set to 5V.<\/p>\n\n\n\n<p><strong>Check the FTDI programmer you are using<\/strong><\/p>\n\n\n\n<p>One of our readers reported the following: &#8220;<em>found out that you can program the board with a USB-to-TTL module model CP2102 and that the CH340 model does NOT work<\/em>&#8220;. <a href=\"https:\/\/makeradvisor.com\/tools\/ftdi-programmer-board\/\">This is the FTDI programmer we&#8217;re using<\/a>. <\/p>\n\n\n\n<p><strong>Power the ESP32-CAM with 5V<\/strong><\/p>\n\n\n\n<p>Some of our readers reported that they could only upload code when the ESP32 was powered with 5V. So, power the ESP32-CAM with 5V.<\/p>\n\n\n\n<p><strong>FTDI Programmer 5V<\/strong><\/p>\n\n\n\n<p>Measure the output voltage of your <a rel=\"noreferrer noopener\" aria-label=\"FTDI programmer (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/ftdi-programmer-board\/\" target=\"_blank\">FTDI programmer<\/a> (VCC and GND) using a <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/aneng-an8002-an8008-multimeter-review\/\" target=\"_blank\">Multimeter<\/a> to ensure it&#8217;s providing 5V to your ESP32-CAM.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/02\/FTDI-Programmer-output-5V-750.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"FTDI Programmer output 5V multimeter\" class=\"wp-image-94397\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/02\/FTDI-Programmer-output-5V-750.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/02\/FTDI-Programmer-output-5V-750.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">2. Camera init failed with error 0x20001 or similar<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1019\" height=\"525\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-not-connected.png?resize=1019%2C525&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Camera init failed with error 0x20001 or similar\" class=\"wp-image-85908\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-not-connected.png?w=1019&amp;quality=100&amp;strip=all&amp;ssl=1 1019w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-not-connected.png?resize=300%2C155&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-not-connected.png?resize=768%2C396&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1019px) 100vw, 1019px\" \/><\/figure><\/div>\n\n\n<p>If you get this exact error, it means that your camera OVX is not connected properly to your ESP32 board or you have the wrong pin assignment in the code.<\/p>\n\n\n\n<p>Sometimes, unplugging and plugging the FTDI programmer multiple times or restart the board multiple times, might solve the issue. <\/p>\n\n\n\n<p><strong>Camera not connected properly<\/strong><\/p>\n\n\n\n<p>The camera has a tiny connector and you must ensure it\u2019s connected in the the right away and with a secure fit, otherwise it will fail to establish a connection. <\/p>\n\n\n\n<p><strong>Wrong pin assignment in the code<\/strong><\/p>\n\n\n\n<p>When you get this error, it might also mean that you didn\u2019t select the right board in the define section or the pin definition is wrong for your board.<\/p>\n\n\n\n<p>Make sure you select the right camera module in your projects. You just need to uncomment the right camera module and comment all the others:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/#define CAMERA_MODEL_WROVER_KIT\n\/\/#define CAMERA_MODEL_M5STACK_PSRAM\n#define CAMERA_MODEL_AI_THINKER<\/code><\/pre>\n\n\n\n<p>In this example, we\u2019re using the CAMERA_MODEL_AI_THINKER, so it\u2019s the one that is enabled. Otherwise, it will fail the pin assignment and the camera will fail to init. <\/p>\n\n\n\n<p>There are many esp32-cam boards being released (\u201cfake boards\u201d) that the wiring between the ESP32 and the OV camera might be different, so selecting the camera module, might not be enough. You might need to check each gpio declaration with your board pinout.<\/p>\n\n\n\n<p>For example, M5Stack board <em>without <\/em>PSRAM has a different pin assignment than the M5STACK <em>with <\/em>PSRAM (defined on the code by default). So, you need to change the pin definition in the code accordingly to the board pinout.<\/p>\n\n\n\n<p><strong>Not enough power through USB source<\/strong><\/p>\n\n\n\n<p>If you&#8217;re powering your ESP32 through a USB port on your computer, it might not be supplying enough power.<\/p>\n\n\n\n<p><strong>Faulty FTDI programmer<\/strong><\/p>\n\n\n\n<p>Some readers also reported this problem was solved by replacing their actual FTDI programmer <a href=\"https:\/\/makeradvisor.com\/tools\/ftdi-programmer-board\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">with this one<\/a>. <\/p>\n\n\n\n<p><strong>The camera\/connector is broken<\/strong><\/p>\n\n\n\n<p>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. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Brownout detector or Guru meditation error<\/h2>\n\n\n\n<p>When you open your Arduino IDE Serial monitor and the error message \u201cBrownout detector was triggered\u201d is constantly being printed over and over again. It means that there\u2019s some sort of hardware problem.<\/p>\n\n\n\n<p>It\u2019s often related to one of the following issues:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Poor quality USB cable;<\/li>\n\n\n\n<li>USB cable is too long;<\/li>\n\n\n\n<li>Board with some defect (bad solder joints);<\/li>\n\n\n\n<li>Bad computer USB port;<\/li>\n\n\n\n<li>Or not enough power provided by the computer USB port.<\/li>\n<\/ul>\n\n\n\n<p><strong>Solution:<\/strong>&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>try a different shorter USB cable (with data wires)<\/li>\n\n\n\n<li>use a different computer USB port or use a USB hub with an external power supply<\/li>\n\n\n\n<li>some readers reported that when powering the ESP32-CAM with 5V, the issue was fixed.<\/li>\n<\/ul>\n\n\n\n<p>Also, follow the suggestions  described in issue 2.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Sketch too big error &#8211; Wrong partition scheme selected<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"232\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-ERROR-1024x232.png?resize=1024%2C232&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Sketch too big error Wrong partition scheme selected\" class=\"wp-image-85907\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-ERROR.png?resize=1024%2C232&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-ERROR.png?resize=300%2C68&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-ERROR.png?resize=768%2C174&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-ERROR.png?w=1184&amp;quality=100&amp;strip=all&amp;ssl=1 1184w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>When you get the following error:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Sketch too big; see http:\/\/www.arduino.cc\/en\/Guide\/Troubleshooting#size for tips on reducing it.\nError compiling for board ESP32 Dev Module.<\/code><\/pre>\n\n\n\n<p>It means that you haven&#8217;t selected the right partition scheme. Make sure you select the right partition scheme. In your Arduino IDE, go to <strong>Tools <\/strong>&gt; <strong>Partition Scheme<\/strong>, select &#8220;<strong>Huge APP (3MB No OTA)<\/strong>&#8220;. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. Board at COMX is not available &#8211; COM Port Not Selected<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"233\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/no-com-port-selected.png?resize=1024%2C233&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM COM Port Not Selected\" class=\"wp-image-85911\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/no-com-port-selected.png?resize=1024%2C233&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/no-com-port-selected.png?resize=300%2C68&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/no-com-port-selected.png?resize=768%2C174&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/no-com-port-selected.png?w=1184&amp;quality=100&amp;strip=all&amp;ssl=1 1184w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>If you get the following error or similar:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>serial.serialutil.SerialException: could not open port 'COM8': WindowsError(2, 'The system cannot find the file specified.')\nFailed to execute script esptool\nthe selected serial port Failed to execute script esptool\n does not exist or your board is not connected\nBoard at COM8 is not available<\/code><\/pre>\n\n\n\n<p>It means that you haven&#8217;t selected the COM port in the Tools menu. In your Arduino IDE, go to <strong>Tools <\/strong>&gt; <strong>Port <\/strong>and select the COM port the ESP32 is connected to.<\/p>\n\n\n\n<p>It might also mean that the ESP32-CAM is not establishing a serial connection with your computer or it is not properly connected to the USB connector. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6. Psram error: GPIO isr service is not installed<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"895\" height=\"525\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/gpio_isr_handler_remove-error-message.png?resize=895%2C525&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM Psram error GPIO isr service is not installed\" class=\"wp-image-85910\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/gpio_isr_handler_remove-error-message.png?w=895&amp;quality=100&amp;strip=all&amp;ssl=1 895w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/gpio_isr_handler_remove-error-message.png?resize=300%2C176&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/gpio_isr_handler_remove-error-message.png?resize=768%2C451&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 895px) 100vw, 895px\" \/><\/figure><\/div>\n\n\n<p>You are using a board without PSRAM and you get the following error or similar:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>E (161) gpio: gpio_isr_handler_remove(380): GPIO isr service is not installed, call gpio_install_isr_service() first\nCamera init failed with error 0x101<\/code><\/pre>\n\n\n\n<p>when the board was initialized with the following settings:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>config.frame_size = FRAMESIZE_UXGA;\nconfig.jpeg_quality = 10;\nconfig.fb_count = 2;<\/code><\/pre>\n\n\n\n<p>Adding the following fixes the issues (it lowers the image resolution so it won&#8217;t need so much space to store images. However, as a result, you cannot get some high resolution formats due to the limited memory): <\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>if(psramFound()){\n  config.frame_size = FRAMESIZE_UXGA;\n  config.jpeg_quality = 10;\n  config.fb_count = 2;\n} else {\n  config.frame_size = FRAMESIZE_SVGA;\n  config.jpeg_quality = 12;\n  config.fb_count = 1;\n}<\/code><\/pre>\n\n\n\n<p><strong>Note: <\/strong> face recognition and detection doesn&#8217;t work with boards without PSRAM. However, you can still use all the other functionalities of the board. For example, although you can&#8217;t use the face recognition and detection features of this project (<a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-video-streaming-face-recognition-arduino-ide\/\">ESP32-CAM Video Streaming and Face Recognition with Arduino IDE<\/a>), you can still play with the example and explore the board features as long as you have the right pin assignment in the code. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7. Weak Wi-Fi Signal<\/h2>\n\n\n\n<p>Some readers reported that after powering the ESP32-CAM with 5V, they&#8217;ve gotten a more stable Wi-Fi signal. You can read this dedicated guide to learn <a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-connect-external-antenna\/\">how to connect an external antenna to the ESP32-CAM and extend Wi-Fi coverage<\/a>.<\/p>\n\n\n\n<p>The ESP32-CAM has the option to use either the built-in antenna or an external antenna. If your ESP32-CAM AI-Thinker has no Wi-Fi connection or poor connection, it might have the external antenna enabled.<strong>&nbsp;If you connect an external antenna to the connector, it should work fine.<\/strong><\/p>\n\n\n\n<p>Check if the jumper 0K resistor by the antenna connector is in the proper position for the  desired antenna. There are 3 little white squares laid out like a &#8220;&lt;&#8221; with the middle position being common. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"426\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/esp32-cam-antenna.jpg?resize=640%2C426&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32-CAM external and built-in antenna\" class=\"wp-image-86355\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/esp32-cam-antenna.jpg?w=640&amp;quality=100&amp;strip=all&amp;ssl=1 640w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/esp32-cam-antenna.jpg?resize=300%2C200&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><figcaption class=\"wp-element-caption\">Photo courtesy of Helmut Schoenborn<\/figcaption><\/figure><\/div>\n\n\n<p>The following photo shows a closer look at that area. You can clearly see a small 0K resistor connecting to the built-in antenna.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"748\" height=\"423\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/esp32-cam-connected-built-in-antenna.jpg?resize=748%2C423&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"esp32-cam connected to built-in antenna\" class=\"wp-image-86541\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/esp32-cam-connected-built-in-antenna.jpg?w=748&amp;quality=100&amp;strip=all&amp;ssl=1 748w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/esp32-cam-connected-built-in-antenna.jpg?resize=300%2C170&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 748px) 100vw, 748px\" \/><figcaption class=\"wp-element-caption\"> Photo courtesy of Helmut Schoenborn <\/figcaption><\/figure><\/div>\n\n\n<p>With board turned so the the PCB antenna is up:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To use the PCB antenna, the resistor must be on the top position, like this: \/<\/li>\n\n\n\n<li>For the antenna connector, the resistor must be on the bottom position, like this: \\<\/li>\n<\/ul>\n\n\n\n<p>So, to enable the on-board antenna:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Unsolder the resistor that goes to the antenna, it&#8217;s in this position \\<\/li>\n\n\n\n<li>And solder together the two connections to enable the on-board antenna.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">8. No IP Address in Arduino IDE Serial Monitor<\/h2>\n\n\n\n<p>f you just see dots printed in the serial monitor (\u2026\u2026), it means that your ESP32-CAM is not establishing a Wi-Fi connection with your router. <\/p>\n\n\n\n<p><strong>Double-check your network credentials<\/strong><\/p>\n\n\n\n<p>You need to make sure that you\u2019ve typed your exact network credentials (SSID and password) in the following variables:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>const char* ssid = \"REPLACE_WITH_YOUR_SSID\";\nconst char* password = \"REPLACE_WITH_YOUR_PASSWORD\";<\/code><\/pre>\n\n\n\n<p><strong>Select the right baud rate in the Arduino IDE Serial Monitor<\/strong><\/p>\n\n\n\n<p>If you don&#8217;t select the right baud rate in the Arduino IDE Serial Monitor, you won&#8217;t get your board IP address or you&#8217;ll just get garbage on the screen.<\/p>\n\n\n\n<p>Make sure you select the right baud rate. In our examples with the ESP32-CAM, we use 115200 baud rate.<\/p>\n\n\n\n<p><strong>Reset the board multiple times<\/strong><\/p>\n\n\n\n<p>You might also need to press the ESP32-CAM on-board RESET button multiple times to restart your ESP and print the IP address during boot.<\/p>\n\n\n\n<p><strong>RX and TX swapped<\/strong><\/p>\n\n\n\n<p>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 not able to establish a serial communication with your computer.<\/p>\n\n\n\n<p><strong>Wi-Fi Range<\/strong><\/p>\n\n\n\n<p>If the router is far away from your ESP32 board, it might not be able to catch the Wi-Fi signal. Ensure that your ESP32-CAM is fairly close to your router.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9. Can\u2019t open web server<\/h2>\n\n\n\n<p>If the ESP32-CAM is printing the IP address in your Arduino IDE Serial Monitor, but when you try to open the web server in your web browser you see a blank screen, it usually means that you are trying to access the ESP32-CAM web server with multiple web browser tabs.<\/p>\n\n\n\n<p>At the moment, these ESP32-CAM sketches only work with one client connected at a time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">10. The image lags\/shows lots of latency<\/h2>\n\n\n\n<p>Having some latency is normal for such a small and cheap camera. Some readers have suggested the following to reduce latency:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Power the ESP32-CAM with a standalone 5V power supply<\/li>\n\n\n\n<li>Reduce the frame size with the following in your code:<br> <span class=\"rnthl rntliteral\">config.frame_size = FRAMESIZE_SVGA<\/span> or <span class=\"rnthl rntliteral\">config.frame_size = FRAMESIZE_VGA<\/span><\/li>\n\n\n\n<li>Use an external antenna.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">11. esp_camera_fb_get(): Failed to get the frame on time! <\/h2>\n\n\n\n<p>We&#8217;ve personally never faced this issue. However, many readers are getting this error with their ESP32-CAM boards. <\/p>\n\n\n\n<p>One of our readers (Fibula) suggested the following to solve this issue:<\/p>\n\n\n\n<p>&#8220;Im using the ESP32-CAM Module 2MP OV2640 Camera sensor Module Type-C USB module from Aliexpress. Although not mentioned, It doesn\u2019t have the extra PSRAM the other M5 models do, and the camera has one changed IO pin. <\/p>\n\n\n\n<p>See here:&nbsp;<a href=\"https:\/\/github.com\/m5stack\/m5stack-cam-psram\/blob\/master\/README.md\">https:\/\/github.com\/m5stack\/m5stack-cam-psram\/blob\/master\/README.md<\/a>&nbsp;and scroll down to Interface Comparison. <\/p>\n\n\n\n<p>The CameraWebServer Arduino example we\u2019re probably all using doesn&#8217;t have this ESP32-CAM model defined. <\/p>\n\n\n\n<p>You need to add it yourself in the main tab add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#define CAMERA_MODEL_M5STACK_NO_PSRAM<\/code><\/pre>\n\n\n\n<p> And in the <em>camera_pins.h <\/em>tab add the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#elif defined(CAMERA_MODEL_M5STACK_NO_PSRAM)\n#define PWDN_GPIO_NUM -1\n#define RESET_GPIO_NUM 15\n#define XCLK_GPIO_NUM 27\n#define SIOD_GPIO_NUM 25\n#define SIOC_GPIO_NUM 23\n#define Y9_GPIO_NUM 19\n#define Y8_GPIO_NUM 36\n#define Y7_GPIO_NUM 18\n#define Y6_GPIO_NUM 39\n#define Y5_GPIO_NUM 5\n#define Y4_GPIO_NUM 34\n#define Y3_GPIO_NUM 35\n#define Y2_GPIO_NUM 17\n#define VSYNC_GPIO_NUM 22\n#define HREF_GPIO_NUM 26\n#define PCLK_GPIO_NUM 21<\/code><\/pre>\n\n\n\n<p>And you\u2019re good to go.<\/p>\n\n\n\n<p>Also note that the max resolution of the bare ESP32-CAM Module is XGA 1024&#215;768, I assume also because of the lack of PSRAM. &#8220;<\/p>\n\n\n\n<p>We hope this suggestion solves your issue. Let us know in the comments section.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using larger microSD card sizes<\/h2>\n\n\n\n<p>According to he datasheet, the ESP32-CAM should only supports 4GB microSD cards. <\/p>\n\n\n\n<p>However, we\u2019ve tested with <a href=\"https:\/\/makeradvisor.com\/tools\/microsd-card-raspberry-pi-16gb-class-10\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"16GB microSD card (opens in a new tab)\">16GB microSD card<\/a> and it works well. <\/p>\n\n\n\n<p>You might not be able to store more than 4GB, even though you have 16GB. We haven\u2019t tested storing more than 4GB, so we&#8217;re not sure about this.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Are these projects compatible with M5Stack board?<\/h2>\n\n\n\n<p>Yes, the <a rel=\"noreferrer noopener nofollow\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.banggood.com\/M5Stack-Official-ESP32-Camera-Module-Development-Board-OV2640-Camera-Type-C-Grove-Port-p-1333598.html?p=MA240439985285201910\" target=\"_blank\">M5Stack ESP32<\/a> board is compatible with out projects. However, you must check your camera pinout to ensure you have the right assignment in the code.<\/p>\n\n\n\n<p>You can check the <a rel=\"noreferrer noopener nofollow\" aria-label=\"M5Stack (opens in a new tab)\" href=\"https:\/\/www.banggood.com\/M5Stack-Official-ESP32-Camera-Module-Development-Board-OV2640-Camera-Type-C-Grove-Port-p-1333598.html?p=MA240439985285201910\" target=\"_blank\">M5Stack<\/a> camera connections <a href=\"https:\/\/github.com\/m5stack\/m5stack-cam-psram\/blob\/master\/README.md\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to set a fixed the IP Address<\/h2>\n\n\n\n<p>To set a static\/fixed IP address, you can follow the next tutorial:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-static-fixed-ip-address-arduino-ide\/\">ESP32 Static\/Fixed IP Address<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Setting ESP32-CAM as Access Point (AP)<\/h2>\n\n\n\n<p>You can set your ESP32-CAM as an Access Point (AP). This means you are able to connect to your ESP32-CAM directly without having to connect to your router. You can use the following code to set your<a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-video-streaming-web-server-camera-home-assistant\/\"> video streaming web server<\/a> as an Access Point:<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">  \/*********\n  Rui Santos\n  Complete project details at https:\/\/RandomNerdTutorials.com\/esp32-cam-video-streaming-web-server-camera-home-assistant\/\n  \n  IMPORTANT!!! \n   - Select Board &quot;AI Thinker ESP32-CAM&quot;\n   - GPIO 0 must be connected to GND to upload a sketch\n   - After connecting GPIO 0 to GND, press the ESP32-CAM on-board RESET button to put your board in flashing mode\n  \n  Permission is hereby granted, free of charge, to any person obtaining a copy\n  of this software and associated documentation files.\n\n  The above copyright notice and this permission notice shall be included in all\n  copies or substantial portions of the Software.\n*********\/\n\n#include &quot;esp_camera.h&quot;\n#include &lt;WiFi.h&gt;\n#include &quot;esp_timer.h&quot;\n#include &quot;img_converters.h&quot;\n#include &quot;Arduino.h&quot;\n#include &quot;fb_gfx.h&quot;\n#include &quot;soc\/soc.h&quot; \/\/disable brownout problems\n#include &quot;soc\/rtc_cntl_reg.h&quot;  \/\/disable brownout problems\n#include &quot;esp_http_server.h&quot;\n\n\/\/ Replace with your network credentials\nconst char* ssid     = &quot;ESP32-Access-Point&quot;;\nconst char* password = &quot;123456789&quot;;\n\n#define PART_BOUNDARY &quot;123456789000000000000987654321&quot;\n\n\/\/ This project was tested with the AI Thinker Model, M5STACK PSRAM Model and M5STACK WITHOUT PSRAM\n#define CAMERA_MODEL_AI_THINKER\n\/\/#define CAMERA_MODEL_M5STACK_PSRAM\n\/\/#define CAMERA_MODEL_M5STACK_WITHOUT_PSRAM\n\/\/#define CAMERA_MODEL_M5STACK_WIDE\n\n\/\/ Not tested with this model\n\/\/#define CAMERA_MODEL_WROVER_KIT\n\n#if defined(CAMERA_MODEL_WROVER_KIT)\n  #define PWDN_GPIO_NUM    -1\n  #define RESET_GPIO_NUM   -1\n  #define XCLK_GPIO_NUM    21\n  #define SIOD_GPIO_NUM    26\n  #define SIOC_GPIO_NUM    27\n  \n  #define Y9_GPIO_NUM      35\n  #define Y8_GPIO_NUM      34\n  #define Y7_GPIO_NUM      39\n  #define Y6_GPIO_NUM      36\n  #define Y5_GPIO_NUM      19\n  #define Y4_GPIO_NUM      18\n  #define Y3_GPIO_NUM       5\n  #define Y2_GPIO_NUM       4\n  #define VSYNC_GPIO_NUM   25\n  #define HREF_GPIO_NUM    23\n  #define PCLK_GPIO_NUM    22\n\n#elif defined(CAMERA_MODEL_M5STACK_WIDE)\n  #define PWDN_GPIO_NUM     -1\n  #define RESET_GPIO_NUM    15\n  #define XCLK_GPIO_NUM     27\n  #define SIOD_GPIO_NUM     22\n  #define SIOC_GPIO_NUM     23\n\n  #define Y9_GPIO_NUM       19\n  #define Y8_GPIO_NUM       36\n  #define Y7_GPIO_NUM       18\n  #define Y6_GPIO_NUM       39\n  #define Y5_GPIO_NUM        5\n  #define Y4_GPIO_NUM       34\n  #define Y3_GPIO_NUM       35\n  #define Y2_GPIO_NUM       32\n  #define VSYNC_GPIO_NUM    25\n  #define HREF_GPIO_NUM     26\n  #define PCLK_GPIO_NUM     21\n\n#elif defined(CAMERA_MODEL_M5STACK_PSRAM)\n  #define PWDN_GPIO_NUM     -1\n  #define RESET_GPIO_NUM    15\n  #define XCLK_GPIO_NUM     27\n  #define SIOD_GPIO_NUM     25\n  #define SIOC_GPIO_NUM     23\n  \n  #define Y9_GPIO_NUM       19\n  #define Y8_GPIO_NUM       36\n  #define Y7_GPIO_NUM       18\n  #define Y6_GPIO_NUM       39\n  #define Y5_GPIO_NUM        5\n  #define Y4_GPIO_NUM       34\n  #define Y3_GPIO_NUM       35\n  #define Y2_GPIO_NUM       32\n  #define VSYNC_GPIO_NUM    22\n  #define HREF_GPIO_NUM     26\n  #define PCLK_GPIO_NUM     21\n\n#elif defined(CAMERA_MODEL_M5STACK_WITHOUT_PSRAM)\n  #define PWDN_GPIO_NUM     -1\n  #define RESET_GPIO_NUM    15\n  #define XCLK_GPIO_NUM     27\n  #define SIOD_GPIO_NUM     25\n  #define SIOC_GPIO_NUM     23\n  \n  #define Y9_GPIO_NUM       19\n  #define Y8_GPIO_NUM       36\n  #define Y7_GPIO_NUM       18\n  #define Y6_GPIO_NUM       39\n  #define Y5_GPIO_NUM        5\n  #define Y4_GPIO_NUM       34\n  #define Y3_GPIO_NUM       35\n  #define Y2_GPIO_NUM       17\n  #define VSYNC_GPIO_NUM    22\n  #define HREF_GPIO_NUM     26\n  #define PCLK_GPIO_NUM     21\n\n#elif defined(CAMERA_MODEL_AI_THINKER)\n  #define PWDN_GPIO_NUM     32\n  #define RESET_GPIO_NUM    -1\n  #define XCLK_GPIO_NUM      0\n  #define SIOD_GPIO_NUM     26\n  #define SIOC_GPIO_NUM     27\n  \n  #define Y9_GPIO_NUM       35\n  #define Y8_GPIO_NUM       34\n  #define Y7_GPIO_NUM       39\n  #define Y6_GPIO_NUM       36\n  #define Y5_GPIO_NUM       21\n  #define Y4_GPIO_NUM       19\n  #define Y3_GPIO_NUM       18\n  #define Y2_GPIO_NUM        5\n  #define VSYNC_GPIO_NUM    25\n  #define HREF_GPIO_NUM     23\n  #define PCLK_GPIO_NUM     22\n#else\n  #error &quot;Camera model not selected&quot;\n#endif\n\nstatic const char* _STREAM_CONTENT_TYPE = &quot;multipart\/x-mixed-replace;boundary=&quot; PART_BOUNDARY;\nstatic const char* _STREAM_BOUNDARY = &quot;\\r\\n--&quot; PART_BOUNDARY &quot;\\r\\n&quot;;\nstatic const char* _STREAM_PART = &quot;Content-Type: image\/jpeg\\r\\nContent-Length: %u\\r\\n\\r\\n&quot;;\n\nhttpd_handle_t stream_httpd = NULL;\n\nstatic esp_err_t stream_handler(httpd_req_t *req){\n  camera_fb_t * fb = NULL;\n  esp_err_t res = ESP_OK;\n  size_t _jpg_buf_len = 0;\n  uint8_t * _jpg_buf = NULL;\n  char * part_buf[64];\n\n  res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);\n  if(res != ESP_OK){\n    return res;\n  }\n\n  while(true){\n    fb = esp_camera_fb_get();\n    if (!fb) {\n      Serial.println(&quot;Camera capture failed&quot;);\n      res = ESP_FAIL;\n    } else {\n      if(fb-&gt;width &gt; 400){\n        if(fb-&gt;format != PIXFORMAT_JPEG){\n          bool jpeg_converted = frame2jpg(fb, 80, &amp;_jpg_buf, &amp;_jpg_buf_len);\n          esp_camera_fb_return(fb);\n          fb = NULL;\n          if(!jpeg_converted){\n            Serial.println(&quot;JPEG compression failed&quot;);\n            res = ESP_FAIL;\n          }\n        } else {\n          _jpg_buf_len = fb-&gt;len;\n          _jpg_buf = fb-&gt;buf;\n        }\n      }\n    }\n    if(res == ESP_OK){\n      size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len);\n      res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);\n    }\n    if(res == ESP_OK){\n      res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);\n    }\n    if(res == ESP_OK){\n      res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));\n    }\n    if(fb){\n      esp_camera_fb_return(fb);\n      fb = NULL;\n      _jpg_buf = NULL;\n    } else if(_jpg_buf){\n      free(_jpg_buf);\n      _jpg_buf = NULL;\n    }\n    if(res != ESP_OK){\n      break;\n    }\n    \/\/Serial.printf(&quot;MJPG: %uB\\n&quot;,(uint32_t)(_jpg_buf_len));\n  }\n  return res;\n}\n\nvoid startCameraServer(){\n  httpd_config_t config = HTTPD_DEFAULT_CONFIG();\n  config.server_port = 80;\n\n  httpd_uri_t index_uri = {\n    .uri       = &quot;\/&quot;,\n    .method    = HTTP_GET,\n    .handler   = stream_handler,\n    .user_ctx  = NULL\n  };\n  \n  \/\/Serial.printf(&quot;Starting web server on port: '%d'\\n&quot;, config.server_port);\n  if (httpd_start(&amp;stream_httpd, &amp;config) == ESP_OK) {\n    httpd_register_uri_handler(stream_httpd, &amp;index_uri);\n  }\n}\n\nvoid setup() {\n  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); \/\/disable brownout detector\n \n  Serial.begin(115200);\n  Serial.setDebugOutput(false);\n  \n  camera_config_t config;\n  config.ledc_channel = LEDC_CHANNEL_0;\n  config.ledc_timer = LEDC_TIMER_0;\n  config.pin_d0 = Y2_GPIO_NUM;\n  config.pin_d1 = Y3_GPIO_NUM;\n  config.pin_d2 = Y4_GPIO_NUM;\n  config.pin_d3 = Y5_GPIO_NUM;\n  config.pin_d4 = Y6_GPIO_NUM;\n  config.pin_d5 = Y7_GPIO_NUM;\n  config.pin_d6 = Y8_GPIO_NUM;\n  config.pin_d7 = Y9_GPIO_NUM;\n  config.pin_xclk = XCLK_GPIO_NUM;\n  config.pin_pclk = PCLK_GPIO_NUM;\n  config.pin_vsync = VSYNC_GPIO_NUM;\n  config.pin_href = HREF_GPIO_NUM;\n  config.pin_sccb_sda = SIOD_GPIO_NUM;\n  config.pin_sccb_scl = SIOC_GPIO_NUM;\n  config.pin_pwdn = PWDN_GPIO_NUM;\n  config.pin_reset = RESET_GPIO_NUM;\n  config.xclk_freq_hz = 20000000;\n  config.pixel_format = PIXFORMAT_JPEG; \n  \n  if(psramFound()){\n    config.frame_size = FRAMESIZE_UXGA;\n    config.jpeg_quality = 10;\n    config.fb_count = 2;\n  } else {\n    config.frame_size = FRAMESIZE_SVGA;\n    config.jpeg_quality = 12;\n    config.fb_count = 1;\n  }\n  \n  \/\/ Camera init\n  esp_err_t err = esp_camera_init(&amp;config);\n  if (err != ESP_OK) {\n    Serial.printf(&quot;Camera init failed with error 0x%x&quot;, err);\n    return;\n  }\n  \/\/ Connect to Wi-Fi network with SSID and password\n  Serial.print(&quot;Setting AP (Access Point)\u2026&quot;);\n  \/\/ Remove the password parameter, if you want the AP (Access Point) to be open\n  WiFi.softAP(ssid, password);\n\n  IPAddress IP = WiFi.softAPIP();\n  Serial.print(&quot;Camera Stream Ready! Connect to the ESP32 AP and go to: http:\/\/&quot;);\n  Serial.println(IP);\n  \n  \/\/ Start streaming web server\n  startCameraServer();\n}\n\nvoid loop() {\n  delay(1);\n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/ESP32-CAM-Arduino-IDE\/raw\/master\/ESP32-CAM-Video-Streaming\/ESP32-CAM-Access-Point-AP-Video-Streaming.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>To better understand how it works, you can read the next tutorial:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-access-point-ap-web-server\/\">ESP32 Access Point (AP) for Web Server<\/a><\/li>\n<\/ul>\n\n\n\t\t<div data-elementor-type=\"section\" data-elementor-id=\"94673\" class=\"elementor elementor-94673\" data-elementor-post-type=\"elementor_library\">\n\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-2689e44b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"2689e44b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7490d123\" data-id=\"7490d123\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-inner-section elementor-element elementor-element-35934f78 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"35934f78\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-3de108d9\" data-id=\"3de108d9\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5aca63ab elementor-widget elementor-widget-image\" data-id=\"5aca63ab\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\">\n\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"334\" height=\"334\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-eBook-334.jpg?fit=334%2C334&amp;quality=100&amp;strip=all&amp;ssl=1\" class=\"attachment-full size-full wp-image-94555\" alt=\"\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-eBook-334.jpg?w=334&amp;quality=100&amp;strip=all&amp;ssl=1 334w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-eBook-334.jpg?resize=300%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/03\/ESP32-CAM-eBook-334.jpg?resize=150%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 150w\" sizes=\"(max-width: 334px) 100vw, 334px\" \/>\t\t\t\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-50 elementor-inner-column elementor-element elementor-element-4bd084e0\" data-id=\"4bd084e0\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-517cf0fa elementor-widget elementor-widget-heading\" data-id=\"517cf0fa\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\">[eBook] Build ESP32-CAM Projects using Arduino IDE<\/a><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3438ea70 elementor-hidden-phone elementor-widget elementor-widget-text-editor\" data-id=\"3438ea70\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Learn how to program and build 17 projects with the ESP32-CAM using Arduino IDE\u00a0<strong><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\" rel=\"noopener\">DOWNLOAD \u00bb<\/a><\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<div class=\"elementor-element elementor-element-674524a5 elementor-hidden-desktop elementor-hidden-tablet elementor-widget elementor-widget-text-editor\" data-id=\"674524a5\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Learn how to program and build 17 projects with the ESP32-CAM using Arduino IDE <strong><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\" rel=\"noopener\">DOWNLOAD \u00bb<\/a><\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>We hope you&#8217;ve found this troubleshooting guide useful and you were able to make your <a rel=\"noreferrer noopener\" aria-label=\"ESP32-CAM (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/esp32-cam\/\" target=\"_blank\">ESP32-CAM<\/a> work with our projects.<\/p>\n\n\n\n<p><strong>If you have any other issues or suggestions on how to fix them, please post a comment below<\/strong>.<\/p>\n\n\n\n<p>If you like this project, you may also like other projects with the ESP32-CAM:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-ai-thinker-pinout\/\">ESP32-CAM AI-Thinker Pinout Guide: GPIOs Usage Explained<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-video-streaming-face-recognition-arduino-ide\/\" target=\"_blank\" rel=\"noreferrer noopener\">Video Streaming, Face Detection and Face Recognition<\/a><\/li>\n\n\n\n<li><a style=\"font-size: inherit; background-color: initial;\" href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-projects-ebook\/\"><strong>Build ESP32-CAM Projects (eBook)<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32-cam\/\"><strong>Read all our ESP32-CAM Projects, Tutorials and Guides<\/strong><\/a><\/li>\n<\/ul>\n\n\n\n<p>Thank you for reading.<\/p>\n\n\n\n<p><strong>P.S.<\/strong> It is very difficult to understand what&#8217;s wrong with your project when we can&#8217;t reproduce the error on our end. However, if you post the error, there might be other readers with the same issue\/solution, so we encourage you to interact in the comment&#8217;s section.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After releasing some projects with the ESP32-CAM, some readers reported issues when trying to use the ESP32-CAM. This guide is a compilation with the most common errors when using the &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP32-CAM Troubleshooting Guide: Most Common Problems Fixed\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp32-cam-troubleshooting-guide\/#more-85876\" aria-label=\"Read more about ESP32-CAM Troubleshooting Guide: Most Common Problems Fixed\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":86127,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[281,319,269,264],"tags":[],"class_list":["post-85876","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32-project","category-esp32-cam","category-guide-project","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/06\/ESP32-CAM-Troubleshooting-Guide-Most-common-problems-fixed.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/85876","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=85876"}],"version-history":[{"count":1,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/85876\/revisions"}],"predecessor-version":[{"id":159068,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/85876\/revisions\/159068"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/86127"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=85876"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=85876"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=85876"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}