Bluetooth: Power Profiling

This sample can be used to measure power consumption when Bluetooth® Low Energy is used for communication. You can measure power consumption during advertising and data transmission. For this purpose, the sample demonstrates advertising in a connectable and non-connectable mode.

Requirements

The sample supports the following development kits:

The following board variants do not have DFU capabilities:

S115:

Hardware platform

PCA

Board target

nRF54L15 DK

PCA10156

bm_nrf54l15dk/nrf54l15/cpuapp/s115_softdevice

nRF54L15 DK (emulating nRF54L10)

PCA10156

bm_nrf54l15dk/nrf54l10/cpuapp/s115_softdevice

nRF54L15 DK (emulating nRF54L05)

PCA10156

bm_nrf54l15dk/nrf54l05/cpuapp/s115_softdevice

nRF54LM20 DK

PCA10184

bm_nrf54lm20dk/nrf54lm20a/cpuapp/s115_softdevice

nRF54LS05 DK

PCA10214

bm_nrf54ls05dk/nrf54ls05b/cpuapp/s115_softdevice

nRF54LV10 DK

PCA10188

bm_nrf54lv10dk/nrf54lv10a/cpuapp/s115_softdevice

S145:

Hardware platform

PCA

Board target

nRF54L15 DK

PCA10156

bm_nrf54l15dk/nrf54l15/cpuapp/s145_softdevice

nRF54L15 DK (emulating nRF54L10)

PCA10156

bm_nrf54l15dk/nrf54l10/cpuapp/s145_softdevice

nRF54L15 DK (emulating nRF54L05)

PCA10156

bm_nrf54l15dk/nrf54l05/cpuapp/s145_softdevice

nRF54LM20 DK

PCA10184

bm_nrf54lm20dk/nrf54lm20a/cpuapp/s145_softdevice

nRF54LS05 DK

PCA10214

bm_nrf54ls05dk/nrf54ls05b/cpuapp/s145_softdevice

nRF54LV10 DK

PCA10188

bm_nrf54lv10dk/nrf54lv10a/cpuapp/s145_softdevice

Optionally, you can use the Power Profiler Kit II (PPK2) for power profiling and optimizing your configuration. You can also use your proprietary solution for measuring the power consumption.

Overview

This sample implements the low power mode and the system off mode.

Low power mode

The application enters CPU sleep mode when in idle state, which means it has nothing to schedule. Wake-up events are interrupts triggered by one of the SoC peripheral modules, such as RTC or SystemTick.

System off mode

The system is put in system off mode 5 seconds after power up, unless advertising is started, and when the device disconnects from the central device. This is the deepest power saving mode the system can enter. In this mode, all core functionalities are powered down, and most peripherals are non-functional or non-responsive. The only mechanisms that are functional in this mode are reset and wake-up.

To wake up your development kit from the system off state, you have the following options:

  • Press the RESET button on your development kit.

  • Press Button 2 to start connectable advertising.

  • Press Button 3 to start non-connectable advertising.

The development kit starts advertising automatically when pressing Button 2 or Button 3 and goes to System off mode when pressing RESET.

When you establish a connection with a central device, you can test different connection parameters to optimize the power consumption. When the central device enables the notification characteristic, your development kit starts sending notifications until the timeout set by the CONFIG_SAMPLE_BLE_PWR_PROFILING_NOTIF_CONNECTION_TIMEOUT Kconfig option expires. The device then disconnects from the central and enters the system off mode. You can press a button to wake up the device and continue testing.

Power profiling

You can use the Power Profiler Kit II (PPK2) for power profiling with this sample. See the device documentation for details about preparing your development kit for measurements.

The following parameters have an impact on power consumption:

  • Connection interval

  • Advertising duration

  • Latency

  • Notifications data size and interval

You can configure these parameters with the Kconfig options. If your central device is the Bluetooth Low Energy app from nRF Connect for Desktop, you can use it to change the current connection parameters.

Service UUID

This sample implements a custom service.

The 128-bit service UUID is 00001630-1212-EFDE-1523-785FEABCD123.

Characteristics

The 128-bit characteristic UUID is 00001631-1212-EFDE-1523-785FEABCD123. This characteristic value can be read or sent by the notification mechanism. The value is an array filled with zeroes, where upon enabling notifications the value of the last byte will increase per notification. You can configure the length of data using the CONFIG_SAMPLE_BLE_PWR_PROFILING_CHAR_VALUE_LEN Kconfig option.

This characteristic has a client characteristic configuration descriptor (CCCD) associated with it.

