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

problem in battery measurement with NRF51822

Hi to all,

i had a problem in measuring coin cell battery level with nrf51822. i am developing a device with nrf51822 that this device will use from a coin cell battery as power supply method. when i want measure the battery level of the coin cell battery with adc chanell i get the Imprecise voltage. look at below table:

in above table i showed level of the battery in different situation, measurement of the battery level in open-circuit sate with multimeter, measurement of the battery level when nrf use it when ble connection available with adc and multi meter. as you can see when the battery level is low measured battery level with multimeter has 0.5v difference with measured battery level with ADC, but this difference is very less if the battery level is high. and there is another strange behavioral, when i remove the battery for sometime(1 day in my case) and then insert the battery in the circuit, adc measurement show the higher voltage from previous time. following setting to config ADC::

adc_config.reference  = NRF_ADC_CONFIG_REF_VBG;
adc_config.resolution = NRF_ADC_CONFIG_RES_8BIT;
adc_config.scaling    = NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD;
nrf_adc_configure(&adc_config);

// Enable ADC interrupt
nrf_adc_int_enable(ADC_INTENSET_END_Msk);
err_code = sd_nvic_ClearPendingIRQ(ADC_IRQn);
APP_ERROR_CHECK(err_code);

err_code = sd_nvic_SetPriority(ADC_IRQn, 3);
APP_ERROR_CHECK(err_code);

err_code = sd_nvic_EnableIRQ(ADC_IRQn);
APP_ERROR_CHECK(err_code);

and when program receive the interrupt, i use the following code to convert ADC value to mili volt:

#define ADC_PRE_SCALING_COMPENSATION    3                                            /**< The ADC is configured to use VDD with 1/3 prescaling as input. And hence the result of conversion is to be multiplied by 3 to get the actual value of the battery voltage.*/
#define ADC_REF_VOLTAGE_IN_MILLIVOLTS   1200                                         /**< Reference voltage (in milli volts) used by ADC while doing conversion. */
#define ADC_RESULT_IN_MILLI_VOLTS(ADC_VALUE) ((((ADC_VALUE) * ADC_REF_VOLTAGE_IN_MILLIVOLTS) / 255) * ADC_PRE_SCALING_COMPENSATION)


void ADC_IRQHandler(void)
{  
    if (nrf_adc_conversion_finished())
    {
    	uint8_t  adc_result;
    	uint16_t batt_lvl_in_milli_volts;
    	uint8_t  percentage_batt_lvl;
    
    	nrf_adc_conversion_event_clean();
    
    	adc_result = nrf_adc_result_get();
    	batt_lvl_in_milli_volts = ADC_RESULT_IN_MILLI_VOLTS(adc_result);
    	bl = batt_lvl_in_milli_volts;
    }
}

there is anyone that have exprience in measuring battery with nrf51822 and can give me a advice to how can i measure the baery level Accurately??

thanks

Parents
  • Hi,

     

    Judging by your configuration, you are sampling VDD_NRF*1/3, using the internal bandgap regulator (1.2V).

    If you are drawing more current in pulses, like adding a LED, you will draw more current from the battery, which again will add a voltage drop in a small time period, before the capacitors are recharged. Have you tried scoping your VDD to see the ripple under normal operation?

    If you're using a CR2032 battery for testing this, it is quite normal that they will perform worse (higher ripple) with lower voltage (~2.5V, you only have 10 to 20 % capacity left according to this discharge curve).

     

    Best regards,

    Håkon

     

Reply
  • Hi,

     

    Judging by your configuration, you are sampling VDD_NRF*1/3, using the internal bandgap regulator (1.2V).

    If you are drawing more current in pulses, like adding a LED, you will draw more current from the battery, which again will add a voltage drop in a small time period, before the capacitors are recharged. Have you tried scoping your VDD to see the ripple under normal operation?

    If you're using a CR2032 battery for testing this, it is quite normal that they will perform worse (higher ripple) with lower voltage (~2.5V, you only have 10 to 20 % capacity left according to this discharge curve).

     

    Best regards,

    Håkon

     

Children
No Data
Related