ESP32: Disable Brownout Detector I have an ESP-WROOM-32 and I'm using Arduino IDE to push code on it. My ESP is powered via 2 AA batteries and got one power supply problem. 

It works well on new battery but after a bit, I will always get this error repeatedly:


  ets Jun  8 2016 00:22:57
  
  rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0,
  SPIWP:0xee
  clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
  mode:DIO, clock div:2 load:0x3fff0018,len:4 load:0x3fff001c,len:812
  load:0x40078000,len:0 load:0x40078000,len:11584 entry 0x40078a60
  
  Brownout detector was triggered


So, I know that it's possible to disable that feature in ESP32. My question is how to do it?

What I have done that didn't work:

Add this code in my Arduino IDE:

#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"
setup(){
    WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector    
}


Change Arduino\hardware\espressif\esp32\tools\sdk\sdkconfig with:

CONFIG_BROWNOUT_DET=                //previous was "=y"
CONFIG_BROWNOUT_DET_LVL_SEL_0=      //previous was "=y"
CONFIG_BROWNOUT_DET_LVL_SEL_1=
CONFIG_BROWNOUT_DET_LVL_SEL_2=
CONFIG_BROWNOUT_DET_LVL_SEL_3=
CONFIG_BROWNOUT_DET_LVL_SEL_4=
CONFIG_BROWNOUT_DET_LVL_SEL_5=
CONFIG_BROWNOUT_DET_LVL_SEL_6=
CONFIG_BROWNOUT_DET_LVL_SEL_7=
CONFIG_BROWNOUT_DET_LVL=           //previous was "=0"
For me brownout issue was solved by removing the esp32 from Arduino IDE board manager + removing files from disk and use install procedure "Using Arduino IDE with the development repository" - https://github.com/espressif/arduino-esp32/

I guess it will use newer version of arduino-esp32 that has some brownout protection due to CONFIG_REDUCE_PHY_TX_POWER being activated by default. Also you should probably learn how to decrease wifi power + deep sleep for longer battery usage.