-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for power down modes #33
Comments
This issue is also critical to my project. @doragasu since your measurements are with WiFi up, that means the ESP32 processor and radio are continuing to consume power (eg, 55 / 35mA in cases 3, 4 & 5) just to maintain a connection, and perhaps other stuff. ESP-CAM specs suggest 5mA "sleep", presumably when WiFi is OFF. Do you get something like that? And ESP32 chip specs suggest a much lower sleep current is possible -- you and I both want to know if those sleep modes are supported? |
Hi, I did not do any tests in sleep mode, because I cannot use it (I need to have the radio always on, I keep a TCP connection always open and ready to receive data). My problem is the power drained by the camera while "idle" is way too much because standby mode is not supported. Also as I wrote, my measuremente are note very accurate, because I have to use my polimeter in the 10A scale. If I use a smaller scale (e.g. 200 mA), the module does not boot properly. And in the 10 A scale, the resolution is 10 mA. So when I say that a measurement is e.g. 55 mA, it is because the reading is continuously changing between 50 mA and 60 mA. |
Maybe you can try stopping the XCLK while you do not want to use the camera. That in effect will stop the camera's CPU and should lower consumption. |
What is the preferred way to stop XCLK? |
Hi! I'm another looking to reduce power during idle. I also couldn't restart camera. Any news on this or the xclk method? Thanks. |
Forward declare both methods in your code (it's in private header currently) and then stop and start the clock as needed :) https://github.com/espressif/esp32-camera/blob/master/driver/private_include/xclk.h |
Thanks @me-no-dev! I've been looking at the overall issue of Ultra Low Power BLE Advertising and Infrequent Connection (ULP BLE-AIC) for ESP32. The challenge is twofold: (1) long time to initialize the heavy system of ESP-IDF / Bluetooth and (2) only Modem Sleep but not Deep Sleep is used. I see an implementation strategy for Ultra Low Power BLE Advertising (ULP BLE-AIC) that does not require a shorter BLE / system initialization time. The ULP BLE-AIC strategy would
This would open a lot of IoT applications to use ESP32, that can't now! :) It requires Espressif cooperation. Any interest? Cheers, /george |
I will advise you to post this request for discussion in the ESP-IDF github page :) Its a bit off-topic here and the people that can help will not see it. |
Thanks, I will test stopping XCLK as soon as I get some time. |
Anyone had success with this? How to do it in Arduino? Do I replace the driver directly in the esp32 tool directory? I think you all are getting 35mA not just because the camera module but also the LM regulator. If you remove that from the esp32cam you will get into 4-3mA (not perfect yet) |
Sorry, I still did not have the time to test it. I plan to do it, but it will take two weeks or more for me to get the time slot. |
I tested various options with (some) success. I'll post the (rather long, but hopefully useful) code below and summarise here. In short, although power down and light sleep cannot be used, you can get the power down to 26mA with the camera used infrequently. Power consumption when idling is:
Other notes:
Test app:
|
I don't think power management is possible with Arduino. You'll need ESP-IDF to get the functionality. However, you should be able to get some improvement with the XCLK method in Arduino by calling the camera_enable_out_clock function.
That would be great - can you expand upon / explain how you did this? |
Thanks @eried for the instructions. I removed the 5v regulator and successfully powered via the 3.3v pin via a Polou reg09b. |
Nice, and yes, you need to disable the brownout. I think in my case the improvement was more than 10%. How much was your board using with that regulator? Consider that you cant compare 3.3V vs 5V without converting the mA to mW |
The board was using 24mA after boot, before I did anything and now 21mA. I measured the mA on +ve connection to 5V or 3.3V pin. So I guess the actual reduction ( 24mA x 5V = 120mW to 21mA x 3.3V = 69mW) was more like 43%. I did a very unscientific test today and it lasted much longer. I'll disable brownout - did you have instability issues with brownout disabled, or perhaps it's just dipping briefly during WiFi startup? |
Dipping during WiFi init. It has been running for weeks, without issues. But I wish I could achieve the sub mA values the ESP32 can reach :( to make the batteries last month not weeks. |
Okay, cheers. Is your timelapse code available? My is here (as a "timelapse" component and a "tlc32" project. I use a small PV panel to power it, but it's sunny here! |
It is not sunny here, and my code is not available yet, it is way simpler than the tlc32, using "vanilla" arduino and just uploading the photo to an ftp |
Hello, I'm using the ESP32-CAM with the Arduino IDE. I have a similar need for low power when idle since my unit will be powered by solar with an 18650 battery. I tried brettbeeson's example code and I get lots of compiler errors and totally can't find the camera_enable_out_clock and camera_disable_out_clock subroutines. Is my Arduino IDE missing a bunch of stuff? I have been successful in running other example streaming and time lapse programs I've found. It's just this power management stuff I can't get to work. |
Hi mtnbkr88. You'll need to use ESP-IDF to compile that code. Even then, it's in development. I think you'll need ESP-IDF to access the power-saving modes easily. You can use arduino code as a 'component' in ESP-IDF. |
Hi Brett. Thanks for the quick reply which was as I suspected. I'm not ready to give up my Arduino IDE just yet. I just learned how to use it. Yesterday I came up with the following work-around. I power up and connect to my local network and start the web server. With this much running I'm using around 40mA. Only when a request for streaming from the camera comes in do I initialize then use the camera. At this time the unit is then using around 200mA. Viewing what I want to see in the streamed image takes less than a minute. When the streaming connection to the camera is dropped, the unit goes to deep sleep for 5 seconds then boots up to just the wifi stuff at ~40mA again. I'll also deep sleep for ~10 hours when its dark at night. I'm hoping this will extend my 18650 battery long enough for the 6V 4.5W solar panel to keep up with charging it. Thanks. |
@brettbeeson does ESP-IDF allows you to get super low deep sleep consumption? |
@eried Yes and no. ESP-IDF allows more control of the esp32. This is good for things like XCLK and light sleep functions, which aren't exposed to Arduino IDE. |
@mtnbkr88: I thought about starting the ESP32 cam only when necessary through a PIR/radar sensor in conjunction with a relay to save power. However, I thought there might be two issues:
Anyone tried that? |
@fragger42: I've been having too much fun with this. |
mtnbkr88, I've been looking at doing this for about a month and just can't get to the low power setting needed. I haven't looked at using a solar panel as you have done. It sounds good and will meet what I'm looking to do which is integrating these cams into a mesh network to watch the perimeters of my property and sending notifications via a server that will handle all communication relayed by the cams. For years I've had problems with people trespassing and hunting on my property without permission to do so. I've also had my home broken into numerous times because there is no way to monitor who's walking in from the perimeters of my property. Could I get a copy of your code or could you help me figure this out to get a working setup and configuration to integrate into a mesh network? Any help you can provide would be greatly appreciated. |
JakeBeck, The first file attached is my code from mid October when I had my ESP32-CAM connected to a fixed position 6V 4.5W solar panel (with battery voltage check on GPIO12). This setup worked okay with sunny days but after a few days of cloudy the battery would run low and never recover. |
Also wait 1 second for full initialization. See also: espressif/esp32-camera#33 (comment)
Hi All, I am unable to call camera_enable_out_clock() or camera_disable_out_clock() in my code in Arduino, I get the error:
The routines I am calling seem to exist in the binary file libesp32-camera.a which exists on my PC - but how do I use them? My test code isolating this issue is below: ` // Forward declare cam clock stop/start. // CAMERA_MODEL_AI_THINKER #define SerialDebug Serial // Nice names for Serial ports camera_config_t cam_config; void setup() {
} void loop() { }` Thanks very much |
I have solved the "calling XCLK routines from Arduino" issue, they need to be declared like so:
It saves a bit of power and the clock can still be restarted and a picture taken again. It doesn't save as much as powering down the camera and then powering it up again, but I can't get that to work, it always reboots on me: 22:36:51.943 -> [E][camera.c:1335] esp_camera_fb_get(): Failed to get the frame on time! |
This issue appears to be stale. Please close it if its no longer valid. |
I am using an ESP32-CAM module, and currently the camera power consumption is relatively high when the camera is idle. I have done several not very accurate current measurement using my test project under several scenarios (all with the WiFi up):
As the intended use for the module is to be battery powered and the camera will be idle most of the time, I would like to be able to put it to sleep and wake it up as needed. From the measurements above, it seems I should be able to cut current consumption almost by a 1/3 factor, but unfortunately, when I try options 4 an 5, I am not able to make the camera work again until I issue a power cycle. I have tried disabling Standby mode for option 5, and reinitializing the camera for both options, without success.
Are power down modes supported? If not, could power down support be added?
Regards,
doragasu
The text was updated successfully, but these errors were encountered: