Searching \ for '[EE] Measuring Average current' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/power.htm?key=current
Search entire site for: 'Measuring Average current'.

Exact match. Not showing close matches.
'[EE] Measuring Average current'
2004\10\07@032134 by

Good morning folks,

What is the correct way to measure average current use of a PIC ?. My
DVM won't respond fast enough to display anything meaningful and my
old analog meter has'nt got a low enough range.

thanks, Mike W
_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

> What is the correct way to measure average current use of a PIC ?

Stick a big reservoir cap in and measure current from it through a
resistor in the supply line ? (note leakage of cap but it shouldn't be
that much)

_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

> What is the correct way to measure average current use of a PIC ?. My
> DVM won't respond fast enough to display anything meaningful and my
> old analog meter has'nt got a low enough range.

Try (all variants of the same theme)

1.    Place a largish electrolytic at the input to the regulator. (1000 uF+)
Measure current flow into the regulator/capacitor combination. This will
include the quiescent current of the regulator
(If you want good accuracy you could 'calibrate" the regulator quiescent
current by driving a variable load and measuring input and output currents.
This will usually be beyond what is needed)

2.    Break the 5v feed at the output of the regulator.
Provide a cap at regulator output suitable to provide regulator stability.
Connect a largish electrolytic (say 1000 uF) on the 5v rail.
Connect ammeter between regulator output and large cap.
This measures average current draw.

3.    If it is only the actual PIC current you wish to measure do as per 2
but break the 5v feed to the PIC and insert the ammeter there with a large
cap on the PIC side.

2 & 3 drop some voltage across the ammeter which may cause problems in some
cases.

All these work by providing a large reservoir capacitor for the PIC or other
downstream device to draw current from so that the meter "sees" only the
average current and largely not the current peaks.

RM

_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

Just a crazy idea: put a capacitor in parallel with the DVM.

Bob Ammerman
RAm Systems

----- Original Message -----
From: "Mike W" <mikecorn2.freeserve.co.uk>
To: <piclistmit.edu>
Sent: Thursday, October 07, 2004 3:19 AM
Subject: [EE] Measuring Average current

{Quote hidden}

_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

At 08:19 AM 10/7/2004 -0400, you wrote:
>Just a crazy idea: put a capacitor in parallel with the DVM.
>
>Bob Ammerman
>RAm Systems

Or, better in some cases, pick a resistor that you believe will
drop a tolerable amount of voltage at the average current. For example,
if you believe the average current is 150uA, you might pick 1K 1%
which will drop 150mV at that current. Then put a capacitor across
it to smooth the reading at the repetition rate of whatever
pulses etc. are being drawn from the supply. Maybe you pick a time
constant of 1 second, so 1000uF electrolytic. This is a single pole
LPF. You use the meter in voltage mode, of course. In stubborn cases, you may
wish to add a second pole, say a 100K resistor and 10uF tantalum. That
won't affect the reading with a >10M input Z, the average current is still
1mV/uA within a couple of percent.

If the voltage turns out to be too large or small - so it drops too much
voltage to the circuit, or the voltage is too small to measure easily,
then just change it (and the capacitors)

Note that if current is drawn in short pulses you have to make sure
that the instantaneous decrease in the voltage is not too high or the
reading may be inaccurate or the circuit may malfunction. A 'scope is
useful in this regard. You can also calculate it to bracket the problem.

Eg. Supply the 150uA is essentially all composed of pulses: 150mA for
200usec with a 200msec period. A 100uF capacitor would see a voltage
change at the terminals of delta-V = I * Ton/C = 300mV, which is
a bit high. The 1000uF would yield a more reasonable 30mV, so the
troughs would be 180mV down from nominal, not 450mV down. The
30mV/300mV p-p of ripple will yield jumpy readings as the 5Hz frequency
"beats" with the measurement cycle of the meter. This is where the
second pole filter comes in handy.

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speffinterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com

_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

What exactly do you mean by "average"?

For example, if I'm doing something where a ballpark is needed and the
PIC is asleep 99% of the time, I simply re-write my code so the PIC
never wakes up after the first time it falls asleep, then measure the
current.  Unless it does something SERIOUSLY power hungry, that
sleeping current will tend to dominate your power consumption, and the
waking current can be ignored.  Or, if you want to take the waking
current into account, re-write your code again so the PIC never goes to
sleep, then measure its running current.  Percent of time PIC sleeps
times sleeping current plus percent of time PIC runs times running
current gives you the "average current".

