Skip to Content

Fix brownout of ESP32-CAM

Fix brownout of ESP32-CAM

This tutorial will help you to fix brownout issues with your ESP32-CAM board. The symptoms of a brownout are an unstable function of the ESP32-CAM board with random resets of the board, due to an unstable or insufficient power supply.

Since the ESP32-CAM is a microcontroller module that integrates Wi-Fi and an onboard camera, it is quite power hungry and brownout errors are not uncommon. The ESP32 has a detector that watches for low voltage and if detected resets the board and prints the following error message to the Serial Monitor:

Brownout detector was triggered

This tutorial will walk you through what a brownout is, why it happens, and how to fix it with both hardware and software solutions.

What is a Brownout?

A brownout occurs when the supply voltage dips below the minimum threshold required by the ESP32. When this happens, the microcontroller triggers a brownout detector to reset itself and prevent malfunction.

The symptoms of a brownout are resetting or rebooting of the board, the error message “Brownout detector was triggered” or failure of the Wi-Fi connection or the camera initialization.

Typically brownouts are caused by a weak or unstable power supply, voltage drops due to long wires or poor connections, and the sudden current draw from the camera or Wi-Fi module.

Power Requirements of the ESP32-CAM

The ESP32-CAM is consumes more power than a standard ESP32 due to the camera module. Internally it operates with 3.3V but the board has a AMS1117-3.3 voltage regulator that allows an input voltage of up to 15 V and supports a current of up to 1A.

When the camera and/or Wi-Fi are used, the board can consume up to 500mA and if the power supply cannot provided that much current and the volage drops, a brownout occurs.

Common Issues That Lead to Brownouts

  • Using USB-to-Serial adapters that provide less than 500mA
  • Powering the ESP32-CAM via the 3.3V pin instead of the 5V pin
  • Using long or thin wires that introduce resistance and voltage drops
  • Providing power from a breadboard with poor connectors
  • Using power-banks with automatic shutdown function
  • Defective AMS1117 voltage regulator

Solutions

Use a Stable Power Source

  • Use a regulated 5V 2A power adapter
  • Power the ESP32-CAM via the 5V pin, not the 3.3V pin
  • Avoid powering directly from a computer USB port unless using a powered hub

Add Capacitors

You can compensate for sudden spikes in power consumption by adding a bulk capacitor. Connect a 470µF or higher electrolytic capacitor between 5V and GND as shown below. Watch out for the correct polarity.

Capacitor to stabilize power supply
Capacitor to stabilize power supply

You can also try adding a 0.1µF ceramic capacitor to filter high-frequency noise if you observe erratic errors, e.g. a flakey Wi-Fi connection.

Improve Wiring

Use short, thick wires (e.g., 22 AWG or thicker) and void powering through breadboards. If you supply power through a breadboard you can double up the jumper cables to ensure proper power supply.

Circumvent Voltage Regulator

If the AMS1117 voltage regulator on the board is defective, you can try to power the board directly from the 3.3V input pin. This is generally not recommended but may help in this case. Of course, you could also solder a replacement for the defective AMS1117.

Disable Brownout Detector in Software

You can disable the brownout detector with code for temporary testing:

#include "soc/soc.h"             // Access system control
#include "soc/rtc_cntl_reg.h"    // Access RTC control registers

void setup() {
  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); // Disable brownout detector
  // Other initialization code...
}

However, this doesn’t really solve the problem. Instead of the brownout error you may then experience other erratic errors that are much harder to diagnose, such as a flaky Wi-Fi connections, sporadic failures of the camera, noisy video, and so on.

Conclusion

In conclusion brownout are resets of the ESP32-CAM caused by an unstable or insufficient power supply. The ESP32-CAM is more prone to brownout compared to other ESP32 boards due to the addition of the camera module that increases the power consumption. The best solution to avoid brownout is to ensure a stable power supply with at least 1A at 5V.

If you just getting started with ESP32-CAM read our Programming the ESP32-CAM tutorial and if you have any further questions feel free to leave them in the comment section.

Happy Tinkering ; )