BLE Hands on Optimizing Power Consumption - joe-possum/IoT-Developer-Boot-Camp GitHub Wiki

In this worksheet we introduce the Energy Profiler.

Reopen the Eddystone TLM project and flash the firmware to the device.

From the Open Perspective icon (1), open Energy Profiler (2).

AdvData

Click the Quick Access menu (3), and select Start Energy Capture.

AdvData

Select the WSTK in the dialog.

AdvData

The device is now measuring the current drawn by the device from the V_MCU power supply. At the initial zoom it is possible to see each advertising event. It is possible to zoom using the horizontal (4) and vertical (5) controls. The sampling rate is 10 kHz, so seeing the individual advertising TX is just on the limit of resolution.

AdvData

AdvData

Noting that in the default configuration the device is drawing approximately 80 uA during operation. Once again from the Quick Access menu, select Stop Energy Capture. It is important to do this, since Energy Monitor locks access to the device which will interfere with flashing.

AdvData

The biggest factor affecting current draw will be how frequently the device wakes up. Lets double the duration between advertising events.

  // Set advertising interval to 200ms.
  sc = sl_bt_advertiser_set_timing(
    advertising_set_handle,
    320, // min. adv. interval (milliseconds * 1.6)
    320, // max. adv. interval (milliseconds * 1.6)
    0,   // adv. duration
    0);  // max. num. adv. events
  app_assert_status(sc);

AdvData

We can try reducing the TX power using sl_bt_system_set_tx_power, but this does not have a large effect on the Eddystone beacon project, since TX duration is small compared to wake up and other overhead in EM0/EM1. For a device transmitting with a high duty cycle, this would be more important.

You may be surprised by how much the current increases if the connectable type is changed from non-connectable to connectable-scannable, on my BGM220S current increased from 81 uA to 125 uA.

  sc = sl_bt_legacy_advertiser_start(advertising_set_handle,
                                     sl_bt_advertiser_connectable_scannable);
  app_assert_status(sc);

Conclusion

With simple the simple Bluetooth alone examples it is difficult to optimize much other than maximizing time spent asleep. In a noisy environment it may be cheaper to use smaller packets so that in the event that a packet is corrupted, the volume of resent data is minimized. However most real projects will include several other peripheral and Energy Monitor can be a valuable tool in testing.

⚠️ **GitHub.com Fallback** ⚠️