Lỗi jpeg quality must be between 0 and 12 năm 2024
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 ESP32-CAM and how to fix them. Show
We’ve released the following projects with the ESP32-CAM:
Note: some of our readers reported errors when trying to follow the ESP32-CAM project with Home Assistant. We’ve modified some lines on the code, so most of the problems related with that project should be fixed. Please note that we couldn’t reproduce some of the errors on our end. However, we’ve gathered all the information given by our readers to get answers to the most common issues. If you have a different problem or a different solution to these issues, you can share your tips by writing a comment below. Most common errors:
1. Failed to connect to ESP32: Timed out waiting for packet headerThis error means that the ESP32-CAM is not in flashing mode or it is not connected properly to the FTDI programmer. Double-check the steps to upload code Double-check that you’ve 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’s the steps you need to follow: 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. 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. Important: GPIO 0 needs to be connected to GND so that you’re able to upload code. ESP32-CAMFTDI ProgrammerGNDGND5VVCC (5V)U0RTXU0TRXGPIO 0GND To upload the code, follow the next steps:
After a few seconds, the code should be successfully uploaded to your board. GPIO 0 must be connected to GND 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. Also, check that you have the FTDI programmer jumper cap set to 5V. Check the FTDI programmer you are using One of our readers reported the following: “found out that you can program the board with a USB-to-TTL module model CP2102 and that the CH340 model does NOT work“. This is the FTDI programmer we’re using. Power the ESP32-CAM with 5V 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. FTDI Programmer 5V Measure the output voltage of your FTDI programmer (VCC and GND) using a Multimeter to ensure it’s providing 5V to your ESP32-CAM. 2. Camera init failed with error 0x20001 or similarIf 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. Sometimes, unplugging and plugging the FTDI programmer multiple times or restart the board multiple times, might solve the issue. Camera not connected properly The camera has a tiny connector and you must ensure it’s connected in the the right away and with a secure fit, otherwise it will fail to establish a connection. Wrong pin assignment in the code When you get this error, it might also mean that you didn’t select the right board in the define section or the pin definition is wrong for your board. 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:
In this example, we’re using the CAMERA_MODEL_AI_THINKER, so it’s the one that is enabled. Otherwise, it will fail the pin assignment and the camera will fail to init. There are many esp32-cam boards being released (“fake boards”) 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. For example, M5Stack board without PSRAM has a different pin assignment than the M5STACK with PSRAM (defined on the code by default). So, you need to change the pin definition in the code accordingly to the board pinout. Not enough power through USB source If you’re powering your ESP32 through a USB port on your computer, it might not be supplying enough power. Faulty FTDI programmer Some readers also reported this problem was solved by replacing their actual FTDI programmer with this one. The camera/connector is broken If you get this error, it might also mean that your camera or the camera ribbon is broken. If that is the case, you may get a new OV2640 camera probe. 3. Brownout detector or Guru meditation errorWhen you open your Arduino IDE Serial monitor and the error message “Brownout detector was triggered” is constantly being printed over and over again. It means that there’s some sort of hardware problem. It’s often related to one of the following issues:
Solution:
Also, follow the suggestions described in issue 2. 4. Sketch too big error – Wrong partition scheme selectedWhen you get the following error:
It means that you haven’t selected the right partition scheme. Make sure you select the right partition scheme. In your Arduino IDE, go to Tools > Partition Scheme, select “Huge APP (3MB No OTA)“. 5. Board at COMX is not available – COM Port Not SelectedIf you get the following error or similar:
It means that you haven’t selected the COM port in the Tools menu. In your Arduino IDE, go to Tools > Port and select the COM port the ESP32 is connected to. 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. 6. Psram error: GPIO isr service is not installedYou are using a board without PSRAM and you get the following error or similar:
when the board was initialized with the following settings:
Adding the following fixes the issues (it lowers the image resolution so it won’t need so much space to store images. However, as a result, you cannot get some high resolution formats due to the limited memory):
Note: face recognition and detection doesn’t work with boards without PSRAM. However, you can still use all the other functionalities of the board. For example, although you can’t use the face recognition and detection features of this project (ESP32-CAM Video Streaming and Face Recognition with Arduino IDE), you can still play with the example and explore the board features as long as you have the right pin assignment in the code. 7. Weak Wi-Fi SignalSome readers reported that after powering the ESP32-CAM with 5V, they’ve gotten a more stable Wi-Fi signal. You can read this dedicated guide to learn how to connect an external antenna to the ESP32-CAM and extend Wi-Fi coverage. 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. If you connect an external antenna to the connector, it should work fine. 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 “<” with the middle position being common. Photo courtesy of Helmut SchoenbornThe following photo shows a closer look at that area. You can clearly see a small 0K resistor connecting to the built-in antenna. Photo courtesy of Helmut SchoenbornWith board turned so the the PCB antenna is up:
So, to enable the on-board antenna:
8. No IP Address in Arduino IDE Serial Monitorf you just see dots printed in the serial monitor (……), it means that your ESP32-CAM is not establishing a Wi-Fi connection with your router. Double-check your network credentials You need to make sure that you’ve typed your exact network credentials (SSID and password) in the following variables:
Select the right baud rate in the Arduino IDE Serial Monitor If you don’t select the right baud rate in the Arduino IDE Serial Monitor, you won’t get your board IP address or you’ll just get garbage on the screen. Make sure you select the right baud rate. In our examples with the ESP32-CAM, we use 115200 baud rate. Reset the board multiple times 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. 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 not able to establish a serial communication with your computer. Wi-Fi Range 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. 9. Can’t open web serverIf 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. At the moment, these ESP32-CAM sketches only work with one client connected at a time. 10. The image lags/shows lots of latencyHaving some latency is normal for such a small and cheap camera. Some readers have suggested the following to reduce latency:
11. esp_camera_fb_get(): Failed to get the frame on time!We’ve personally never faced this issue. However, many readers are getting this error with their ESP32-CAM boards. One of our readers (Fibula) suggested the following to solve this issue: “Im using the ESP32-CAM Module 2MP OV2640 Camera sensor Module Type-C USB module from Aliexpress. Although not mentioned, It doesn’t have the extra PSRAM the other M5 models do, and the camera has one changed IO pin. See here: https://github.com/m5stack/m5stack-cam-psram/blob/master/README.md and scroll down to Interface Comparison. The CameraWebServer Arduino example we’re probably all using doesn’t have this ESP32-CAM model defined. You need to add it yourself in the main tab add:
And in the camera_pins.h tab add the following:
And you’re good to go. Also note that the max resolution of the bare ESP32-CAM Module is XGA 1024×768, I assume also because of the lack of PSRAM. “ We hope this suggestion solves your issue. Let us know in the comments section. Using larger microSD card sizesAccording to he datasheet, the ESP32-CAM should only supports 4GB microSD cards. However, we’ve tested with 16GB microSD card and it works well. You might not be able to store more than 4GB, even though you have 16GB. We haven’t tested storing more than 4GB, so we’re not sure about this. Are these projects compatible with M5Stack board?Yes, the M5Stack ESP32 board is compatible with out projects. However, you must check your camera pinout to ensure you have the right assignment in the code. You can check the M5Stack camera connections here. How to set a fixed the IP AddressTo set a static/fixed IP address, you can follow the next tutorial:
Setting ESP32-CAM as Access Point (AP)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 video streaming web server as an Access Point:
View raw code To better understand how it works, you can read the next tutorial:
Wrapping UpWe hope you’ve found this troubleshooting guide useful and you were able to make your ESP32-CAM work with our projects. If you have any other issues or suggestions on how to fix them, please post a comment below. If you like this project, you may also like other projects with the ESP32-CAM:
Thank you for reading. P.S. It is very difficult to understand what’s wrong with your project when we can’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’s section. |