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

Parents Reply Children
  • I'm trying sdk 12.2 Keil from that devzone case link above for pca10040 DK.
    (wanted to see if I could get it working for 12.2 before updating to SES sdk 15.0)
    It does not seem to budge from 0x64.
    (less charged coins don't seem to be able to power the DK but same coin ok on custom 810, hence this task to view the charge)

    ble_app_uart-1.zip

  • Hi,

    I managed to dig up an example that I made a while ago that shows how you can measure battery voltage and use the battery service. It is for SDK 14.0.0.

    ble_app_battery_service.7z

  • Your example looks like its trying to run off a SAADC pin (this example in Keil exceeds limit and trying to port to SES is erroring out, hex seems ok but always 0x64).

    This case is referring to the proximity example and suggesting to not use the SAADC pin "as the chip can connect VDD to the ADC input internally" to check battery output.
    Then trying proximity for SES sdk15.0, on a DK with only a coin, the values on nrf connect are a constant 0x00.

    Just looking for a confirmation that by using the proximity example on the DK the battery service should show values according to the coin output and not 0x00.

  • Hi

    Your example looks like its trying to run off a SAADC pin
    What makes you say that? It uses VDD as input:

    void saadc_init(void)
    {
        ret_code_t err_code;
    
        nrf_saadc_channel_config_t channel_config =     {                                                  \
            .resistor_p = NRF_SAADC_RESISTOR_DISABLED,     \
            .resistor_n = NRF_SAADC_RESISTOR_DISABLED,     \
            .gain       = NRF_SAADC_GAIN1_6,               \
            .reference  = NRF_SAADC_REFERENCE_INTERNAL,    \
            .acq_time   = NRF_SAADC_ACQTIME_10US,          \
            .mode       = NRF_SAADC_MODE_SINGLE_ENDED,     \
            .burst      = NRF_SAADC_BURST_DISABLED,        \
            .pin_p      = (nrf_saadc_input_t)(NRF_SAADC_INPUT_VDD), \ // <- USING VDD AS INPUT
            .pin_n      = NRF_SAADC_INPUT_DISABLED         \
        };
        ....

    Anyway, I wasn't aware that the ble_app_proximity example uses the SAADC for battery measurements, but I just tested it and it seems to work out of the box and provides real battery level data. 

    Note that the example uses this function to convert the ADC voltage to a value between 0-100%. And 100 dec = 0x64 hex. Hence, when you say that the value is always 0x64 it indicates that you just have a good battery. If your coin cell provides a voltage lower than ~2.4 V on the other hand, it might be that the function actually always returns 0 %. 

  • 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?

Related