ESP32-CAM, lightsleep leaves camera power on

To get a fast response I want to put an ESP32-CAM into lightsleep and
when triggered have it init() and take the picture.

I have determined that when you do esp_camera_init() the current goes
up from 5mA to 20mA or so, however I can not get the current to drop before
going into lightsleep().

I have tried esp_camera_deinit() and esp_camera_disable_out_clock() to
no effect. An oscilloscope on GPIO0 (XCLK pin) shows no signal and a low
during lightsleep.

I am using ESP32 core 3.3.0, which should rule-out some comments about I2C
issues in older ESP IDF versions.

I have tried deepsleep() using some suggestions about removing bootlog, but the
boot-up is still around a second.

Appreciate any suggestions on how to get the current consumption back down
to 5mA with wakeup within 250mS.

Just noticed that there is a power down pin (32), so I tried the following:

// GPIO 32 is NOT a RTC pin
digitalWrite(power_down_pin, HIGH); 
gpio_hold_en(GPIO_NUM_32);
      
esp_light_sleep_start();  // enter light sleep

Serial.println("Returning from light sleep");

gpio_hold_dis(GPIO_NUM_32);
digitalWrite(power_down_pin, LOW);

I now get 6mA and a very fast wakeup.

Further tests indicate that it is not necessary to control pin32.

1 Like