Measuring average current consumption in hardware

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.

simulate this circuit – Schematic created using CircuitLab

• Do you want to measure the average current consumption of the system, or do you want the system to monitor its own current consumption in real-time? Sep 12, 2016 at 13:05
• @Dampmaskin I would like the system to be able to monitor its own current consumption. It would be part of each device made. Sep 12, 2016 at 13:27
• The problem in your circuit is the Rsense. At 100mOhm, with a 2µA current, you'll get 0.2µV. Way below the capabilities of the opamp (see its offset voltage spec: ~5mV typ). But if you use a bigger resistor, which would bring it to a more reasonable range, then you'll get a huge voltage drop when the MCU consumes 10mA. There are opamps which are more accurate, but you won't likely reach the dynamic range you need with such a topology (see electronics.stackexchange.com/questions/255646/…)
– dim
Sep 12, 2016 at 13:28
• Your proposed idea is workable, but the circuit won't: common-mode range of TL081 doesn't include ground. But it could work flipped so that Rsense is on the high-side of the system. You'll have to carefully compensate out offset voltages of the op-amp, or use a near-zero offset voltage op-amp. Sep 12, 2016 at 13:46
• Obviously, most operational amplifiers draws much more than 15 µA, so you better do your research here and get the one with the lowest quiescent current you can find.
– pipe
Sep 12, 2016 at 13:50

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.

• This is supposed to be a run-time measurement, but it may prove to be impractical, in which case this design time test (actually, more like manufacturing test) will prove useful as well. Sep 12, 2016 at 13:31

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.

Turn this on it's head - measure the battery terminal voltage when the micro is running and taking the 10 mA load - over time this voltage will droop as the battery becomes more discharged and there will be a point when it is feasible to predict premature failure of the system.

So, when you are taking maximum current, activate (enable via a GPIO line for instance) a low power comparator and half-decent voltage reference and use the comparator to generate a 1 or a 0 based on the terminal voltage of the battery. Once measured, disable that part of the circuit from drawing any more current and adding to the problem.

You don't need to activate this circuit that often either - once a day would be fine but you can decide that.