User interface

Button 2:

Starts connectable advertising and wakes up the SoC from the system off state.

Button 3:

Starts non-connectable advertising and wakes up the SoC from the system off state.

Note

When you use buttons to wake up the SoC from the system off state, the button state is read in the main thread. This causes a delay between the SoC wake up and button press processing. If you want to start advertising on system start, you must keep pressing the button until you see a log message confirming the advertising start on the terminal.

LED 0:

Lit when the device is initialized, if configured.

LED 1:

Lit when a device is connected, if configured.

Note

The LEDs are disabled by default. You can enable LEDs by setting the CONFIG_SAMPLE_BLE_PWR_PROFILING_LED Kconfig option. Enabling the LEDs increases power consumption by ~1.8 µA in active and low-power modes when not connected, and by ~3.7 µA when connected to a device, due to the second LED.

Configuration

The Peripheral Power Profiling sample allows configuring some of its settings using Kconfig. You can set different options to monitor the power consumption of your development kit. You can modify the following options (available in the Kconfig file at samples/bluetooth/ble_pwr_profiling):

  • CONFIG_SAMPLE_BLE_PWR_PROFILING_CHAR_VALUE_LEN - Sets the length of the data sent through notification mechanism.

  • CONFIG_SAMPLE_BLE_PWR_PROFILING_NOTIF_CONNECTION_TIMEOUT - Sets the notification timeout in milliseconds. When the timeout is reached, the device will stop sending notifications. After that, the sample disconnects and enters the system off mode.

  • CONFIG_SAMPLE_BLE_PWR_PROFILING_CONN_ADVERTISING_TIMEOUT - Sets the connectable advertising duration in 10-millisecond units. If the connection is not established during advertising, the device enters the system off state.

  • CONFIG_SAMPLE_BLE_PWR_PROFILING_CONN_ADVERTISING_INTERVAL - Sets the connectable advertising interval in 0.625-millisecond units.

  • CONFIG_SAMPLE_BLE_PWR_PROFILING_NONCONN_ADVERTISING_TIMEOUT - Sets the non-connectable advertising duration in 10-millisecond units. When the advertising ends, the device enters the system off state if there is no outgoing connection.

  • CONFIG_SAMPLE_BLE_PWR_PROFILING_NONCONN_ADVERTISING_INTERVAL - Sets the non-connectable advertising interval in 0.625-millisecond units.

  • CONFIG_SAMPLE_BLE_PWR_PROFILING_LED - Enable LEDs. Disabled by default to reduce power consumption.

Building and running

This sample can be found under samples/bluetooth/ble_pwr_profiling/ in the Bare Metal folder structure.

For details on how to create, configure, and program a sample, see Getting Started with the samples.

Note

The sample has logging disabled as default. To enable terminal messages (at the cost of a small increase in power consumption), enable the following Kconfig options:

Testing

This testing procedure assumes that you are using nRF Connect for Mobile or nRF Connect for Desktop. After programming the sample to your development kit, you need another device for measuring the power consumption. Power Profiler Kit II (PPK2) is the recommended device for the measurement.

Testing with Bluetooth Low Energy app and Power Profiler Kit II (PPK2)

  1. Set up Power Profiler Kit II (PPK2) and prepare your development kit for current measurement.

  2. Run the Power Profiler app from nRF Connect for Desktop.

  3. Connect to the kit with a terminal emulator (for example, the Serial Terminal app).

  4. Reset your development kit.

  5. Observe that the sample starts. The device enters the system off state after five seconds if advertising is not started. Observe a significant power consumption drop when the device enters the system off state.

  6. Use the device buttons to wake up your device and start advertising. You can measure power consumption during advertising with different intervals. Use the Kconfig options to change the interval or other parameters.

  7. Connect to the device through the Bluetooth Low Energy app.

  8. Set different connection parameters:

    1. Click Settings for the connected device in the Bluetooth Low Energy app.

    2. Select Update connection.

    3. Set new connection parameters.

    4. Click Update to negotiate new parameters with your device.

  9. Observe the power consumption with the new connection parameters.

  10. In service with UUID 000016301212EFDE1523785FEABCD123, click Notify for the characteristic.

  11. Observe that notifications are received.

  12. After the timeout set by the CONFIG_SAMPLE_BLE_PWR_PROFILING_NOTIF_CONNECTION_TIMEOUT option, your development kit disconnects and enters the system off mode.

  13. Repeat this test using different wake-up methods and different parameters, and monitor the power consumption for your new setup.