This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52 battery monitor

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?

  • 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);
            APP_ERROR_CHECK(err_code);            
                    
            nrf_drv_saadc_uninit();
            NRF_SAADC->INTENCLR = (SAADC_INTENCLR_END_Clear << SAADC_INTENCLR_END_Pos);
            NVIC_ClearPendingIRQ(SAADC_IRQn);
            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);
        }
    }
    
  • 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

  • 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

  • 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!

Related