Or if you're looking for the average current when the PIC is running,
but knowing that it varies whether the PIC is switching a motor on
or blinking an LED or toggling the wax spray on your electric dog
polisher, you'd like an average through all of those activities, that
becomes more complicated.  If your PIC is doing something which
involves responding to the outside world, you need to consider the
likelihood of events occuring, how long the response will last, and
how much current each response requires.

There are other possibilities, too.

So again I ask, what do you mean by "average"?

Mike H.

On Thu, 07 Oct 2004 08:19:56 +0100, Mike W <obf> wrote:
> Good morning folks,
>
> What is the correct way to measure average current use of a PIC ?. My
> DVM won't respond fast enough to display anything meaningful and my
> old analog meter has'nt got a low enough range.
>
> thanks, Mike W
_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

> you might pick 1K 1% which will drop 150mV at that current. Then put a
> capacitor across it to smooth the reading at the repetition rate of
> whatever pulses etc. are being drawn from the supply. Maybe you pick a
> time constant of 1 second, so 1000uF electrolytic. This is a single pole
> LPF. You use the meter in voltage mode, of course. In stubborn cases,
> you may wish to add a second pole, say a 100K resistor and 10uF
> tantalum.

I don't understand what you mean by "second pole" here. If I understand
this correctly, you first have a 1k resistor and a 1mF capacitor in
parallel, both in series to a load with a much higher impedance -- a single
pole LPF. Then you add in parallel to the 1k/1mF filter a 100k resistor and
a 10uF capacitor to create a "second pole". Wouldn't that still be a single
pole LPF, with the same time constant of 1s (resistor of 990R and capacitor
of 1010uF)?

Of course the real-world frequency characteristics would be different, due
to the different type of capacitor, but the way I understand it, that
doesn't actually create a second pole, it just changes the way the filter
diverts from an ideal single pole filter.

Or am I missing something here? It would be cool to be able to create
filter poles just like that... :)

> Eg. Supply the 150uA is essentially all composed of pulses: 150mA for
> 200usec with a 200msec period. A 100uF capacitor would see a voltage
> change at the terminals of delta-V = I * Ton/C = 300mV, which is
> a bit high. The 1000uF would yield a more reasonable 30mV, so the
> troughs would be 180mV down from nominal, not 450mV down. The
> 30mV/300mV p-p of ripple will yield jumpy readings as the 5Hz frequency
> "beats" with the measurement cycle of the meter. This is where the
> second pole filter comes in handy.

Can you please explain what the 10uF cap would do here? It seems to me that
if the 1000u cap isn't able to supply the required current, the 10u cap
won't help much either, in terms of reducing 5Hz ripple.

Thanks,
Gerhard
_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

{Quote hidden}

|----R=100k-.----> Vout
----                    |
R  |                    |
R C                  C=10uF
R  |                    |
----                    |
|----------------.----->
|

He probably means that the 100k and 10 uF are in series with each other,
with each end of this series string going to either end of the original 1k
resistor. The meter is then connected across the 10 uF cap. The meter would
meed to have a resistance >> 100k or have its resistance allowed for.

> Or am I missing something here? It would be cool to be able to create
> filter poles just like that... :)

You can create multiple poles by cascading RC sections but you cannot get a
Q of more than 0.5 so the functions which can be implemented are limited.

However, you can ALMOST get as good by using an emitter follower (unity gain
stage) to provide 2 poles per transistor. This needs a power supply but is a
very low cost way of implementing quite real filters. The design has to
accomodate this particular configuration. You can cascade pairs of poles
this way to get 2, 4 or 6 pole filters. Arguably even more, but in practice
you are liable to be pushing your luck even at 6 poles. For precision work
you probably want another design but the emitter follower (ie unity gain)
filters are excellent for adding say 4 poles of low pass to a design that is
space or cost constrained. (2 transistors, 4R, 4C = 4 low pass poles)

> Can you please explain what the 10uF cap would do here? It seems to me
> that
> if the 1000u cap isn't able to supply the required current, the 10u cap
> won't help much either, in terms of reducing 5Hz ripple.

Note above that the second filter is across the capacitor of the first
filter but that its components are in series with each other.

The first RC (1k, 1000 uF) has a time constant of 1s.

The second has a tc of 1s as well. The second loads  the first only lightly
as it has a much higher impedance so it is effectively filtering the already
filtered signal. The result can be an improvement even if it doesn't closely
resemble any of the maximal standard filters.

Russell McMahon

_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

At 02:15 AM 09/10/2004 +1300, you wrote:
>
>   |
>   |----R=100k-.----> Vout
>----                    |
>R  |                    |
>R C                  C=10uF
>R  |                    |
>----                    |
>  |----------------.----->
>  |
>

Would'nt this be more effective?

