arduino-esp32
arduino-esp32 copied to clipboard
ESP32-C3 too much current consumption
Hardware:
- ESP32-C3-WROOM-02 XXH4 @80MHz
- ESP32-WROOM-32D @80MHz
IDE: arduino 1.8.16 library: arduino-esp32 ver 2.0.1 (ver 2.0.0) application: based on "BLE_uart.ino" (examples from the library)
Description:
Measured power supply current consumption:
- ESP32-C3: 77mA (81mA for ver 2.0.0)
- ESP32: 31mA (31mA for ver 2.0.0)
In my opinion for this BLE application ESP32-C3 consumes too much power. Module is even a little hot in touch. The same BLE application running on ESP32 has over two times low power consumption.
What's wrong with ESP32-C3, that should be more energy-saving chip?
I've found the reason of this issue. Arduino library for ESP32-C3 doesn't have "Bluetooth modem sleep" option enabled in sdkconfig. Classic ESP32 has this option enabled. I don't know what is the reason that Esspressif is not turning it on. With this option enabled current consumption decreases from 77mA to about 25mA. Enabling this option and compilation is not trivial. Hint: https://docs.espressif.com/projects/arduino-esp32/en/latest/esp-idf_component.html Very low power consumption needs to use external 32kHz crystal, enabling power managment, enabling rtos idle sleep etc., but there is a problem with peripherials based on main crystal (like timers) - they are stoped during sleep periods.
Hello, adding this as For reference issue so we can add this to our Documentation for Arduino users.
Was this issue resolved?
Still not resolved (2.0.3).
@asier70 Will you be able to retest this on v2.0.4? Thank you.
I've just tested it using 2.0.4. Still the same high current consumption. Arduino sdkconfig file for ESP32C3 still has modem sleep option disabled:
# MODEM SLEEP Options
#
# CONFIG_BT_CTRL_MODEM_SLEEP is not set
# end of MODEM SLEEP Options
I use manually changed this option:
# MODEM SLEEP Options
#
CONFIG_BT_CTRL_MODEM_SLEEP=y
CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y
CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y
# CONFIG_BT_CTRL_LPCLK_SEL_RTC_SLOW is not set
# end of MODEM SLEEP Options
It needs manual project compilation, but helps for me.
We will investigate this soon. Thanks for retesting @asier70.
Not enabled for the ESP32-S3 too. For the ESP32 the default value is enabled. For C3 and S3 the standard value is disabled. Is there a reason for?
@asier70 Hi I have the same problem with the consumption of about 75 mA after turning on the modem for Bluetooth. I also set the mode in sdkconfig; Bluetooth Modem Sleep -> ON Bluetooth Modem sleep Mode 1 -> ON Bluetooth low Power Clock -> Main crustal Recompiled esp idf 4.4 ESP32-C3-WROOM-02 XXH4 @80MHz But the consumption is still at 75mA Can you tell me where I'm wrong
I also set the mode in sdkconfig; Bluetooth Modem Sleep -> ON Bluetooth Modem sleep Mode 1 -> ON Bluetooth low Power Clock -> Main crystal
Are you sure that you properly recompile esp32 arduino source?
In this project I am not using the Arduino Compiler but the Eclipse Compiler with Esp32 Idf 4.4
do you think they can give different results?
Question is if it uses precompiled arduino library or if it compiles it's sources every time. I don't use eclipse for compilation so I can't help.
@asier70 Yes I understand .. however your test gives me hope I will try to find the reason thank you all the same
@asier70
Sorry @asier70 a confirmation! The test you did of current reduction from 77mA to 25mA was without 32kHz Quartz External Right?
The test you did of current reduction from 77mA to 25mA was without 32kHz Quartz External Right?
I didn't use 32kHz external quartz crystal.
Hi Guys (discovered)
I found out why I could not bring the consumption from 77mA to 25mA after enabling the sleep of the Bluetooth modem ..
The reason was that I use the BleMesh Libraries;
if I use only: bluetooth_init (); consumption goes from 77mA to 25mA
But if I use: bluetooth_init (); ble_mesh_init (level); Consumption remains at 77mA
I do not know the reason !
ESP32-C3 Modem Sleep is still not enabled in 2.04. When is this going to get fixed? My C3 burns ~60mA, so I can't use it for battery applications.
@joelccrouch If you cant wait, compile your own Arduino libs with the modem sleep enabled. Since this issue has the label "Needs investigation" there are dependencies which needs to be checked.
If anyone fixed the ble mesh lib, can you create a pull request or fork the lib if the owner is unresponsive?
On Thu, 4 Aug 2022 at 22:45, Jason2866 @.***> wrote:
@joelccrouch https://github.com/joelccrouch If you cant wait, compile your own Arduino libs with the modem sleep enabled. Since this issue has the label "Needs investigation" there are dependencies which needs to be checked.
— Reply to this email directly, view it on GitHub https://github.com/espressif/arduino-esp32/issues/5909#issuecomment-1205749639, or unsubscribe https://github.com/notifications/unsubscribe-auth/APYEMSNTCGR6SZFLG5WAX4LVXQTYJANCNFSM5IMETOOQ . You are receiving this because you commented.Message ID: @.***>
@Jason2866 I've tried recompiling libraries in ESP-IDF after making appropriate menuconfig changes to sdkconfig, but when I copied all of the libraries(*.a files) to my Arduino ESP32 installation, I just get a bunch of missing file errors.
I need clear Windows 10 instructions on how to change those sdkconfig settings for an ESP32C3.
Hi Guys (discovered)
I found out why I could not bring the consumption from 77mA to 25mA after enabling the sleep of the Bluetooth modem ..
The reason was that I use the BleMesh Libraries;
if I use only: bluetooth_init (); consumption goes from 77mA to 25mA
But if I use: bluetooth_init (); ble_mesh_init (level); Consumption remains at 77mA
I do not know the reason !
From my understanding, the reason why enabling low power mode reduces power consumption is that the modem can be "switched off" between BLE events (spaced 10ms-100s ms), so the modem is OFF in most of the time. The central and peripheral devices clocks are synced and they turn on radio at the same time.
However, this does not work with BLE Mesh. Mesh is using Advertising channels to communicate (so there are no "physical" connections between nodes, they just broadcast messages to each other. No connection means no clock synchronization, no clock synchronization means everyone has to turn on the radio and listen ALL THE TIME, which means lots of power.
@asier70 Could you please provide a little more info how to build esp32 Arduino sources? I was able to build something using Lib Builder (https://docs.espressif.com/projects/arduino-esp32/en/latest/lib_builder.html) but it doesn't seems to work and I still get 80mA consumption (I have changed sdkconf inside lib builder Arduino component)
Thank you in advance
@asier70 Could you please provide a little more info how to build esp32 Arduino sources? I was able to build something using Lib Builder (https://docs.espressif.com/projects/arduino-esp32/en/latest/lib_builder.html) but it doesn't seems to work and I still get 80mA consumption (I have changed sdkconf inside lib builder Arduino component)
Before starting library build add one line (CONFIG_BT_CTRL_MODEM_SLEEP=y) into file: esp32-arduino-lib-builder\configs\defconfig.esp32c3
CONFIG_BT_BLE_BLUFI_ENABLE=y
CONFIG_BT_CTRL_MODEM_SLEEP=y
CONFIG_ESP32C3_RTC_CLK_CAL_CYCLES=576
# CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304
Don't change sdkconf. As result of build you get sdconfig with modem sleep option set.
@asier70 Could you please provide a little more info how to build esp32 Arduino sources? I was able to build something using Lib Builder (https://docs.espressif.com/projects/arduino-esp32/en/latest/lib_builder.html) but it doesn't seems to work and I still get 80mA consumption (I have changed sdkconf inside lib builder Arduino component)
Before starting library build add one line (CONFIG_BT_CTRL_MODEM_SLEEP=y) into file: esp32-arduino-lib-builder\configs\defconfig.esp32c3
CONFIG_BT_BLE_BLUFI_ENABLE=y CONFIG_BT_CTRL_MODEM_SLEEP=y CONFIG_ESP32C3_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304Don't change sdkconf. As result of build you get sdconfig with modem sleep option set.
I can’t believe it actually works! Thank you very much for your help. I’m getting now ~40mA consumption. Thanks once again :)
I'm having the same issue but am not familiar with manual compilation or the espessif Lib Builder (mech eng here - barely hanging on to these concepts, but having the exact issue as you guys, measuring ~80mA). I tried making the changes above in the sdkconf file located within this path "\Arduino15\packages\esp32\hardware\esp32\2.0.6\tools\sdk\esp32c3" but it did not make a difference. I suspect this is because it does not recompile automatically.
Is there a way you could share your compiled library with the changes listed above?
I can't share the whole compiled board library as it has 3gb (1.5gb compressed), but only compiled pieces for ESP32-C3.
What you need to do is to follow manual installation guide of Arduino-ESP32.
After step 4 (after get.exe finishes) extract this ZIP file into [ARDUINO_SKETCHBOOK_DIR]/hardware/espressif/esp32, overwrite existing files.
Now choose correct board in Arduino IDE (for me it's in ESP32 Arduino (in Sketchbook)), recompile and upload your code and you should be good to go. If you have any issues, feel free to DM me on Discord Setrin#5445
I can't share the whole compiled board library as it has 3gb (1.5gb compressed), but only compiled pieces for ESP32-C3. What you need to do is to follow manual installation guide of Arduino-ESP32. After step 4 (after
get.exefinishes) extract this ZIP file into[ARDUINO_SKETCHBOOK_DIR]/hardware/espressif/esp32, overwrite existing files. Now choose correct board in Arduino IDE (for me it's inESP32 Arduino (in Sketchbook)), recompile and upload your code and you should be good to go. If you have any issues, feel free to DM me on DiscordSetrin#5445
can you help me compile library? i use this command and get bunch of errors such as freertos missing i don't know why : ./build.sh -t esp32s3
@me-no-dev Is there a reason this is not enabled by default?
@lbernstone not really, but it's a good time to be added to RC1 (and why not even 2.0.15)
Replaced with different options in 5.1 that are enabled, I don't have IDF 4.x in an easily accessible place...