Current consumption on a BLE keyboard is dependent on how efficient the scanning routine is, how eficient it processes keystrokes, if/how the processor is put on hold, and BLE radio usage.
Current consumption of the BLE radio is much higher than that of the processor. However, as BLE messages are only occurring at a specific frequency and are not continuous, their impact on a time-averaged basis is not as significant than the running average of the processor running constantly.
- Adafruit Learning Guide - CircuitPython Deep Sleep
- CircuiPython ReadTheDocs
- Zephyr vs Arduino Power Consumption on the nRF52840 - Youtube Video
- Gihub Issue: Bluefruit.begin() causes high power consumption
- Sleep in Arduino - code example
- nRF52840 datasheet (pdf)
Normal Power Consumption
|connected to BLE||700-750 uA||950-1000 uA||6.8-7.2 mA|
|Sleeping||50 uA||60 uA||160-200uA|
I tested the code below to see if time.sleep and alarm.light_sleep differed in power consumption and if one was better than the other. Unfortunately, both had the same power consumption with an average of 7mA. Such a high current is similar to the issue filed on the Adafruit nRF52 arduino package when the cryptocell was implemented and power consumption jumped up significantly.
Note that this was done on August 27th and some changes were done in the CircuitPython Light Sleep code since then.
Deep Sleep vs Sleeping Beauty (System OFF)
The CircuitPython implementation of deep sleep isn't the same as what was implemented for the BlueMicro_BLE firmware. The arduino implementation is quite simple:
- setup the anode (+ve) side of the keyboard matrix to be outputs and put them
HIGH. This will apply the necessary voltage to enable a trigger on the cathode side (-ve) when a key is pressed while sleeping
- setup GPIOs on the cathode side of the matrix to be
sd_power_system_off();This is the softdevice call to completely power down the chip.
At that point the chip powers down but when a key is pressed, it wakes up as if rebooting from a reset or a power up. The
RESETREAS register would have the E bit set (see datasheet, page 75) on powerup. The bootloader does not appear to clear-out the
RESETREAS Regiter but does clear the
GPREGRET register if appropriate. See code here
When referring to the nRF52840 Datasheet, page 149 and 150, we see that this wake-up mechanism is simple (POWER Peripheral uses the DETECT signal to exit from System OFF mode)