Power saving.

Hello,

I am currently working on a project where i have to sample with sensors a few times per day. But it is battery powered and I have limited capacity.

Now my question is if anyone has got any power saving tips for me.

Does anyone know how to let the nrf calculate some code, when it is done the nrf will just wait/sleep for lets say 15 minutes with minimal power consumption, and after that the nrf will calculate the same code again. etc, etc.

It is kind of an open question but I would appreciatie all the help.

Thanks in advance!

Parents
  • Hi,

    The general trick to achieve a low average power consumption is to "race to idle". In other words, try to get the device to idle mode as quickly as possible and stay in idle mode for as much of the time as possible. Idle mode for most nRF devices means system ON low power mode with the LFCLK and a couple of RTC instances running, in order to keep track of time and wake up the device at specific times.

    You can see typical current consumption in different states under Current consumption scenarios. Also, if you are using nRF Connect SDK, you should refer to Power optimization, which has a lot of information about this, including links to the  Online Power Profiler that you may find useful in order to see what you can achieve for Bluetooth designs.

    Does anyone know how to let the nrf calculate some code, when it is done the nrf will just wait/sleep for lets say 15 minutes with minimal power consumption, and after that the nrf will calculate the same code again. etc, etc.

    It is difficult to calculate all factors, so what I would suggest is to make a test where you do the calculation you need, and check with a PPK2 or other power measurement tool, or look at the current consumption scenarios if you have an idea of for how long the CPU will need to do the task(s) you need. A typical idle current consumption for the nRF is a few micro amps.

    Lastly, if you supply the device with a fairly high voltage (say 3V), then make sure you populate the two optional inductors on your HW, and ensure you enable the DC/DC. 

  • I don't really understand how System ON low power works, like how do you enable it? And how can you see it is enabled?

    I got the LFCLK running and a RTC to keep track of time but how do I send an interupt (I suppose) to wake the device when it counts to 7000 ticks lets say.

    And populate two optional inductors? What do you mean?

  • Hi,

    Chriis said:
    I don't really understand how System ON low power works, like how do you enable it? And how can you see it is enabled?

    This is the mode where the CPU is in idle, so effectively __WFE(). If you are using the nRF Connect SDK, the idle thread enters idle automatically, so you don't need to to it explicitly. The only thing you need to do, is stop doing things that consume power, and when there is no work to be done, the device will stay in system ON idle mode until woken up by an interrupt (typically from the RTC). If you use the nRF5 SDK, you can see that all example has a main loop and at one point in the main loop it will enter idle mode (either by a direct call to sd_app_evt_wait, WFE/WFI or via some other library like a call to nrf_pwr_mgmt_run() or similar).

    Chriis said:

    I got the LFCLK running and a RTC to keep track of time but how do I send an interupt (I suppose) to wake the device when it counts to 7000 ticks lets say.

    That depends on the SDK you are using, and how you prefer to do things. If you are using the nRF Connect SDK, Zephyr use a RTC to keep track of time, so simply use the Zephyr timer APIs (like k_slee()). If using the nRF5 SDK, I would recommend using the app timer library. This is used extensively in the SDK. Or if you are making a very simple thing and want to do things as low level as possible, you can use the RTC directly (either via a driver or HAL, or direct registers access). The latter typically does not make much sense for a bigger project though as you will spend a lot of time duplicating work that we have already done for you. Which SDK are you using? Both the nRF5 DSK and nRF Connect SDK includes examples demonstrating this, and you should also keep in mind that most of the prodocts we are in are low power, so low power is a fundamental part of what we deliver. So generally, you don't need to think much about it.

    Chriis said:
    And populate two optional inductors? What do you mean?

    In order to use the DC/DC converter, your board must contain two inductors which are optional. If using only LDO mode, you can skip them. But if you have a high supply voltage using LDO means wasting a lot of power (you can think of the LDO as a simple voltage divider). If you use HW someone else made, this is not relevant. But if you are designing your own HW and need it to be as low power as possible, make sure to include the inductors. Refer to the Reference circuitry for details, where you can see different schematics for LDO and DC/DC mode (where the DC/DC has the two mentioned inductors).

