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

How do I measure battery level on an Nrf51422 without external components?

I have a custom PCB with an nrf51422 powered by a coin cell battery. The EE who designed the board assured me that the battery voltage could be measured internally through the ADC. That EE is now tied up and cannot help.

What is the proper method for measuring this voltage? It is a standard feature in nearly all devices, yet the inclusion of a resistor set will leak current. Any direction would be appreciated. Thanks.

Edit: I am able to find examples of battery service updates, but these updates are based on a simulated battery as per the code below. I have not yet found an example of configuring of the ADC to VCC.

static void battery_level_update(void)
{
    uint32_t err_code;
    uint8_t  battery_level;

    battery_level = (uint8_t)sensorsim_measure(&m_battery_sim_state, &m_battery_sim_cfg);

    err_code = ble_bas_battery_level_update(&m_bas, battery_level);
    if ((err_code != NRF_SUCCESS) &&
        (err_code != NRF_ERROR_INVALID_STATE) &&
        (err_code != BLE_ERROR_NO_TX_BUFFERS) &&
        (err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING)
        )
    {
        APP_ERROR_HANDLER(err_code);
    }
}
Related