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

how to measure the coin cell battey voltage in real

Hello Everyone,

I am trying to measure the (3v)battery voltage by having proximity example as reference but intially it is showing 100percent later it is going to 13(percent) voltage approxmiatelry (after 120seconds) i dont understand why it is happening like this can anyone suggest me some possible ways to measure out by using multimeter how much voltage available on ADC pin ? so that i can able to make some idea about the battery level measurement§?

Parents
  • The proximity example in SDK 11 uses a app timer to measure the battery level. The first measurement is not performed until the first time it times out, and the timeout is 120 second (thus measurements are performed every 120 seconds). You can modify BATTERY_LEVEL_MEAS_INTERVAL and set it to a lower value in order to measure more often. You can also do the first measurement at startup, rather than waiting the full measurement interval before doing the first measurement.

    Also, if you are not using the DK you may have to change the value of DIODE_FWD_VOLT_DROP_MILLIVOLTS to reflect your hardware.

  • You are just printing random data. This is snippet from your main() function shows that you are declaring the variables adc_value and batt_lvl_in_milli_volts and printing them without ever initializing them:

     int adc_value,batt_lvl_in_milli_volts;
     uart_config();
     printf("initialization");
     printf("%d adc_value\n",  adc_value); // out ADC result
     printf("%d\r\n", batt_lvl_in_milli_volts ); // out ADC result
    

    You have the same variable names defined in ADC_IRQHandler(), but these are completely independent variables though they have the same names. (The variables are declared in separate functions, so they will have separate scopes, and this will not generate any warnings. You should get warnings for using a uninitialized variable, though, depending on how your compiler is configured).

Reply
  • You are just printing random data. This is snippet from your main() function shows that you are declaring the variables adc_value and batt_lvl_in_milli_volts and printing them without ever initializing them:

     int adc_value,batt_lvl_in_milli_volts;
     uart_config();
     printf("initialization");
     printf("%d adc_value\n",  adc_value); // out ADC result
     printf("%d\r\n", batt_lvl_in_milli_volts ); // out ADC result
    

    You have the same variable names defined in ADC_IRQHandler(), but these are completely independent variables though they have the same names. (The variables are declared in separate functions, so they will have separate scopes, and this will not generate any warnings. You should get warnings for using a uninitialized variable, though, depending on how your compiler is configured).

Children
No Data
Related