Skip to main content
DIY 6 mins

Fixing ESP32-Cam problems

For less than 10 euros you can get an ESP32 microcontroller with a camera that also supports streaming and face recognition. Unfortunately, the thing is quite temperamental. Here’s how I fixed the errors.

Fixing ESP32-Cam problems
Table of Contents

The ESP family from Espressif became known through the ESP8266, which is found in many WiFi sockets, lamps and other devices. An affordable variant comes with a camera and can be converted into a surveillance camera. Face recognition is even possible. The camera provides a live stream and offers plenty of setting options via a web interface:

⚠ [affiliate] Keine Produkte mit Cache für teileliste. Bitte affiliate-sync --lang en ausführen.

Flashing the ESP32-Cam with the Arduino IDE

The ESP microcontrollers can be flashed and programmed with the Arduino IDE. Here, in brief, are the most important settings.

In the Arduino IDE, first add the source for the board information:

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

Multiple entries are separated by a comma. You can then install the definitions for the ESP32 ESP32Microcontroller by Espressif with integrated Wi-Fi and Bluetooth. The heart of many DIY smart home projects – programmable via ESPHome, Tasmota or Arduino boards under Tools->Board->Board Manager. Simply enter ESP32 in the search and install the board.

After successful installation, select the ESP32 Wrover Module board. The board settings are normally set automatically and should look like the screenshot:

To program the affordable ESP32-Cam boards, you need an FTDI adapter . The 3.3 volt and GND connection of the FTDI adapter goes to the 3.3 V and GND on the board - don’t forget to also set the jumper for the voltage on the FTDI adapter to 3.3 volts, otherwise you’ll kill your ESP32! The RX connection of the adapter goes to the UOT connection on the ESP32 and the TX connection to the UOR connection of the ESP. When you connect the FTDI adapter to your computer, it appears as a new COM port (PC). Set this COM port in the board settings (last screenshot) under Port. To be able to flash the ESP32, you need a bridge between GND and IO0 - only then can the ESP32 be programmed.

Under File->Examples->ESP32->Camera you can now load the CameraWebServer script. The following lines need to be adjusted here:

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "esp_camera.h"
#include <WiFi.h>

//
// WARNING!!! Make sure that you have either selected ESP32 Wrover Module,
//            or another board which has PSRAM enabled
//

// Select camera model
//#define CAMERA_MODEL_WROVER_KIT
//#define CAMERA_MODEL_ESP_EYE
//#define CAMERA_MODEL_M5STACK_PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE
#define CAMERA_MODEL_AI_THINKER

#include "camera_pins.h"

const char* ssid = "YOUR-SSID";
const char* password = "YOUR-WIFI-PASSWORD";

void startCameraServer();

void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.println();

Once you’ve changed and saved the script as above, the ESP32 can be flashed. To do this, click on the arrow at the top left in the Arduino IDE and immediately afterwards press the reset button on the ESP32. The program should now be uploaded to the ESP32. The IDE confirms the successful upload. It should look something like this:

Now remove the bridge between GND and IO0 again, otherwise the program won’t start (the ESP32 then remains in programming mode). Then open the serial console in the IDE and press the reset button again. If you now see, after a few lines:

text
1
2
3
4
WiFi connected
Starting web server on port: '80'
Starting stream server on port: '81'
Camera Ready! Use 'http://192.168.1.34' to connect

everything went great and you can access the setup interface via the specified IP address and view the live image of the camera at http://192.168.1.34:81/stream (with your IP address, of course).

Fixing problems with the ESP32-Cam module

One of the biggest problems with the module is the “brownout”. A brownout is a brief drop in voltage, and that’s exactly what happens with many ESP32-Cam clones as soon as the WiFi wants to start. Many FTDI programmers and the USB cables connected to them cannot supply the briefly high currents when the WiFi connection starts, and the serial console of the Arduino IDE then displays “Brownout detector was triggered rst:0xc …”.

The first remedy is better USB cables. In addition, in live operation you should power the ESP32 via the 5 volt connection. A 220 µF electrolytic capacitor on the 5V and GND pins is also helpful.

Another problem, however, is the power supply itself. Many USB ports and power banks deliver just barely 5 volts. With the ESP32’s brief current demand, however, these quickly drop to 4.8 volts and below. On the ESP32, however, there is a voltage regulator of type AMS1117, which is not among the very best of its kind. Although it can still stably produce the desired output voltage of 3.3 volts down to an input voltage of 4.35 volts (according to the datasheet), in practice this doesn’t really work and the brownout is provoked.

In a test on my Rigol DP832 lab power supply, I found that the ESP32 only works stably from 5.4 volts at the input. Some cheap Chinese USB power supplies deliver exactly these elevated voltages, and with them the ESP32-Cam works flawlessly.

Since the AMS1117 voltage regulator tolerates input voltages up to 15 volts, you can operate the ESP32 with 6 or 7 volts and thus avoid the problems mentioned. Higher voltages naturally also lead to more losses and waste heat with the linear regulator.

Stripes in the image

The horizontal stripes in the image, which are often complained about, are also related to a supply voltage that is too low. Here too, simply raising the supply voltage at the 5 volt input of the ESP32 to 5.5 volts or more helps.

Poor WiFi range

The ESP32 clones are not range monsters when it comes to the WiFi connection. However, there is a mini coax socket on the board (MHF IV, I-PEX, HSC MXHP32). The problem with it is that it cannot simply be used. To be able to connect an external antenna to the ESP32, a component must be resoldered that connects the coax socket instead of the built-in antenna.

This is a simple SMD bridge in 0402 (01005) format. So we’re talking about a component that is less than half a millimeter long. Desoldering and resoldering such a part by hand is practically impossible even with the best equipment. Since it’s only a bridge, however, you can simply desolder the part and, with a lot of dexterity, replace it with a piece of wire from a strand of stranded wire. A microscope makes this work much easier.

If you want it simpler, cut the internal antenna at the feed line and solder the external antenna there. By the way, I recycled the antenna including the coax cable from an old Fritzbox.

Conclusion

Apart from minor quirks, the ESP32-Cam is a really helpful and affordable piece of kit for which there are plenty of applications.


Hi! I'm Markus – the Fricklr. ⚡ Electrical engineer, 🎵 musician (bass, guitar, keys) and professionally 'something with the internet' 🌐 for over 30 years – nowadays with AI too 🤖 – a 55-year-old generalist from Bavaria, Germany.

Your feedback helps me write even more interesting posts. After "Yes" there's also a small option to support my work.

Explore related topics

Content Map →
Show related content as a list
💡 Drag, hover & click to explore
Bigger dots are more relevant

What do you think? Leave a comment!

Share your thoughts, questions or experiences with the community.

Links marked with this symbol are affiliate links. As an Amazon Associate I earn from qualifying purchases. There are no additional costs for you.