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.