PSU
|
(A) mmeter
|
|___Ra_____Rb__________Regulater__
|       |                 |
|       |                 |
---     ---             PIC CCT
---     ---                |
| C1    | C2              |
|       |                 |
--------------------------
node1     node2

RaC1 and RbC2 approx 1s each

Regards
Roland

{Quote hidden}

Regards
Roland Jollivet

_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

At 02:15 AM 10/9/2004 +1300, you wrote:
{Quote hidden}

<rest of lucid explanation snipped>

Yes, that's correct.

As to why you'd want to know 'average' current- well, for a suitably bypassed
battery source it will help predict the life of the battery. If the circuit
is being fed by a linear regulator from a fixed source voltage, it will
allow you to calculate the power dissipation in the regulator. It will allow
you to calculate the power dissipation in the circuit if the supply voltage
is fixed. You want average, not "RMS" (or whatever) in these cases, because
the voltage is fixed. This applies to applications that have a spikey periodic
current draw with a relatively short total period (maybe 100msec or less),
from which we infer the current draw averaged over a very long period of time.

Re-writing the code to put the device in various states and measuring the
steady-state current in those states, then doing a weighted sum of the
numbers is a possible method, but obviously it introduces new possibilities
for errors. It's probably the only practical way to handle situations where
the
device may wake up infrequently and spends most of its time sleeping. If the
periods vary with external stimuli, then both measurements and calculations may
be required to confirm that the consumption is not out of whack with the
design.

Naturally, this kind of thing is not a substitution for doing a proper
design analysis. It should be used to confirm the design numbers and to
ensure that there is nothing wrong with the firmware or hardware design or
implementation.

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speffinterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com

_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

>>   |
>>   |----R=100k-.----> Vout
>>----                    |
>>R  |                    |
>>R C                  C=10uF
>>R  |                    |
>>----                    |
>>  |----------------.----->
>>  |

(Thanks, Russell, for another "duh" experience :)

{Quote hidden}

I guess it depends on what you define as "effective". In order to keep the
voltage drop low across Ra and Rb, they both have to be "small", and thus
both caps C1 and C2 have to be big. For the same voltage drop as the
circuit above, you end up with much bigger capacitors. Take Spehro's
original example with a 150mV drop at 150uA. In the circuit above, this
gives one cap with 1mF and another one with 10uF. In this circuit, this
would require two caps with 2mF (with two 500R resistors), or one even
bigger but the other not below 1mF. OTOH, that's not very important for a
one-off test circuit.

Could you please elaborate a bit on what you mean with "more effective"?

Thanks,
Gerhard
_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

At 10:04 AM 09/10/2004 -0300, you wrote:
{Quote hidden}

Well, since the OP wanted to measure current, I'd use an ammeter for starters.
There's no need to minimise the drop across the resistors if put before the
PSU. The resistors dissapate power, but don't affect the current drawn.
Say the worst case current draw is 10mA. Set the PSU to around 20V, and use
500R and 500R and 2000uF and 2000uF.
Measure current with no PIC CCT for regulator Quiescent, then measure actual.
OK, the regulater input will be subject to input transient response because
of the resistors, and Iq may be a bit non-linear as Vpsu changes, but I'm
sure it'll be small.
Open to correction of course:-)

Error, error. Sorry, when I looked at Russels diagram, I thought the bottom
rail was ground!
post partially retracted.

Regards
Roland Jollivet

_______________________________________________
http://www.piclist.com
http://mailman.mit.edu/mailman/listinfo/piclist

At 08:13 PM 10/9/2004 +0000, you wrote:

>Well, since the OP wanted to measure current, I'd use an ammeter for starters.

No, that's not a very good idea at all. It makes filtering (the "average"
bit) MUCH harder in many circumstances. If you'd ever tried it with a circuit
that has a spikey current draw, you'd have seen the problem.

>There's no need to minimise the drop across the resistors if put before the
>PSU. The resistors dissapate power, but don't affect the current drawn.
>Say the worst case current draw is 10mA. Set the PSU to around 20V, and use
>500R and 500R and 2000uF and 2000uF.
>Measure current with no PIC CCT for regulator Quiescent, then measure actual.

Yes, that's a possibility, but it doesn't really gain much, and adds
complexity and possible additional errors from several sources.

>OK, the regulater input will be subject to input transient response because
>of the resistors, and Iq may be a bit non-linear as Vpsu changes, but I'm
>sure it'll be small.
>Open to correction of course:-)

Some LDO bipolar regulators draw an awful lot of Iq and it varies with
the output current (as much as ~10% of the output current). Some draw a
LOT more when the input voltage is near the output voltage.

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speffinterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com

_______________________________________________
http://www.piclist.com