Reply
  • Hi,

    Chriis said:
    I don't really understand how System ON low power works, like how do you enable it? And how can you see it is enabled?

    This is the mode where the CPU is in idle, so effectively __WFE(). If you are using the nRF Connect SDK, the idle thread enters idle automatically, so you don't need to to it explicitly. The only thing you need to do, is stop doing things that consume power, and when there is no work to be done, the device will stay in system ON idle mode until woken up by an interrupt (typically from the RTC). If you use the nRF5 SDK, you can see that all example has a main loop and at one point in the main loop it will enter idle mode (either by a direct call to sd_app_evt_wait, WFE/WFI or via some other library like a call to nrf_pwr_mgmt_run() or similar).

    Chriis said:

    I got the LFCLK running and a RTC to keep track of time but how do I send an interupt (I suppose) to wake the device when it counts to 7000 ticks lets say.

    That depends on the SDK you are using, and how you prefer to do things. If you are using the nRF Connect SDK, Zephyr use a RTC to keep track of time, so simply use the Zephyr timer APIs (like k_slee()). If using the nRF5 SDK, I would recommend using the app timer library. This is used extensively in the SDK. Or if you are making a very simple thing and want to do things as low level as possible, you can use the RTC directly (either via a driver or HAL, or direct registers access). The latter typically does not make much sense for a bigger project though as you will spend a lot of time duplicating work that we have already done for you. Which SDK are you using? Both the nRF5 DSK and nRF Connect SDK includes examples demonstrating this, and you should also keep in mind that most of the prodocts we are in are low power, so low power is a fundamental part of what we deliver. So generally, you don't need to think much about it.

    Chriis said:
    And populate two optional inductors? What do you mean?

    In order to use the DC/DC converter, your board must contain two inductors which are optional. If using only LDO mode, you can skip them. But if you have a high supply voltage using LDO means wasting a lot of power (you can think of the LDO as a simple voltage divider). If you use HW someone else made, this is not relevant. But if you are designing your own HW and need it to be as low power as possible, make sure to include the inductors. Refer to the Reference circuitry for details, where you can see different schematics for LDO and DC/DC mode (where the DC/DC has the two mentioned inductors).

Children
  • Yeah currently I am using SEGGER embedded. Is there anything I need to look out for in terms of putting the chip into SYSTEM ON sleep?

    Also, what is necessary to meassure the current being used by the nRF52832 on the PCA10040?

    And lastly something about the __WFE() function. 

    Right know I got this in my main loop:

    int main(void)
    {
    
    power_off_peripherals();
    
    leds_config();
    
    lfclk_config(); //start the internal Xtal clock.
    
    rtc_config(); //config of the RTC.
    
    while (1)
    {
    __WFE();
    __SEV();
    __WFE();
    }
    }

    If I put something before the WFE function, like a GPIO function that will toggle a led. Will it toggle the led, go to sleep until the systeem gets an interupt, toggle led, go to sleep until interupt, and loop like that?

  • Hi,

    Chriis said:
    Is there anything I need to look out for in terms of putting the chip into SYSTEM ON sleep?

    As long as you don't use the SoftDevice (which it does not seem like from this snippet), then the way you enter system on mode is good.

    Chriis said:
    Also, what is necessary to meassure the current being used by the nRF52832 on the PCA10040?

    See Measuring current.

    Chriis said:
    If I put something before the WFE function, like a GPIO function that will toggle a led. Will it toggle the led, go to sleep until the systeem gets an interupt, toggle led, go to sleep until interupt, and loop like that?

    Yes, that is correct. When you call WFE in the main loop like this, the CPU will enter idle every time the main loops runs, and it will run every time after an interrupt has been processed.

  • Thanks! 

    Right now I am measuring the NRF52 DK board. I measure 4,2 uA with System ON sleep. I got lfclk xtal, rtc and full ram retention running. The spec sheet said that it would be about 2 uA. What do you think would you suggest can be an issue?

  • The DK has some other leakages, so you typically will not be able to measure 2 uA on the DK in system ON sleep, which is the number for the SoC itself. (These are so low numbers anyway though, so if it is for power optimizing your application I would not think about it, as the DK itself contributes, and also there will be some variations from chip to chip.)

Related