nRF52 battery monitor

bartdekramer gravatar image

asked 2017-05-19 14:38:07 +0100

In the ULP Wireless Q magazine (edition winter 2016), on page 12 / 13 there is listed that the nRF52 chips have a Battery Monitor peripheral but I cannot find anything about it in the product specifications. Do you have more information about it?

edit retag flag offensive close delete report spam

1 answer

Sort by » oldest newest most voted
erltot gravatar image

answered 2017-05-19 15:46:54 +0100

Try SAADC (github example) and set SAADC sorce as NRF_SAADC_INPUT_VDD

my saadc callback:

void saadc_callback(nrf_drv_saadc_evt_t const * p_event){
    if (p_event->type == NRF_DRV_SAADC_EVT_DONE){
        uint32_t err_code;        

        err_code = nrf_drv_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER);

        float battery = (p_event->data.done.p_buffer[0] / 1023.0f) * 3.6f;

        char displaybuf[BLE_NUS_MAX_DATA_LEN];
        uint8_t chars = 0;
        chars = snprintf(displaybuf,BLE_NUS_MAX_DATA_LEN,"%.3f",battery);
        ble_nus_string_send(&m_nus, (unsigned char*)displaybuf, chars);
edit flag offensive delete publish link more


OK, so this gives me information about the battery voltage. I thought (or maybe wished is a better word for it ;) ) this peripheral could give me the battery status

Bart de Kramer ( 2017-05-19 15:51:14 +0100 )editconvert to answer

With the peripheral 'Battery Management' I was thinking about remaining power. This is what I'm realy interested in to give the customer an indication of remaining life time

Bart de Kramer ( 2017-05-24 08:06:01 +0100 )editconvert to answer

That is quite a complex feature!

I think the easiest approach would be measuring the battery voltage and correlate that with how much capacity is left from the datasheet, however this might not be the same for each battery.

Another approach is to measure how much power your application use and make an estimator in your application that calculates the usage either by runtime or by measurements, e.g. you learn that your instrument fail after 500 000 measurements, then you can start counting measurements and give a percentage from there..

Either way, it's not trivial!

erltot ( 2017-05-26 16:10:17 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

Question Tools

1 follower


Asked: 2017-05-19 14:38:07 +0100

Seen: 455 times

Last updated: mai 19 '17