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

saadc input voltage range

Hello.

I have a issue about saadc input range.

First, using 52832, SDK 15.3.0 S332 Softdevice.

I using ble ant both and 2 rtc time and gpiote also used.

my goal is measureing coin cell voltage.

coin cell is CR2032.

I success getting data. however max voltage is under 3.2V.

I use usb power. 

under below is my Configure Setting.

static void Config_value_init()
{
  memset(&saadc_config, 0 , sizeof(saadc_config));
  saadc_config.resolution         = (nrf_saadc_resolution_t)NRFX_SAADC_CONFIG_RESOLUTION; // 10bit
  saadc_config.oversample         = (nrf_saadc_oversample_t)NRFX_SAADC_CONFIG_OVERSAMPLE; // disable
  saadc_config.interrupt_priority = NRFX_SAADC_CONFIG_IRQ_PRIORITY;
  saadc_config.low_power_mode     = NRFX_SAADC_CONFIG_LP_MODE;

  memset(&channel_config, 0 , sizeof(channel_config));
  channel_config.resistor_p   = NRF_SAADC_RESISTOR_DISABLED;
  channel_config.resistor_n   = NRF_SAADC_RESISTOR_DISABLED;
  channel_config.gain         = NRF_SAADC_GAIN1_6;
  channel_config.reference    = NRF_SAADC_REFERENCE_INTERNAL;
  channel_config.acq_time     = NRF_SAADC_ACQTIME_40US;
  channel_config.mode         = NRF_SAADC_MODE_SINGLE_ENDED;
  channel_config.burst        = NRF_SAADC_BURST_DISABLED;
  channel_config.pin_p        = (nrf_saadc_input_t)(NRF_SAADC_INPUT_AIN5);
  channel_config.pin_n        = NRF_SAADC_INPUT_DISABLED;
}

under below is handler func.

static void user_battery_saadc_handler(nrf_drv_saadc_evt_t const * p_event)
{
   nrf_saadc_value_t *value =  p_event->data.done.p_buffer; // nrf_saadc_value_t = uint16_t
   
   switch(p_event->type)
   {    
     case NRF_DRV_SAADC_EVT_CALIBRATEDONE : 
       NRF_LOG_INFO("SAADC Calibration Done");
       CaliState = false;
       break;
     case NRF_DRV_SAADC_EVT_DONE : 
            
       Calculate_Voltage(value, &voltage);
       NRF_LOG_INFO("DATA = %d BUFFER SIZE = %d Voltage : %f"NRF_LOG_FLOAT_MARKER, *value, p_event->data.done.size, NRF_LOG_FLOAT(voltage) ); 
       Set_battery_Voltage_Ble_Ant();
       break;
     case NRF_DRV_SAADC_EVT_LIMIT : 
       break;
     default:
       break;
   }
}

using internal reference 0.6V and gain is 1/6. So I thought max voltage is 3.6V

But I Can't measure 3.2~3.6V.

I Changed ACQTIME . it was not work.

First screenshot is 3.1V. it works well.

Second screenshot is 3.3V. but the data is more lower.

 

Thank you.

Parents
  • What is the signal source, the CR2032? If so the voltage will probably not be over 3.2V during operation. 

    I suggest you get a proper voltage reference above 3.2V and see for yourself. I also suggest you scope the voltage of the CR2032 with an oscilloscope when you're sampling it with the SAADC, you should see fairly large voltage fluctuations. This is due to the CR2032's inability to source a >1mA current without large drops in the supplied voltage. 

Reply
  • What is the signal source, the CR2032? If so the voltage will probably not be over 3.2V during operation. 

    I suggest you get a proper voltage reference above 3.2V and see for yourself. I also suggest you scope the voltage of the CR2032 with an oscilloscope when you're sampling it with the SAADC, you should see fairly large voltage fluctuations. This is due to the CR2032's inability to source a >1mA current without large drops in the supplied voltage. 

Children
Related