nA - uA switching in autoranging

Started by alexsh1, January 10, 2021, 02:31:38 PM

alexsh1

Hi Felix,

The question is about autoranging.

I have been testing Moteino Mega R2 Lora current consumption through the CurrentRanger R3 and noticed the following.
Whenever I used a bench power supply and the sensor was sleeping, the CurrentRanger was madly switching between nA and uA.
The 3.2V LiFePO4 battery power is giving a stable 3.6uA sleep current (in uA mode). Now what I did change in the firmware is this:

#define ADC_PRESCALER          ADC_CTRLB_PRESCALER_DIV64

and

else if (ADC_SAMPLING_SPEED==ADC_SAMPLING_SPEED_SLOW)
    ADC_AVGCTRL = ADC_AVGCTRL_SAMPLENUM_1024 | ADC_AVGCTRL_ADJRES(0x4ul);


I suppose the issue with certified bench power supply is CurrentRanger sensitivity?
How do I make sure this is not going to happen in the future measuring current with the CurrentRanger putting a limit between nA and uA switching? Any ideas how to stop oscillating? the Power Supply noise is very negligible.

Felix

I suppose this could be many different things. One thing is obvious, that a floating battery behaves differently than a bench supply. I would watch for any ground looping or any other connections to the CR when the supply is powering your DUT. Noise is certainly a possibility and don't forget the CR amplified everything by 100x including noise picked up by leads and other sources (PSU?).

The switching happens when the ADC sample measures above/below these thresholds:
#define RANGE_SWITCH_THRESHOLD_HIGH ADC_OVERLOAD //ADC's 12bit value
#define RANGE_SWITCH_THRESHOLD_LOW  6 //6*0.4xA ~ 2.4xA - range down below this value
#define ADC_OVERLOAD           3900  //assuming GNDISO DAC output is very close to 0, this is max value less ground offset (varies from unit to unit, 3900 is a safe value)


I would start there instead of slowing down the ADC, which is what you attempted. Slowing it down ADC sampling is OK if you can afford the potential increased delay in switching and the DUT will not brownout after wakeup (in a lower CR range).