Electronic – Measuring average current consumption in hardware

current-sensinglow-powermicrocontroller

I'm working on a very low power budget, battery powered project. This project is allowed to draw 15uA (average) at 3v. The microcontroller we're using draws 4-10mA when active, and 2-3uA when asleep. The micro spends the vast majority of its time asleep.

I'd like to have an on-board way to measure the average current consumption of the entire system for the past 5-10 seconds. The problem is running the micro to read a shunt resistor requires, well, running the micro. This device is intended to run for years off of a battery, and we'd like to be able to detect premature failures based on current consumption.

My basic idea is to take the typical current sense circuitry and throw a big capacitor across the output of the opamp. The ADC input to the micro is high impedance (10s of megohms).

Is this something that could work? I would be looking for +/- 2uA accuracy. Ignore the actual component values. I'm trying to figure out a general approach first.

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

If this is a 'design time' measurement to prove the system or its scheduling on the bench, then you could use a technique that I have often used in the past.

Take a large electrolytic capacitor, and I mean 10,000uF or suchlike, and use that to power the microcontroller. Record its change of voltage second by second, which multiplied by the caapcitance will give you the integrated charge that the controller has used.

Obviously every so often you will need to charge it by connecting a power supply, to keep its voltage within the acceptable range for the micro.

There are two calibrations to make, both fairly easy.

One is what the leakage current of the capacitor is, record the voltage over time with no load on it. You might want to buffer your meter with a low bias op amp like TL081. The leakage may change over time, but with a high quality capacitor, especially if reformed at a voltage well above 3v (obviously within the rated voltage of the capacitor) it should be adequately small and stable.

The second is the actual value of the capacitance, electrolytics are notorious for wide tolerances like -20/+80%. Having established the leakage current, add a further load of a resistor, and plot the rate of voltage fall. The resistor and voltage will give you a current, over time will give you a charge, and charge per change of voltage gives you the capacitance.