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

nrf52 Battery Measurement 4*AA batteries

Hello,

I need to measure battery on my nrf52 beacon. My input voltage is 4*AA batteries(each 1.2V so in total 4.8V). The schematic provided by the hardware developer is as follows

Now I read few posts about battery measurements and looks like I need to add some additional hardware? Kindly tell me whether its possible to measure voltage using existing hardware, if so please describe, the calculations or at least point me to the right direction.

Thank You

Regards

Bilal

Parents Reply
  • I agree with awneil.

    I see on your circuit diagram that you are running your nRF52 at 3.3V.

    Although you can run the nRF52 on more than 3.3V, you can only allow an input to be 0.3V above that.

    If you wish to detect the battery voltage directly then you will need a divider of sorts to step down the voltage, but these tend to impose their own problems due to leakage currents.

    These are all points that your hardware engineer should take into account.

    So you may look at measuring a voltage that has a maximum of 2.4V say and then internally calculate that as 4.8V

    Alternatively you may wish to just measure the voltage on the MCU supply line using one of your Analogue Inputs (AIN#), but that will limit your maximum value to 3.3V.

Children
  • Thank You @cbd and @awneil.  So i just checked, apparently we have a voltage divider having R1 = 470k, R2 = 110k and capacitor = 1nf, we also feed the output to AIN7. So do we need to just start the adc pin and start sampling with configuration NRF_ADC_CONFIG_REF_VBG   ?

  • You haven't said what specific chip you are using.

    Whatever it is, study the ADC chapter in its Product Specification - that will tell you the options for gain, reference, etc - and you choose whatever is appropriate to the signal you're measuring.

    You may also want to look at the ADC example in the SDK ...

  • So I took reference voltage , vdd/4 (my vdd is 3.3V), gain = 1/5 and resolution 12 bit, here is my initialization for it

    err_code = nrf_drv_saadc_init(nullptr,saadc_callback);
    APP_ERROR_CHECK(err_code);
    nrf_saadc_channel_config_t channel_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN7);
    channel_config.gain = NRF_SAADC_GAIN1_5;
    channel_config.reference = NRF_SAADC_REFERENCE_VDD4;

    err_code = nrf_drv_saadc_channel_init(0, &channel_config);
    APP_ERROR_CHECK(err_code);
    nrf_saadc_resolution_set(NRF_SAADC_RESOLUTION_12BIT);
    err_code = nrf_drv_saadc_buffer_convert(m_buffer, 1);

    while I convert it as follows:

    constexpr double REF_VOLTAGE_IN_VOLTS = 0.825; // Maximum Internal Reference Voltage
    constexpr double VOLTAGE_DIVIDER_IN_VOLTS = 0.2; //Internal voltage divider
    constexpr double ADC_RESOLUTION_12BIT = 4095;
    #define RESULT_IN_VOLTS(ADC_VALUE) (ADC_VALUE*REF_VOLTAGE_IN_VOLTS)/(VOLTAGE_DIVIDER_IN_VOLTS*ADC_RESOLUTION_12BIT)

    The measurement from my voltage divider is feeded to AIN7 but it measures 0.9V on the battery while my input is 5.2V and 0.7V when my input 4.5V. Can you suggest what am doing wrong in here

Related