Skip to content
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

ble taking too much power (IDFGH-769) #947

Open
joicetm opened this issue Aug 31, 2017 · 129 comments
Open

ble taking too much power (IDFGH-769) #947

joicetm opened this issue Aug 31, 2017 · 129 comments
Assignees

Comments

@joicetm
Copy link

joicetm commented Aug 31, 2017

Hi,
I wish to know when can i expect the low power modes in ble? would this feature be added in the next release v3.0?
currently i observe that with single core and 80 Mhz, the device consumes around 80-90 mA.[minimum i was able to achieve]
is it the best we can achieve ? or is there any way to improve the power consumption with current idf version?

@MS-elug
Copy link

MS-elug commented Aug 31, 2017

I have the same issue. Even running the demo heats the chips a lot.
Would be good to have a fix or a demo showing how to create a very low powered BT server.

@FayeY FayeY changed the title ble taking too much power [TW#15167] ble taking too much power Sep 5, 2017
@igrr
Copy link
Member

igrr commented Sep 7, 2017

@joicetm BLE power consumption improvements (i.e. modem sleep mode) are not planned for 3.0. 80-90mA is the best that can be achieved in the current version.

@MS-elug
Copy link

MS-elug commented Sep 8, 2017

Do you know what is the release target for the modem sleep mode ? Where can we find the project roadmap and estimate dates?

@mobilinkd
Copy link

This is an important issue for me. I would be using the ESP32 in my project right now if I could run the ble_spp_server demo using less than 10mA.

@Yulong-espressif
Copy link
Contributor

@MS-elug @mobilinkd The BLE modem sleep will be release at the next version(v3.1), thank you for your concern about ESP32.

@mobilinkd
Copy link

That's great news, @Yulong-espressif ! Are you able to characterize the current consumption with this enhancement?

@PromTZ
Copy link

PromTZ commented Dec 7, 2017

Hi, I am using ESP-WROOM-32 with Arduino IDE. I want to know is there any way to reduce power consumption of BLE peripheral? I made a test on power consumption during BLE advertising which was consuming 112mA current when CPU set at 80Mhz. I want to reduce the current consumption to at least 1mA but BLE should keep on advertise. Please help me in this regards.

@devKlausS
Copy link

@Yulong-espressif can you tell us a release date for BLE modem sleep (version 3.1)? Moreover I would be interested in the current consumption in BLE modem sleep mode. We are planning to develop a low power product, therefore the current consumption is the most critical part of the project.

@sargun
Copy link

sargun commented Jan 20, 2018

@Yulong-espressif Is BLE wakeup going to be in the next version?

@Yulong-espressif
Copy link
Contributor

@sargun Yes, will be release in the version 3.1

@TianHao-Yoursmake
Copy link

Actually, both BR/EDR and BLE power save will be released in release/v3.1.

@joicetm
Copy link
Author

joicetm commented Apr 3, 2018

Thanks for the update, TianHao-Espressif .

@frax84
Copy link

frax84 commented May 22, 2018

Features has been implemented few days ago. I tried it and it works. With the exactly same features (time interval=50ms, 15B per packet, notify enabled) power consumption passed from 102mA to 35-40mA. Data exchange is not fluid ad before, but don't know the cause.

@TianHao-Yoursmake
Copy link

TianHao-Yoursmake commented May 24, 2018

@frax84 , the BLE/BR/EDR sleep current and related performance is in test.
But, due to the Bluetooth RF is shared with WIFI, so the average current will not be very low as single BLE IC.

And what "not fluid" present. Could you provide your test case?

@frax84
Copy link

frax84 commented May 24, 2018

@TianHao-Espressif Hi Tiao! Actually was not a complain but was just informing the others in this post. By the way, your explanation is very interesting. This is my use case:

  • GATT server (no security)
  • connection interval = 50ms (min 40 - max 60ms)
  • no latency
  • Payload = 15Bytes
  • Data are all notified
  • Antenna power set default
  • The consumption i wrote about is not only esp32. I'm using esp32thing from Sparkfun with no mod (i.e. leds still on the board)
  • in SDK i configured optimization for BLE (default was "balanced")

With the term "no fluid" i mean that while before (was using BLE with BTDM mode) data were coming evenly time-spaced ("1-2-3-4-5-6-7-8-9-10") now they tend to come less evenly spaced (i.e. "1-2---34--5-6-7--8---9-10"). I have not test data to show but what i'm saying is clearly visible with eye (while with previous settings it was ok)

I have two questions.

  1. Is it possibile to completely disable WiFi in SDKconfig.h?
  2. If yes, would this " disabling" would give any consumption improvements?

Thank you

EDIT: edited some typos and added more infos about my use case

@lucashutchinson
Copy link
Contributor

Hi All,

I have been optimising our ESP32 application for low power at the moment.
I have eliminated a few power hogs in our code and incorrect configurations however i am running into a wall with bluetooth enabled.

The lowest consumption with BLE enabled (BT-classic disabled) is around 28-32mA when advertising with a 200ms interval
In the same application if BLE is not initialised, the power consumption drops to around 3.2mA.

Im just wondering if i am at the limit of what the ESP32 can currently do.
And if this is the case, is there any planned work to improve this during BLE-only modes?

I understand that as this chip supports BLE and WiFi the power consumption during transmit and Reception will be higher than a BLE only chip. However since BLE operates on the connection interval paradigm, if there is a 40ms connection interval or a 200ms advertising interval, surely the radio could be disabled between connection intervals saving power during these periods? This would likely result in a much lower average current.

Thanks in advance for your response.
@TianHao-Espressif @projectgus

@chegewara
Copy link
Contributor

chegewara commented Nov 6, 2018

@lucashutchinson Did you try to change TX power? By default it is setup pretty high (+3dBm).

Remember that you can decrease TX power for advertising only if you want.

@Weijian-Espressif
Copy link
Collaborator

hi all:
Please confirm if bluetooth mode sleep is enabled in menuconfig.
Location: Component config -> Bluetooth -> Bluetooth controller -> MODEM SLEEP Options

@lucashutchinson
Copy link
Contributor

lucashutchinson commented Nov 7, 2018

Hi @chegewara @Weijian-Espressif

Yes I have tried changing the TX power between N12 and P9, no real difference was noticed. however i am going to do a few more tests.

I have enable bluetooth modem sleep options, and have tried both ORIG and EVED modes.
I have also enabled power saving in Component config -> Power Management
and also enable tickless idle in Component config -> FreeRTOS -> Tickless Idle

I have also called the functions:
esp_pm_configure and esp_bt_sleep_enable.
I have also tried a few different configurations for the esp_pm_configure, i do see a difference when changing the max processor speed from 240mhz to 80mhz.
the current values i mentioned above were @ 80mhz. when running at 240mhz I see around 50mA of current draw.

Do you have any internal test results of low power bluetooth that can be shared?

Thanks for your responses!

@mywang-espressif
Copy link

@lucashutchinson . 30mA is in accord with our internal test result for BLE advertising in current stage. In order to further optimize the bluetooth power consumption, we are trying to resolve the issue in the combination use of bluetooth modem sleep and Dynamic Frequency Scaling(DFS) as well as Automatic light sleep. which can hopefully be completed in a month.
The reason that you get a 3.2mA current compared to 30mA when BLE is inititalized is, currently bluetooth module will acquire a pm_lock during initialization and won't release it until deinit, and therefore the CPU frequency cannot be decreased to lower than 80MHz. After the we have resolve the issue for BT modem sleep with DFS and light sleep, you can expect an even lower power consumption.

@Alvin1Zhang
Copy link
Collaborator

@lucashutchinson Could you help share if any updates for this issue? Thanks.

1 similar comment
@Alvin1Zhang
Copy link
Collaborator

@lucashutchinson Could you help share if any updates for this issue? Thanks.

@github-actions github-actions bot changed the title [TW#15167] ble taking too much power [TW#15167] ble taking too much power (IDFGH-769) Mar 15, 2019
@lucashutch
Copy link

There are no updates that I have had from espressif.

@projectgus projectgus changed the title [TW#15167] ble taking too much power (IDFGH-769) ble taking too much power (IDFGH-769) Mar 18, 2019
@mywang-espressif
Copy link

Hi, a commit on optimization of Bluetooth power consumption was merged into ESP-IDF recently. The merge commit is(git describe --tag): v4.0-dev-684-gb859584. An external 32.768kHz crystal is required to take advantage of this feature.

Here is the description for this commit and a brief manual.

Feature: Bluetooth modem sleep with external 32.768kHz xtal under light sleep

Overview

Bluetooth modem sleep could work under DFS but could not work under light sleep in previous implementation, which is largely due to the sleep clock source. Sleep clock must provide enough accuracy for BLE to maintain time during sleep.

Main crystal is supposed to be powered down during light sleep. It can support DFS but not light sleep for Bluetooth modem sleep.
External 32kHz crystal as RTC clock, has good accuracy and can support both DFS and light sleep for Bluetooth modem sleep. Currently there is another hardware issue of External 32kHz crystal but it is supposed to be resolved in later chip version.
Other RTC clock sources, such as internal 150kHz oscillator or internal 8.5MHz oscillator, divided by 256 (8MD256 for short), do not provide enough accuracy as required by Bluetooth specification(worst-case BLE SCA is +/-500ppm, worst-case accuracy for Classic Bluetooth Low Power Oscillator(LPO) is +/-250ppm).

This patch resolves the issue that Bluetooth modem sleep is not allowed to work with light sleep with external 32kHz crystal. In this case a menuconfig option is provided to set the BLE SCA used to estimate RX window widening during connection events.

User guide

To use bluetooth modem sleep with light sleep, please follow the below instructions.

ESP-IDF menuconfig options:

  1. Enable Power Management:
    menuconfig ---> Component config ---> Power management --->
    [*] Support for power management

  2. Enable Tickless Idle:
    menuconfig ---> Component config ---> FreeRTOS --->
    [*] Tickless idle support
    (3) Minimum number of ticks to enter sleep mode for (NEW)

Note: Tickless idle needs to be enabled to allow automatic light sleep. FreeRTOS will enter light sleep if no tasks need to run
for 3(by default) ticks, that is 30ms if tick rate is 100Hz. Configure the FreeRTOS tick rate to be higher if you want to allow
shorter duration light sleep, for example:
menuconfig ---> Component config ---> FreeRTOS ->
(1000) Tick rate (Hz)

  1. Configure external 32.768Hz crystal as RTC clock source:
    menuconfig ---> Component config ---> ESP32-specific --->
    RTC clock source (External 32kHz crystal)
    [*] Additional current for external 32kHz crystal

Note that the "additional current" option is a workaround for a hardware issue on ESP32 that the crystal can fail in oscillating.
Please enable this option when you use external 32kHz crystal. This hardware issue will be resolved in the next ECO chip.

  1. Enable Bluetooth modem sleep with external 32.768kHz crystal as low power clock:
    menuconfig ---> Component config ---> Bluetooth ---> Bluetooth controller ---> MODEM SLEEP Options --->
    [*] Bluetooth modem sleep
    Bluetooth Modem sleep mode (ORIG mode(sleep with low power clock))
    Bluetooth low power clock (External 32kHz crystal)

Enable light sleep by calling power management API in application:

  1. In your application source code, to enable automatic light sleep, use power management API esp_pm_configure like this:
#include "esp_err.h"
#include "esp_pm.h"

    esp_pm_config_esp32_t pm_config = {
        .max_freq_mhz = EXAMPLE_MAX_CPU_FREQ_MHZ, // e.g. 80, 160, 240
        .min_freq_mhz = EXAMPLE_MIN_CPU_FREQ_MHZ, // e.g. 40
        .light_sleep_enable = true, // enable light sleep
    };
    ESP_ERROR_CHECK( esp_pm_configure(&pm_config) );

Test result

Below are some power consumption statistics on typical BLE use scenario:

  • MAX cpu frequency = 240MHz
    ADV(adv_interval = 1000.0ms) average current 3.05mA, max 149.34mA, min 0.71mA
    SCAN(scan_wiONndow = 500.0ms, scan_interval = 1000.0ms) average current 59.57mA, max 170.26mA, min 0.93mA
    CONNECTION(connection_interval = 960.0ms, slave_latency = 0) average current 2.07mA, max 152.28mA, min 0.81mA

  • MAX cpu frequency = 160MHz
    ADV(adv_interval = 1000.0ms) average current 2.51mA, max 139.34mA, min 0.78mA
    SCAN(scan_window = 500.0ms, scan_interval = 1000.0ms) average current 50.37mA, max 134.85mA, min 1.08mA
    CONNECTION(connection_interval = 960.0ms, slave_latency = 0) average current 2.05mA, max 121.69mA, min 1.11mA

  • MAX cpu frequency = 80MHz
    ADV(adv_interval = 1000.0ms) average current 2.55mA, max 114.81mA, min 0.79mA
    SCAN(scan_window = 500.0ms, scan_interval = 1000.0ms) average current 49.05mA, max 123.80mA, min 0.85mA
    CONNECTION(connection_interval = 960.0ms, slave_latency = 0) average current 2.11mA, max 106.01mA, min 0.94mA

@chegewara
Copy link
Contributor

chegewara commented Jun 10, 2019

Hi @mywang-espressif
thanks for sharing this test results, good to know ble can finally works with light sleep.

Could you confirm some values? From what i see in some cases with MAX cpu frequency = 80MHz there is higher current draw than with MAX cpu frequency = 160MHz.
Also strange to me is this:

CONNECTION(connection_interval = 960.0ms, slave_latency = 0) average current 2.05mA, max 121.69mA, min 1.11mA

VS

CONNECTION(connection_interval = 960.0ms, slave_latency = 0) average current 2.11mA, max 106.01mA, min 0.94mA

Min and max values are lower, but average current draw is higher with 80MHz.

Anyway thanks for new feature and comprehensive update about it.

PS only what is missing is comparison with current draw without light sleep enabled.

@dashkova
Copy link

dashkova commented Aug 9, 2023

Hi!

May I ask if you have other modifications?

I added:

#define ADVENTURE_INTERVAL_MIN 3000
#define ADVENTURE_INTERVAL_MAX 3100

    struct ble_gap_adv_params adv_params;
/*
 Other code
*/
    adv_params.itvl_min = ADVENTURE_INTERVAL_MIN;
    adv_params.itvl_max = ADVENTURE_INTERVAL_MAX;

If the intervals are lower (ex. 2500, 2600), then it works.

@xiongweichao
Copy link
Collaborator

@dashkova If you disable modem sleep, will this problem still exist?

@dashkova
Copy link

dashkova commented Aug 29, 2023

if disable light sleep, it works.

esp_pm_config_t pm_config = {
.max_freq_mhz = 160,
.min_freq_mhz = 40,
.light_sleep_enable = false
};

24 hours and more - no problem.

@xiongweichao
Copy link
Collaborator

@dashkova You can try increasing this value.

@S5NC
Copy link

S5NC commented Nov 4, 2023

Hello, is it possible to have the ESP32-S3 powered on (in this state it draws ~40 mA), with Wi-Fi off, but BLE on advertising or waiting for a connection in this low power state? I do not mind using the internal XTAL, as the ESP32-S3 is already on. Currently an average power consumption of 100 mA is recorded when sending advertisement packets every 65 ms.

How much more power (above the 40 mA base) would be consumed if the ESP32-S3 would listen out for a BLE advertisement in this lower power BLE state?

@xiongweichao
Copy link
Collaborator

@S5NC May I ask if you enable this?

@powerfeatherdev
Copy link

powerfeatherdev commented Sep 9, 2024

@S5NC I assume this is for meshtastic? My result with this enabled is ~11mA (advertising interval also adjusted, though).

@michaelboeding
Copy link

I'm having a similar issue to this. I am running with an external crystal and trying to accomplish running BLE with an external crystal to have something similar to the below values. I am using an ESP32-S3.

Chip Max Current Modem Sleep Light Sleep (Main XTAL) Light Sleep (32KHz XTAL)
ESP32 231 mA 14.1 mA X 1.9 mA
ESP32C3 262 mA 12 mA 2.3 mA 140 µA
ESP32S3 240 mA 17.9 mA 3.3 mA 230 µA
ESP32C6 240 mA 22 mA 3.3 mA 34 µA
ESP32H2 82 mA 16.0 mA 4.0 mA 24 µA
ESP32C2 130 mA 18.0 mA 2.5 mA 169 µA

I have all of the settings listed and followed the example here https://github.com/espressif/esp-idf/tree/master/examples/bluetooth/nimble/power_save . But whenI configure it to run it pulls about 25 mA constantly. I never get anywhere near the 230 µA . I'm also seeing the BLE connection get dropped fairly regularly when I call the following.

  // Configure Bluetooth modem sleep with higher minimum frequency
    esp_pm_config_esp32_t pm_config = {
        .max_freq_mhz = 80,  
        .min_freq_mhz = 40,  
    #if CONFIG_FREERTOS_USE_TICKLESS_IDLE
        .light_sleep_enable = true
    #endif
    };
    ESP_ERROR_CHECK(esp_pm_configure(&pm_config));

Could there be something wrong here or am I misunderstanding how this works? I was assuming I could use the external crystal to achieve the 230 µA when running with the config above.

@xiongweichao
Copy link
Collaborator

Hi @michaelboeding ,

These values represent current values in different states and are not average values. When the system enters light sleep, the current value is 230uA.

I'm also seeing the BLE connection get dropped fairly regularly when I call the following.

Could you please provide the log and sdkconfig?

Thanks

@michaelboeding
Copy link

michaelboeding commented Nov 9, 2024

Hey @xiongweichao I think I got this working pretty closely to the estimated values. I had a pin pulled up on a module that was causing some of my readings to be off. I am seeing more like 500 uA but still good.

Might also note that my scan min/max intervals were to fast. So the device was also not going to sleep because of that. And finally I did update the connection parameters based on a connection to match apples guidelines here: https://developer.apple.com/library/archive/qa/qa1931/_index.html

@arnolde
Copy link

arnolde commented Dec 5, 2024

@michaelboeding

Hey @xiongweichao I think I got this working pretty closely to the estimated values. I had a pin pulled up on a module that was causing some of my readings to be off. I am seeing more like 500 uA but still good.

Michael, would you mind sharing some of your code with me? I am just starting to build a project to track horses in my open stable, I want to fasten beacons in their manes, and position a few battery+solar powered ESP32 in important locations (i.e. water and food locations) which shall scan for nearby horses every minute or so, sleeping (can be deep sleep) in between scans. The goal is to log how the horses move around and alert me if a horse does not move for ~4h or so, which might indicate a health problem.

@JhakanMurali
Copy link

Hi @xiongweichao & @michaelboeding ,
We are currently working with Bluetooth gatts_server build and have followed the same steps as specified for ESP32C6 in this example and enabled Light sleep mode :
https://github.com/espressif/esp-idf/blob/master/examples/bluetooth/nimble/power_save/README.md#typical-current-consumption-with-management-enabled.

We are currently getting 15 mA average current consumption instead of the 34 uA mentioned. I just have my ESP32-C6-Mini-1 module and no other components connected other than 32kHz external crystal. Can you provide guidance on how to achieve the current consumption as specified in the example.

@xiongweichao
Copy link
Collaborator

Hi @JhakanMurali , These values represent current values in different states and are not average values. When the system enters light sleep, the current value is 34 uA . You can verify this value by stopping advertising.

@JhakanMurali
Copy link

Hello @xiongweichao ,
Thanks for your response. We understand that the current value is high while the BLE is advertising, but after it is connected to a host device and left idle without any data transfer the current values still remains around 14 mA.

Additionally if possible , kindly specify up to what minimum current value can ESP32 C6 & ESP32H2 be reduced during the advertising phase.

@fanoush
Copy link

fanoush commented Jan 9, 2025

after it is connected to a host device and left idle without any data transfer the current values still remains around 14 mA.

connection needs to be maintained so it is not completely idle, power draw while connected depends on connection interval, it can be quite high if the connection interval is short as the device must wake for every connection interval (to check for data received, handle lost connection etc.)

@JhakanMurali
Copy link

@fanoush @xiongweichao Thanks for your reply. We have stated our working application below. Kindly have a look.
Our key objectives are:
1.Long distance( around 60 -70 metres) BLE communication between a Slave and a Gateway device. The slave device keeps advertising until the gateway captures this device.
2. Low power consumption during the BLE communication (in microamps) preferably since we require longer battery life.

We have enabled Light sleep mode and the power has significantly reduced(in mA). However to further reduce the power consumption, can we set a specific time interval for advertising in Light sleep mode itself and after this specific interval switch to Deep sleep mode and maintain it until next advertising starts.

Kindly provide your insights to help us achieving this

@xiongweichao
Copy link
Collaborator

@JhakanMurali I think you need to note that the light sleep mode can maintain the connection, Deep sleep mode cannot maintain connection. In the connected state, you can reduce power consumption by increasing the connection interval

Before entering deep sleep, you may need to call these APIs (esp_bluedroid_disable(), esp_bluedroid_deinit(), esp_bt_controller_disable(), esp_bt_controller_deinit())

@JhakanMurali
Copy link

@xiongweichao Thanks for the insight. I didn't know that the gateway and slave device will be disconnected when the slave device enters deep sleep mode. I hope I'm understanding this right. If so each time after the slave device switches back to light sleep it has advertise and once again connect with the gateway device right?

I will definitely check with the power consumption after increasing the connection interval. What would be your suggestion on switching between light sleep and deep sleep mode for our application or any other methods to achieve our objectives as stated above.

@xiongweichao
Copy link
Collaborator

@JhakanMurali

If so each time after the slave device switches back to light sleep it has advertise and once again connect with the gateway device right?

Since there is no disconnection, there is no need for advertising and reconnection.

What would be your suggestion on switching between light sleep and deep sleep mode for our application or any other methods to achieve our objectives as stated above.

If you are just using bluetooth, I think you can use deep sleep when there is no connection. For deep sleep, you can refer to Sleep Modes.

@JhakanMurali
Copy link

@xiongweichao You stated that "Deep sleep mode cannot maintain connection",
1.what does this mean? Will the devices already connected through BLE be disconnected when the device enters deep sleep mode?

@JhakanMurali
Copy link

@xiongweichao @fanoush @michaelboeding We've enabled Light sleep mode using 32kHz crystal and have checked for current consumption. The current seems to be in Milliamps(mA) despite stated that it takes current in microamps (uA) as per the datasheet of ESP32-H2-Mini in light sleep MODE.
Application Requirements:
1.BLE must remain always-on.
2.When a pairing request is received from a master device, the ESP32-H2-MINI-1module should establish a connection and enable data communication.
3.If not paired, our ESP32-H2-MINI-1 module should be in BLE advertising mode with minimal power consumption (<20 µA).

I have attached the snippet from ESP32-H2-MINI datasheet stating the current consumption in power modes. Kindly provide your insight on how to achieve this.

Image

@ChrysalisChenJ
Copy link
Collaborator

@xiongweichao @fanoush @michaelboeding We've enabled Light sleep mode using 32kHz crystal and have checked for current consumption. The current seems to be in Milliamps(mA) despite stated that it takes current in microamps (uA) as per the datasheet of ESP32-H2-Mini in light sleep MODE. Application Requirements: 1.BLE must remain always-on. 2.When a pairing request is received from a master device, the ESP32-H2-MINI-1module should establish a connection and enable data communication. 3.If not paired, our ESP32-H2-MINI-1 module should be in BLE advertising mode with minimal power consumption (<20 µA).

I have attached the snippet from ESP32-H2-MINI datasheet stating the current consumption in power modes. Kindly provide your insight on how to achieve this.
Image

@JhakanMurali To fullfill the first two requirements, you need to use light sleep mode.
In light sleep mode, you can achieve around 25 uA current consumption when BLE is not sending or receiving data using 32kHz crystal. However, the current consumption can gets much larger when BLE is sending or receiving data, causing the average current to be bewteen the light sleep cureent and the "active" current based on your BLE configurations such as connection interval, advertising interval and Tx power, etc.

There're a few things you should look into:

  1. Make sure you are using the 32kHz crystal, if you can see this log BLE_INIT: Using external 32.768 kHz XTAL as clock source during BLE initialization process, you are using the 32kHz crystsal correctly, check your menuconfig otherwise.
  2. As I mentioned, the overall current consumption depends highly on your BLE configuration as well. You can use larger advertising and connection interval, or reduce the Tx power to reduce the current consumption, if it suits your application.
  3. If you want to achieve < 20 uA in BLE advertising mode, light sleep mode may not suits you. You can however, use deep sleep mode as @xiongweichao mentioned to achieve smaller current than light sleep mode between advertising intervals. In deep sleep mode, BLE is disabled so you need an extra timer to wake up and enable BLE again to advertise. Take a look at this deep sleep example if you are interested. https://github.com/espressif/esp-idf/tree/master/examples/system/deep_sleep

@michaelboeding
Copy link

Hey @JhakanMurali what are your advertising intervals you are currently using for BLE.

@JhakanMurali
Copy link

We are currently using ESP32H2-MINI1N2 module and have integrated the module with Bluetooth gatts_server build to connect with another ESP32-C6 module with Bluetooth gattc_client build. Along with the ESP32H2 MINI N2 module we have used the 32KHz crystal and have followed the same steps in menuconfig as specified for ESP32H2 .
@ChrysalisChenJ I can view this in my log BLE_INIT: Using external 32.768 kHz XTAL as clock source during BLE initialization process and confirmed that it is configured properly in menuconfig also.

We understand that BLE power save mode is not Pure Light Sleep and during BLE transmit in this mode my current consumed will significantly rise closer to the current between pure light sleep and Active mode. Kindly confirm if I have understood this point clearly

Our Application needs:
1.We have enhanced transmission power upto 12 dBm for long range communication but we will try to vary and verify this.
2. To maintain very minimal current consumption & provide very less time intervals between sleep is also our application need. So we have made sure our module transmits in BLE power save mode for minimum advertising & connection interval (5 seconds) and goes to Deep Sleep for 2 minutes and repeats the same process again.

@michaelboeding
The flow we have followed using ESP32H2-MINI1N2 module with BLE is as below :
1.In the best case scenario our Advertising interval is 2 seconds and connection interval is 3 seconds. After this our module enters deep sleep mode.
2.ESP32H2 stays in Deep Sleep mode for 2 minutes and wakes up back to BLE power save mode.

The Average Current consumed during the advertise and connection interval in BLE power Save mode (5 seconds) is 20 mA. This impacts our Battery Life largely.

Insights required :

  1. We tried integrating the Nimble Power Save example with ESP32H2 module and the power measurement lowered to 6mA.However we were not able to establish a connection with ESP32C6 module and when tried to transfer data using nRFconnect we couldn't send exact data using this example. If you have any Receiver side example code to establish a connection and transfer data properly kindly support.
  2. Kindly suggest if there are any other ways to reduce the 20 mA power consumption.

@JhakanMurali
Copy link

@ChrysalisChenJ @michaelboeding

We have used ESP32H2-MINI-N2 module and set the configurations for ESP32H2 given in this BLE power save(Auto light sleep) mode .But BLE advertising in this mode has given results in mA only. Our requirement for current consumed during BLE advertising is less than 200 microamps (µA)

Hence kindly provide solutions for the below queries:

1.We want to know what is the minimum current consumption (in exact number) in general that can be achieved during BLE advertisement. I can vary my TX power, Advertising interval and connection interval accordingly if this can be possible.
2. If it meets our requirement of less than 200 (µA) then kindly provide the necessary configuration to be done in ESP32-H2.
3. Kindly suggest if there are any ESP based BLE Tags in the market now available.If so, provide the product links for the same.

@ChrysalisChenJ
Copy link
Collaborator

@JhakanMurali

@michaelboeding The flow we have followed using ESP32H2-MINI1N2 module with BLE is as below : 1.In the best case scenario our Advertising interval is 2 seconds and connection interval is 3 seconds.

The Average Current consumed during the advertise and connection interval in BLE power Save mode (5 seconds) is 20 mA. This impacts our Battery Life largely.

When we say advertising interval and connection interval, we mean the interval for BLE to send or receive a packet instead of the period to advertising or remaining connection state. From what you mentioned in the comment, you may use a much smaller advertising interval than 2s when advertising. The average current of ADV should be around 135 uA with the 2s advertising interval and Tx power set to 12 dBm, given that the light sleep-related configurations are correctly set using IDF v5.1.5 while the minimum current is around 27 uA.

1.In the best case scenario our Advertising interval is 2 seconds and connection interval is 3 seconds. After this our module enters deep sleep mode.

The current consumption depends on your application. Using a larger advertising/connection interval can reduce the average current but will require more time to establish the connection or to transfer data. What you can do is change the parameters(Tx Power, advertising/connection interval) to find a set with the power consumption and delay suitable to you.

P.S. As for connection establish failure, plz check if CONFIG_RTC_CLK_SRC_EXT_CRYS is set.

@dimitar-kunchev
Copy link

dimitar-kunchev commented Feb 7, 2025

I believe I am experiencing a related/same issue on ESP32-C6.

Testing with ESP32-C6-Devkit-1. I have connected only a 32 kHz crystal for the RTC. Building the example from nimble/power_save with the sdkconfig.defaults.esp32c6 config without making any changes. Power consumption is about 6mA, while the example says I should expect 34uA. I am measuring it via a 1ohm resistor on the jumper and a multimeter, powering from an external 5V power supply (not USB).

EDIT: The problem was the way I was measuring the current. I did a few more experiments with increasing the advertisement interval and managed to measure the actual sleep current, which is way lower. It's below 1mA for sure, but I don't have the right equipment to measure it properly (yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests