# How do I average a complex waveform?

I am trying to figure out how long my project will last on a single battery. It's powered by a single AA battery with an NCP1402 3.3 volt boost converter. I've determined that the target circuit draws around 75 µA at rest and around 250 µA for 35 ms per second. I could just run that number, assume the boost converter is 80% efficient and go with the result (which is around 2 years or so), but I would like, if possible, to validate that experimentally.

I have a µCurrent Gold, and hooked it up to my Rigol DS1052 scope to get the numbers above (with a bench 3.3 volt supply and the circuit on a breadboard). But when I repeat the experiment with the boost converter, what I see is a complex waveform with peaks at around 1 mA which decays down to 0. Not only that, but it's quite irregular. I can't make any sense out of it.

I've discovered my scope does have an averaging function, but it doesn't help - it can't gather enough samples into the average to make a difference.

My big concern is that the boost converter efficiency may be way, way lower than 80% at such a low draw, but I can't really verify that.

I did try just using a multimeter (still with the µCurrent Gold), and I get an answer of 450 µA. That would last around 9 months - still acceptable, but is it correct?

• Could you post the scope shots? – Ricardo Aug 21 '14 at 13:20
• That isn't what the "averaging mode" of your oscilloscope is for. It's meant to average multiple waveform traces together to get a clearer picture, not to find the mean value of a single waveform. – Dave Tweed Aug 21 '14 at 13:20

A method I've used for this kind of measurement is actually one of the simplest. Put a known value capacitor in parallel with the supply and wait until the capacitor is fully charged to the known voltage $V_1$. Then remove the supply. After some amount of time, measure the remaining voltage $V_2$on the capacitor (this assumes that your circuit is capable of running on a range of voltages). Because the energy $E=\frac{1}{2}C(V_1-V_2)$, you can easily determine how much energy was actually used. If you use the value of the capacitor in microfarads, and voltage in volts, the energy unit is microJoules. For best results, the value of the capacitor should be measured -- don't just use the nominal value.

• I like it, (energy is 1/2 CV^2.) But forget the energy the charge lost Q = C(V1-V2) and current is Q/time it was on for. – George Herold Aug 21 '14 at 14:06

I think what you want to do is get two different types of data: your boost converter efficiency is one and the power consumption of the circuit is the other. I got the impression your circuit works in short bursts so you want to measure during that period.

To measure the efficiency of the boost converter you need to measure the input voltage and current and output voltage and current. It would be a good idea to chart them for a single period. Multiply input IV and output IV to get power in Watts and the ratio between the output and input is the efficiency. You should do this with a few batteries that are drained to different levels and see how the efficiency changes with dying batteries and perhaps take that into account as well.

If you want to measure the whole device's power consumption you simply use the data from the previously described measurement (the input IV).

Of course the graphs will give you an "instant power" indication at each single point of data capture, however you could easily sum these up and divide by the number of data points to get an average value during the measurement period.

I usually use Excel to handle a task like this. Most chances you can capture data on your scope and output it as a .csv file or something similar easy to handle in Excel.

Remember that the scope channels might need scaling in Excel, otherwise you might see some strange figures.

How do I average a complex (load current) waveform?

I have used the following system without too much attempted precision but with good success to measure the mean current of a semi-random system with significant short term peaks.

Use two large capacitors with a low value resistor (Ri) between them.
Feed power supply to first capacitor (C1) and take power feed to circuit from second capacitor (C2). The second cap is the more critical - its job is to provide enough current source to allow a smooth flow from the supply despite load changes.

Variations in power-supply current draw will be supplied by C2.
If C2 is large then delta Vs will be very small. Once the system settles down C1 will be at slightly higher voltage than C2 and Imean = V/R = (V_C1 - V_C2) / Ri.

Select Ri so voltage drop is acceptably small relative to supply voltage while being as large as possible in order to increase measurement accuracy.

If desired this arrangement can be on the input side of an LDO regulator, allowing Vout to be more stable BUT then regulator Iq at Imean needs to be factored in.

To get low delta_V_cap you may need a very large cap which will have leakage current. This can be measured by letting the system stabilise at no load and as long as temperature and Vcap do not vary much effects should be minimal.

• Oh, I like this better than the single cap! – George Herold Aug 21 '14 at 14:54

I actually discovered that my scope has a measurement function that can average the entire displayed portion of the waveform, which is separate from the averaging function in the acquisition menu. This is adequate for my purposes.

Meanwhile, I believe my earlier measurements of the circuit without the boost converter were in error. The actual values are 250 µA during idle and 1.25 mA active for 30 mS. Those values make a lot more sense to me, frankly, and the average being drawn from the boost converter is ~600 µA at idle, which also lines up well with reality.