There exist many coulomb-counter chips which measure the integrated current going into or out of a battery for purposes of estimating the charge state. Are there any good chips for easy circuits for the purpose of measuring how much charge is used by a particular operation which may take 1-500ms? None of the charge-counting chips I've looked at offer good resolution on short time scales. A typical chip, for example, would output roughly two counts per second at maximum input current; if an operation requires e.g. 100mA for 10ms, and 25mA for 90ms, a coulomb-counter which would output two counts per second at maximum current (100mA) would offer one count per 50mC. The operation described would consume 3.25mC, so the counter would only yield one count every 15 operations.
One approach I was considering would be to use a discontinuous-mode switching power supply, operating from a regulated input voltage, and count the number of switcher pulses. That should yield a high-resolution count; if the switching power supply always used the same amount of current in each pulse, and if the current always fell to zero between pulses, the number of pulses should be directly proportional to the total integrated current. Unfortunately, that's not the most efficient way to operate a switcher, and most switchers attempt to operate more efficiently than that.
Supposing the supply voltage will be either 3 or 6 volts, the maximum current is 250mA, and the goal is to have a minimum of 50% efficiency and 3mW quiescent dissipation, what would be the best approach?
Addendum
Although I'd like to have a general-purpose measurement approach, the particular application I have in mind is determining what factors affect the energy consumption of various "intelligent" RF modules which will be used outdoors. For example, if the modules normally consume one mAs every 15 seconds to maintain a mesh, but during a rainstorm some of the modules will occasionally start consuming 10maS every second for a couple minutes, that sort of thing would be useful to know. If for some reason the idle current which normally sits at 25uA sometimes goes up to 40uA, I'd like to know that too.
A lot of charge integrating devices work by measuring instantaneous current and integrating the measured values. My concern with that is that the instantaneous current will have a rather large dynamic range (I'd like to if possible be accurate to 10uA in low-current situations, but be able to capture events up to 250mA), and taking readings with that level of prevision fast enough to ensure that even short events get integrated accurately would seem a bit tricky.
One solution I'm thinking of would be to use a PIC with a built-in or external analog comparator, running off a regulated 3.30 volts; whenever the output is below 3.10 volts, switch on a PFET with a series resistor adjusted to pass 0.50A with a 0.20 volt drop. If there is a sufficient cap on the output, the PIC should be able to sleep whenever there is adequate voltage on the output; when the voltage falls below 3.10 volts, the PIC could wake up, feed pulses to the PFET until the voltage gets back above 3.10 volts, and, if charging didn't take too many pulses, "go back to bed".
I would expect that measurement scale accuracy should be affected by the accuracy of the PIC's clock, the effective combined resistance of the PFET and series resistor, and the comparison of the output voltage to 3.10 volts, regulation of the 3.30 volt input. Measurement offset accuracy would be purely a function of leakage.
If the goal is to have an overall accuracy of 10%, the PIC would generally have to keep its output within 0.02V of the target. Faced with a 250mA load, a 1000uF cap would drop 0.250V/ms. Keeping the voltage drop below 0.02 volts would require having the PIC wake up within 80us, which I think is probably doable with the RC-oscillator-based PICs.