Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to make Battery Level updates 100 times per second?

Dear Sir/Madam,

I am playing with SDK12.2 on PCA10028 board and runs its HRS example.  This example has a battery service and its battery level characteristic could update its value at about 2 second interval which is controlled by an application timer which is 2000 ticks.  I tried to increase the battery level updating frequency as high as possible. So I decreased the timer out value to small value, ex, 50 ticks, 10 ticks. But the output is always only 5 ~10 per second.

My goal is increase the battery levle updating frequency to 200 Hz.  Could you help me with this issue?

Thanks,

Jun Gong

  • Hi,

    The example has its range of connection intervals defined in main.c on line 79 and 80 as follows:

    #define MIN_CONN_INTERVAL                MSEC_TO_UNITS(400, UNIT_1_25_MS)            /**< Minimum acceptable connection interval (0.4 seconds). */
    #define MAX_CONN_INTERVAL                MSEC_TO_UNITS(650, UNIT_1_25_MS)            /**< Maximum acceptable connection interval (0.65 second). */

    This means that regardless of the speed you queue notifications, the notifications are only sent every 0.4 - 0.65 seconds. You will need to reduce the conn interval to get higher frequency, but be aware that Bluetooth low energy only goes down to 7.5 ms. If you need higher refresh rates than this you need to collect multiple measurements and send them together in packages. Also note that the central device may have different conn params it wants to use, and may not always support 7.5ms. E.g. if the device connects to an Android phone which only does 30ms updates on BLE your conn params update request may be rejected if you set both max and min to 7.5ms.

    Best regards,
    Rune Holmgren

Related