Battery level Reading Error

Hi,

I am trying to use cr2032 battery with nrf52840 to measure the battery level.

To begin with, I first integrated the battery level measuring code in my  application from ble_app_hrs which is located in the examples/ble_peripheral/ which did not work at all and then i tried to code normally using 14 bit resolution for better accuracy.

For simulation, I am using DC Power Supply to change the voltage, NRF_SAADC_INPUT_VDD as the input channel and nrf connect app so as to validate the measurement. However, battery percentage is 100  from 3.3V to 2.5V / 2.4V and started to decrease only after 2.5V from 100%.It was showing 98% for 2.4V, 80% for 2.1 V and decreasing further up to 58% for 1.8V Could anyone please help me on how to accurately measure battery level of nrf52840 with CR2032 battery from 3.3V? Code Snippets are attached .

Parents
  • Hi,

    The HRS example in the nRF5 SDK use dummy battery values, so there is no wonder you found that it did not work. However, I would recommend to take a look at the proximity example, which demonstrate how to read the VDD voltage via the SAADC, and convert that to a battery percentage using a simple CR2032 battery discharge curve. Specifically, look in examples\ble_peripheral\ble_app_proximity\main.c.

    (Note that there are some fundamental issues with using battery voltage to calculate the battery state, so this will only give you ballpark numbers. But without additional HW, that is all you can do.)

  • Hi,

    I tried taking the battery percentage code from the ble_app_proximity example in to my application. It is still the same with no progress. Though i had implemented the same steps like initializing timers, creating battery timeout handler, configuring saadc and  saadc event handler, at last trying to store the battery percentage by calculations in the handler in a variable and sending it via beacons. I am facing the same trouble all the way again.until 2.5 v i am not able to see any changes in the battery level. 

Reply
  • Hi,

    I tried taking the battery percentage code from the ble_app_proximity example in to my application. It is still the same with no progress. Though i had implemented the same steps like initializing timers, creating battery timeout handler, configuring saadc and  saadc event handler, at last trying to store the battery percentage by calculations in the handler in a variable and sending it via beacons. I am facing the same trouble all the way again.until 2.5 v i am not able to see any changes in the battery level. 

Children
No Data
Related