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

DK coin cell tester

Looking to make the nrf52 DK into a CR2032 coin cell battery tester.
I tried a couple of sdk 15.0 examples, uart, proximity and another from a devzone case but not really getting the actual values but something like 100% or 0x64 with no external USB, just coin.

The idea is to take the DK on its own, inset the coin, nrf connect to the battery service, then hit battery level and click read for hex value (or % on android), (not really looking for a loop from the DK, but a manual read).

-thank-you

  • I missed that NRF_SAADC_INPUT_VDD condition thinking SAADC is only through the pin.

    Tried sdk15.0  proximity sample s132 hex file on the DK using a coin with only a 2.55 V charge, and 0x64 is coming across on connect for iOS.
    If anything should show something closer to 0x00.
    Maybe missing something in the steps if out of the box (hex) works?

  • Hi,

    I think I figured out what's going on:

    1. The initial battery value is always set to 100 during startup inside bas_init().
    2. The actual battery level is never measured unless you are in a connection and have enabled CCCD on the battery service.
    3. When you enable CCCD a timer is started inside on_bas_evt().
    4. After a 120 second delay the battery voltage is finally measured and the characteristic updated. 

    You can try some of this:

    1. Connect, enable CCCD, and wait.
    2. Start the battery timer with app_timer_start(m_battery_timer_id, BATTERY_LEVEL_MEAS_INTERVAL, NULL); somewhere at the start of your application to make it do periodic battery measurements whether you are in a connection or not. 
    3. Lower the value of BATTERY_LEVEL_MEAS_INTERVAL to make the example sample the battery more often.

     

  • Those steps worked out better, now getting around 0x04 on the weak coin.

    -thank-you.

Related