Exact match. Not showing close matches.
PICList
Thread
'[PIC] Excessive 12F629 current usage'
2005\08\23@224722
by
Matthew Miller
|
part 1 1604 bytes content-type:text/plain; charset=us-asciiHi everyone,
A while back I started a thread asking about a replacement for the LM3909
led flasher. In the discussion someone suggested using a PIC; not a surprise
considering the forum. I'm now trying to do just that using a 12F629 and a
3V lithium battery for power.
I successfully got a LED flashing, no surprises there. My measurement for
the current consumption was a surprise. The different values I got all were
around 280uA. That means the circuit will only run for about a third of a
year, which is much shorter than I'm aiming for.
The circuit uses an external RC oscillator configuration, and I thought this
would reduce current consumption since the instruction clock is
4.5kHz. Well, I tried a new setup: the PIC after initializing everything
just sat in an infinite loop with no outputs being driven. I was surprised
again as the lowest reading was 265uA!
Looking at the datasheet, it says that the operating current is 9uA typical
at 32kHz at 2V. I've turned off the comparators, the WDT isn't running. Why
am I seeing such un-typical current draws? I know that the datasheets
sometimes lie, but right now I'm very frustrated this. Even different chips
showed similar current usage.
I've attached my (very short) source code. The circuit is so simple, it is
only the PIC, RC oscillator, decoupling cap. and 3V battery. Any input is
welcome!
Thanks. Matthew
P.S. I just ran a test where after initialization the device goes into sleep
and is never woken up. Current draw: 120uA :(
--
"If God had intended us to drink beer, He would have given us
stomachs." - David Daye
part 2 1470 bytes content-type:text/plain; charset=us-ascii
; Using an external RC oscillator with R=68k and C=0.001uF the
; Fosc value is about 4.5kHz using a 3V supply.
;
; The LED anode is tied positive and cathode is tied to GP5
; through a 470 Ohm resistor. GP3 is tied to ground.
processor 12f629
include <p12f629.inc>
__config _MCLRE_OFF & _WDT_OFF & _BODEN_ON & _EXTRC_OSC_NOCLKOUT & _PWRTE_ON
#define ONE_SEC .22
#define ONE_MSEC .2
cblock 0x20
pJ, pK ; Used by the pdelay routine.
shadow ; Byte used to shadow GPIO.
endc
org 0
clrf shadow
call device_init
goto main_loop
org 0x0F
main_loop
goto main_loop
device_init
; Turn the comparator off.
banksel CMCON
movlw B'00000111'
movwf CMCON
banksel TRISIO
movlw B'00001000'
movwf TRISIO
return
; A parameterized delay
;
; To determine the necessary start value (the value in W) to load use this
; formula: delay*Hz/4 = 3+5*p+9*p^2 p is the parameter in W.
; Where delay is the required delay length in seconds, and Hz is the clock frequency.
;
; RAM variables used: pK, pJ.
;
pdelay
movwf pJ ; pJ = W
pjloop movwf pK ; pK = W
pkloop decfsz pK, f ; k = k-1
goto nothing
goto jbottom
nothing nop
nop
goto pkloop
jbottom decfsz pJ, f ; j = j-1
goto pjloop
return
end
part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)
2005\08\24@000147
by
Jinx
You could add
clrf ansel ;digital inputs
movlw b'10000000'
; 1 pullups off
movwf option_reg
and & _BODEN_OFF to CONFIG
2005\08\24@000641
by
Richard Prosser
|
Try turning the brown out detector off. These can increase current somewhat.
RP
On 24/08/05, Matthew Miller <spam_OUTnamiller2TakeThisOuT
naxs.net> wrote:
{Quote hidden}> Hi everyone,
>
> A while back I started a thread asking about a replacement for the LM3909
> led flasher. In the discussion someone suggested using a PIC; not a surprise
> considering the forum. I'm now trying to do just that using a 12F629 and a
> 3V lithium battery for power.
>
> I successfully got a LED flashing, no surprises there. My measurement for
> the current consumption was a surprise. The different values I got all were
> around 280uA. That means the circuit will only run for about a third of a
> year, which is much shorter than I'm aiming for.
>
> The circuit uses an external RC oscillator configuration, and I thought this
> would reduce current consumption since the instruction clock is
> 4.5kHz. Well, I tried a new setup: the PIC after initializing everything
> just sat in an infinite loop with no outputs being driven. I was surprised
> again as the lowest reading was 265uA!
>
> Looking at the datasheet, it says that the operating current is 9uA typical
> at 32kHz at 2V. I've turned off the comparators, the WDT isn't running. Why
> am I seeing such un-typical current draws? I know that the datasheets
> sometimes lie, but right now I'm very frustrated this. Even different chips
> showed similar current usage.
>
> I've attached my (very short) source code. The circuit is so simple, it is
> only the PIC, RC oscillator, decoupling cap. and 3V battery. Any input is
> welcome!
>
> Thanks. Matthew
>
> P.S. I just ran a test where after initialization the device goes into sleep
> and is never woken up. Current draw: 120uA :(
>
> --
> "If God had intended us to drink beer, He would have given us
> stomachs." - David Daye
>
>
> -
2005\08\24@002008
by
Spehro Pefhany
At 10:47 PM 8/23/2005 -0400, you wrote:
>The circuit uses an external RC oscillator configuration, and I thought this
>would reduce current consumption since the instruction clock is
>4.5kHz.
What component values are you using for the external RC? Hopefully
not something like 10K and a huge capacitor..
Best regards,
Spehro Pefhany --"it's the network..." "The Journey is the reward"
.....speffKILLspam
@spam@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
->> Inexpensive test equipment & parts http://search.ebay.com/_W0QQsassZspeff
2005\08\24@060654
by
Michael Tandy
|
Hi there Matthew,
> I've attached my (very short) source code. The circuit is so simple, it is
> only the PIC, RC oscillator, decoupling cap. and 3V battery.
I've got to weigh in with Sphero on this one; I suggest checking your RC
oscillator, if only because it's the only thing you have other than
the PIC!
There's quite a few complex calculations you can do in this area, but
for our purposes we can simplify a lot.
1) The RC oscillator can't take more current than it can get through the
resistor. This is given by Ohm's law:
I = V/R
(where I is current in amps, V is supply voltage in V and R is
resistance in Ohms)
2) The frequency of your oscillator depends on R and C, i.e.
f = k * 1/(C*R)
(where f is frequency, k is some constant (doesn't matter what, as we'll
see in a second), C is your capacitor's value in farads and R is your
resistor's value in ohms)
What this means is you can change R to pretty much anything, as long as
you change C in the opposite way.
For example, you can make R 10 times larger and C 10 times smaller and
you should end up with the same frequency. However, if R is 10 times
larger, your RC circuit should draw 1/10th the current, due to Ohm's law.
Anyway, the point of all this is: I suggest you make the resistor 10
times larger and the capacitor 10 times smaller and see what happens.
With luck, it'll cut the power consumption right down.
Cheers,
Michael
2005\08\24@072842
by
olin piclist
Matthew Miller wrote:
> My measurement
> for the current consumption was a surprise. The different values I got
> all were around 280uA.
Are you really sure it's running from the external RC oscillator, not the
internal one? Also show the whole schematic, don't just wave your hands
around describing it. Think about every possible current path. Remember
that all I/O pins are potential current paths, both for source and sink.
Are the internal pullups enabled? Are any digital inputs being held at a
mid range voltage?
How fast does the LED need to blink or the circuit respond to an external
event? My knee jerk reaction is that an external RC oscillator to run the
instruction clock is not the best answer. I would try to keep the PIC in
sleep for as much of the time as possible. One way is to use the watchdog
to wake up the PIC periodically. On older PICs, the watchdog was a bit of a
pig itself. This has gotten better on some newer PICs but I don't remember
if the 12F629 is one of them. I had a problem like this on a 16F630 which
has the old watchdog timer, and ended up using an external micropower wakeup
timer but running the PIC off its own internal oscillator when woken up.
The external wakeup timer draws something like 300nA average worst case.
Some new PICs have a similar circuit built in, but I know the 12F629 is not
one of them.
*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com
2005\08\24@075526
by
Jinx
> sleep for as much of the time as possible. One way is to use the
> watchdog to wake up the PIC periodically. On older PICs, the
> watchdog was a bit of a pig itself. This has gotten better on some
> newer PICs but I don't remember if the 12F629 is one of them
It's not bad - 1.8uA at 3V. ExtRC is quoted at 450uA / 3V /
4MHz. I thought there was a uA vs frequency graph so Matthew
could estimate what he could expect at his lower frequency. With
the part asleep and a longish WDT period the average uA should
be quite low
2005\08\24@080827
by
Wouter van Ooijen
> Some new PICs have a similar circuit built in, but I know the
> 12F629 is not one of them.
IIRC not, the weren't the 16F818/819 the first nanopower chips?
Wouter van Ooijen
-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu
2005\08\24@081510
by
Mike Harrison
|
On Wed, 24 Aug 2005 07:29:16 -0400, you wrote:
{Quote hidden}>Matthew Miller wrote:
>> My measurement
>> for the current consumption was a surprise. The different values I got
>> all were around 280uA.
>
>Are you really sure it's running from the external RC oscillator, not the
>internal one? Also show the whole schematic, don't just wave your hands
>around describing it. Think about every possible current path. Remember
>that all I/O pins are potential current paths, both for source and sink.
>Are the internal pullups enabled? Are any digital inputs being held at a
>mid range voltage?
>
>How fast does the LED need to blink or the circuit respond to an external
>event? My knee jerk reaction is that an external RC oscillator to run the
>instruction clock is not the best answer. I would try to keep the PIC in
>sleep for as much of the time as possible. One way is to use the watchdog
>to wake up the PIC periodically. On older PICs, the watchdog was a bit of a
>pig itself. This has gotten better on some newer PICs but I don't remember
>if the 12F629 is one of them. I had a problem like this on a 16F630 which
>has the old watchdog timer, and ended up using an external micropower wakeup
>timer but running the PIC off its own internal oscillator when woken up.
>The external wakeup timer draws something like 300nA average worst case.
>Some new PICs have a similar circuit built in, but I know the 12F629 is not
>one of them.
>
If you are using external RC to reduce current, take a look at the 12F635. This will run at about
1.5uA with the watchdog ON, and the intrc clock can be software switched from 31K or 125K to 8M.
The watchdog interval can be as short as 1mS, or as long as 4 minutes.
2005\08\24@094114
by
Jan-Erik Soderholm
Mike Harrison wrote :
> take a look at the 12F635...
That is a 1 K
flash "KEELOQ"" device.
The 12F683 is more "general purpose"
and have
2 K flash.
Still with the nW intosc, of course.
Regards,
Jan-Erik.
2005\08\24@094423
by
Matthew Miller
|
Everyone, thanks for your responses! At the moment, it seems that using the
WDT will give the lowest power usage. As suggested, I disabled the BOR
circuit and this dropped current usage by 100uA. I was very surprised by
this.
I've not yet looked in to the external RC values yet, but that is next on my
list this morning. The values currently used are R=68k and C=0.001uF. When
picking these values I was hesitant to use an R > 100k because of a
suggestion in the midrange datasheet; also I didn't pick a smaller C because
this circuit is currently on a breadboard. Does anyone have any practical
experience regarding how large R can be?
When running in an infinite loop, without the WDT and BOR disabled the
current draw was around 150uA. Using the WDT and going to sleep after each
wake-up resulted in a very small current draw, less than 10uA, but I
couldn't measure this very well. I am reluctant to even tell you folks how
I'm measuring the current. :|
I've attached my source again, and a schematic as well (this is for you
Olin, you ol' curmudgeon! Ha, ha, I'm kidding of course, thanks for your
input.)
I've also got some 12F683 chips on hand, I'll try them out next.
Thanks. Matthew
--
Woman on Street: Sir, you are drunk; very, very drunk.
Winston Churchill: Madame, you are ugly; very, very ugly.
I shall be sober in the morning.
2005\08\24@102017
by
Mike Harrison
On Wed, 24 Aug 2005 15:41:13 +0200 (MEST), you wrote:
>Mike Harrison wrote :
>
>> take a look at the 12F635...
>
>That is a 1 K
>flash "KEELOQ"" device.
>
>The 12F683 is more "general purpose"
>and have
>2 K flash.
>
>Still with the nW intosc, of course.
>
>Regards,
>
>Jan-Erik.
The 635( and 636/639) devices have a keeloq peripheral, but you can ignore it.
The 635 is cheaper than the 683
2005\08\24@115126
by
Matthew Miller
|
Hi Olin,
On Wed, Aug 24, 2005 at 07:29:16AM -0400, Olin Lathrop wrote:
>
> How fast does the LED need to blink or the circuit respond to an external
> event? My knee jerk reaction is that an external RC oscillator to run the
> instruction clock is not the best answer. I would try to keep the PIC in
> sleep for as much of the time as possible. One way is to use the watchdog
> to wake up the PIC periodically. On older PICs, the watchdog was a bit of a
> pig itself. This has gotten better on some newer PICs but I don't remember
> if the 12F629 is one of them. I had a problem like this on a 16F630 which
> has the old watchdog timer, and ended up using an external micropower wakeup
> timer but running the PIC off its own internal oscillator when woken up.
> The external wakeup timer draws something like 300nA average worst case.
> Some new PICs have a similar circuit built in, but I know the 12F629 is not
> one of them.
I tried two experiments. For both I used the WDT set the max prescale value
giving a delay of ~2 sec. The first experiment was using the external
osc. with R=68k and C=0.0001uF; the measured instruction clock was around
5kHz. During each wake-up the LED is turned on for about 4e-4 sec. (two
nop's implimented this delay.) Current draw was very small, around 10uA. The
circuit operated for about 30 min. off the initial 3V charge on a 4700uF
cap!
For the next experiment, I used the 4MHz internal oscillator and a delay
subroutine to flash the LED on for 4e-4 sec. The performance in this
configuration was much worse than I expected. The current draw was around
92uA and the circuit only ran for two minutes powered by the 4700uF cap.
It seems that using the external osc. is necessary to get the minimal
current drain with the 12F629 that I want. Using the 12F683 with the 32kHz
internal osc. may work just as good and free up an IO pin as well. Thanks
for your suggestions Olin. I've attached a schematic to my second post if
you're interested. ;)
Matthew
--
That's the thing about people who think they hate computers. What they
really hate is lousy programmers. - Larry Niven and Jerry Pournelle in "Oath
of Fealty"
2005\08\24@122849
by
Michael Tandy
> I've not yet looked in to the external RC values yet, but that is next on my
> list this morning. The values currently used are R=68k and C=0.001uF. When
> picking these values I was hesitant to use an R > 100k because of a
> suggestion in the midrange datasheet; also I didn't pick a smaller C because
> this circuit is currently on a breadboard. Does anyone have any practical
> experience regarding how large R can be?
Well, a 68k resistor (with a 3v supply) should mean the RC circuit can't
draw more than 44uA - and in practice it won't take that much on
average. This might not need changing, considering the amount of power
you can save in other areas. 'course, you can try changing it if you like :)
Cheers,
Michael
2005\08\24@124128
by
Jan-Erik Soderholm
Matthew Miller wrote :
> I tried two experiments. For both I used the
WDT set the max
> prescale value
> giving a delay of ~2 sec. The first
experiment was using the external
> osc. with R=68k and C=0.0001uF; the
measured instruction
> clock was around
> 5kHz. During each wake-up
the LED is turned on for about 4e-4
> sec. (two
> nop's implimented
this delay.) Current draw was very small,
> around 10uA. The
> circuit
operated for about 30 min. off the initial 3V charge
> on a 4700uF
>
cap!
>
> For the next experiment, I used the 4MHz internal oscillator
> and a delay
> subroutine to flash the LED on for 4e-4 sec. The
performance in this
> configuration was much worse than I expected. The
current
> draw was around
> 92uA and the circuit only ran for two
minutes powered by the
> 4700uF cap.
So at 92 uA instead of 10 uA the
processor
is doing aprox 800 times as much "work"
(processor cycles)
Not that bad, is it ?
Jan-Erik.
2005\08\24@143407
by
Matthew Miller
|
Hi Jan-Erik,
On Wed, Aug 24, 2005 at 06:41:27PM +0200, Jan-Erik Soderholm wrote:
>
> So at 92 uA instead of 10 uA the
> processor
> is doing aprox 800 times as much "work"
> (processor cycles)
>
> Not that bad, is it ?
In that sense the current usage isn't bad. What started me wanting a really
low power circuit is that I want to make a bauble or jewel for my young
niece. Inside the plastic "jewel" would be the circuit and some smt LED's
(and maybe other things, a tilt sensor, thermsistor, etc.) and every now and
then the jewel will "twinkle".
I'm trying to think of other things the bauble could do. So far the only
other idea is similar to how the frequency of a cricket's chirping changes
with temperature. I would instead use a LED to communicate this information.
With some of the lithium batteries available, what I've learned from you
folks and my tinkering, I think I can design a circuit and firmware that can
operate for a few years.
Everyone thanks for the help.
Matthew.
--
"In individuals, insanity is rare, but in groups, parties, nations, and
epochs it is the rule." - Nietzsche
2005\08\25@065532
by
Howard Winter
Matthew,
On Wed, 24 Aug 2005 09:44:08 -0400, Matthew Miller
wrote:
>...<
> the current draw was around 150uA
Just as an aside, how are you measuring currents this
small?
Cheers,
Howard Winter
St.Albans, England
2005\08\25@090922
by
Matthew Miller
|
Hi Howard,
On Thu, Aug 25, 2005 at 11:55:31AM +0100, Howard Winter wrote:
>
> On Wed, 24 Aug 2005 09:44:08 -0400, Matthew Miller
> wrote:
> >...<
> > the current draw was around 150uA
>
> Just as an aside, how are you measuring currents this
> small?
I had to open my old physics book to figure how to do this, but here is the
method I used. This method only gives the average current used.
I placed a 4700uF cap in parallel with the 3V battery, and measuring the
voltage across the cap, wait for the voltage reading to stabilize. This
voltage is V1.
Next, I do my best to unhook the battery and start a stopwatch at the same
instant. When the voltage reading drops to around 2.2V, I try to press the
hold button on the volt meter and stop the stopwatch at the same time. This
voltage is V2.
Find the change in the caps. potential energy:
delta_U = (.5 * C * V1^2) - (.5 * C * V2^2)
Find the change in the charge by solving for Q: delta_U = Q^2/2C
Then the average current is Q divided by the elapsed time.
This seems to be a fairly good method. There are errors that have to be
factered in, such as the caps leakage current, the volt meter input
impedance and uncertainty of the caps real value.. This works well until you
want to measure current draws < 10uA, then it is hard to seperate the errors
from the measurement.
Take care.
Matthew
--
Observe, reason, and experiment.
(if you're too dumb, just pray)
2005\08\25@092009
by
Michael Rigby-Jones
|
>-----Original Message-----
>From: piclist-bounces
KILLspammit.edu [.....piclist-bouncesKILLspam
.....mit.edu]
>Sent: 25 August 2005 14:09
>To: Microcontroller discussion list - Public.
>Subject: Re: [PIC] Excessive 12F629 current usage
>
>
>This seems to be a fairly good method. There are errors that
>have to be factered in, such as the caps leakage current, the
>volt meter input impedance and uncertainty of the caps real
>value..
And of course the fact that the measured current is averaged over the range 2.2-3.3 volt range, i.e. the current will drop as the voltage falls. However, it's quite a neat solution to very low current measurement on the cheap!
Regards
Mike
=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================
2005\08\25@124202
by
Matthew Miller
|
Hi Mike,
On Thu, Aug 25, 2005 at 02:20:03PM +0100, Michael Rigby-Jones wrote: >
>
> And of course the fact that the measured current is averaged over the
> range 2.2-3.3 volt range, i.e. the current will drop as the voltage falls.
> However, it's quite a neat solution to very low current measurement on the
> cheap!
Thanks, I'm pretty happy with the method, even if I don't get an
instantaneous current measurement. It would be nice if I had a computer
controlled meter to help automate the task.
I'm still unimpressed by the current usage of a free running PIC. Using an
external RC (1M/180pF) osc with an instruction cycle of 1.7kHz the current
draw is still ~300uA. This is to do nothing but sit in an infinite loop, no
pins driven, etc.
The datasheet says the using a 32kHz LP osc mode the typical current draw at
3V is 18uA. Could the RC osc be the cause of so much more current being
drawn?
Matthew
--
"The typewriting machine, when played with expression, is no more annoying
than the piano when played by a sister or near relation." -- Oscar Wilde
2005\08\25@133051
by
Bob Blick
> I'm still unimpressed by the current usage of a free running PIC. Using an
> external RC (1M/180pF) osc with an instruction cycle of 1.7kHz the current
> draw is still ~300uA. This is to do nothing but sit in an infinite loop,
> no
> pins driven, etc.
>
> The datasheet says the using a 32kHz LP osc mode the typical current draw
> at
> 3V is 18uA. Could the RC osc be the cause of so much more current being
> drawn?
Hi Matthew,
With a 1M resistor I don't see how that could account for so much current
drain. Perhaps there is some onboard peripheral that is running. I'm not
familiar with the 12F629, but some of the things that draw current could
be: A/D converters, comparators, brown-out-detect, voltage references,
watchdog timer, etc.
You might check the list of peripherals included in the 12F629 and then
look at the corresponding section of the data sheet to see how to disable
them(some are likely to be enabled by default).
Cheerful regards,
Bob
2005\08\25@134842
by
Mark Rages
On 8/25/05, Matthew Miller <EraseMEnamiller2spam_OUT
TakeThisOuTnaxs.net> wrote:
> I placed a 4700uF cap in parallel with the 3V battery, and measuring the
> voltage across the cap, wait for the voltage reading to stabilize. This
> voltage is V1.
>
> Next, I do my best to unhook the battery and start a stopwatch at the same
> instant. When the voltage reading drops to around 2.2V, I try to press the
> hold button on the volt meter and stop the stopwatch at the same time. This
> voltage is V2.
>
That's a clever method, but you should probably measure the 4700uF
cap's actual capacitance. (electrolytic caps can vary by a lot). Use
the same method, but substitute a high-value 1% resistor instead of
the test circuit. Solve for C instead of I.
Regards,
Mark
markrages@gmail
--
You think that it is a secret, but it never has been one.
- fortune cookie
2005\08\25@145525
by
Dave Tweed
|
Mark Rages <markrages
spam_OUTgmail.com> wrote:
> On 8/25/05, Matthew Miller <@spam@namiller2KILLspam
naxs.net> wrote:
> > I placed a 4700uF cap in parallel with the 3V battery, and measuring the
> > voltage across the cap, wait for the voltage reading to stabilize. This
> > voltage is V1.
> >
> > Next, I do my best to unhook the battery and start a stopwatch at the same
> > instant. When the voltage reading drops to around 2.2V, I try to press the
> > hold button on the volt meter and stop the stopwatch at the same time. This
> > voltage is V2.
>
> That's a clever method, but you should probably measure the 4700uF
> cap's actual capacitance. (electrolytic caps can vary by a lot). Use
> the same method, but substitute a high-value 1% resistor instead of
> the test circuit. Solve for C instead of I.
You'll also want to know its internal shunt resistance (leakage current),
so measure the time constant with no external load, or a second precision
resistor of a different value.
-- Dave Tweed
2005\08\25@153853
by
Matthew Miller
|
Hi Bob,
On Thu, Aug 25, 2005 at 10:30:50AM -0700, Bob Blick wrote:
>
> With a 1M resistor I don't see how that could account for so much current
> drain. Perhaps there is some onboard peripheral that is running. I'm not
> familiar with the 12F629, but some of the things that draw current could
> be: A/D converters, comparators, brown-out-detect, voltage references,
> watchdog timer, etc.
>
> You might check the list of peripherals included in the 12F629 and then
> look at the corresponding section of the data sheet to see how to disable
> them(some are likely to be enabled by default).
Aside from two timers, the only peripheral that the 12F629 has are two
comparators which are turned off in the software. For my tests I've not been
using the WDT or BOR. Even with no clock running (I grounded the OSC1 pin)
I measure an average current of 120uA. While in sleep, using a RC osc, the
current is 40uA; not too bad.
I think that before I complain more about this, I'm going to take the advice
of two recent posters to this thread and find a more precise value for the
capacitor that I'm using to make current measurements. The values I give
here could be off as much as 20% either way.
Thanks,
Matthew.
--
"Faith: not *wanting* to know what is true." -- Friedrich Nietzsche
2005\08\25@154327
by
Matthew Miller
On Thu, Aug 25, 2005 at 12:48:41PM -0500, Mark Rages wrote:
>
> That's a clever method, but you should probably measure the 4700uF
> cap's actual capacitance. (electrolytic caps can vary by a lot). Use
> the same method, but substitute a high-value 1% resistor instead of
> the test circuit. Solve for C instead of I.
A very good idea Mark! The cap I'm using has a +-20% tolerance.
Matthew
--
"We do not embrace reason at the expense of emotion. We embrace it at the
expense of self-deception." -- Herbert Muschamp
2005\08\25@155156
by
Bob Blick
Hi Matthew,
Do you have another 12F629 you can use in order to verify the one you have
has not been damaged in some way?
Cheers,
Bob
> Aside from two timers, the only peripheral that the 12F629 has are two
> comparators which are turned off in the software. For my tests I've not
> been
> using the WDT or BOR. Even with no clock running (I grounded the OSC1 pin)
> I measure an average current of 120uA. While in sleep, using a RC osc, the
> current is 40uA; not too bad.
2005\08\25@173531
by
Matthew Miller
Hi Bob,
On Thu, Aug 25, 2005 at 12:51:55PM -0700, Bob Blick wrote:
>
> Do you have another 12F629 you can use in order to verify the one you have
> has not been damaged in some way?
I've been using two devices through out my tests. Maybe I should use more?
I have about 6 12F629's on hand. If I get different results I'll report back
tomorrow.
Matthew
--
A paranoid is just someone with all of the facts at his disposal.
-- William S. Burroughs
2005\08\25@173838
by
Bob Axtell
Bob Blick wrote:
{Quote hidden}>Hi Matthew,
>
>Do you have another 12F629 you can use in order to verify the one you have
>has not been damaged in some way?
>
>Cheers,
>
>Bob
>
>
>
>
>
>>Aside from two timers, the only peripheral that the 12F629 has are two
>>comparators which are turned off in the software. For my tests I've not
>>been
>>using the WDT or BOR. Even with no clock running (I grounded the OSC1 pin)
>>I measure an average current of 120uA. While in sleep, using a RC osc, the
>>current is 40uA; not too bad.
>>
>>
>
>
>
>
120uA seems very high to me. I usually use a 100K 1% resistor across a
normally-closed
toggle switch in series with the GND of the PIC. Then open the switch
momentarily and
make a quick measurement with a calibrated oscilloscope 10M probe.
The voltage drop across the 100K measures the current drain. At I=E/R, a
drop of 1V indicates
10 uA (0.00001), a drop of 2V 20uA (0.00002), etc.
--Bob
--
Note: To protect our network,
attachments must be sent to
KILLspamattachKILLspam
engineer.cotse.net .
1-866-263-5745 USA/Canada
http://beam.to/azengineer
2005\08\25@205522
by
Jinx
Matthew, think of all this fun you'd have missed out on if
someone at National hadn't run a red pen through the 3909
I just had a quick twiddle with a 675 and this program at 3.6V
with the following result
With WDT_OFF (PIC never wakes from SLEEP) consumption
is a few nA. With WDT_ON the consumption is 3.7uA. I think
you can save yourself the extra components for ExtRC. Output is
a 2us pulse on GPIO,0 every 2.3s. You should be able to extra-
polate from this what your average is going to be with an LED
as a load. It would help you to look around for a low current one
__CONFIG _CP_OFF & _INTRC_OSC_NOCLKOUT
& _BODEN_OFF & _WDT_ON & _PWRTE_ON & _MCLRE_ON
clrf ansel ;digital
movlw b'00001000'
; 1 /mclr
movwf trisio
movlw b'10001111'
; 1 pullups off
; 1 p/s on WDT
; 111 1:128
movwf option_reg
bank0
clrf gpio
movlw b'00000111' ;GPIO 0,1,2 as digital
movwf cmcon
here sleep
bsf pulse ;indicator for scope
nop
bcf pulse
goto here
2005\08\26@155656
by
Peter
|
part 1 3163 bytes content-type:TEXT/PLAIN; charset=US-ASCII; format=flowed
On Thu, 25 Aug 2005, Dave Tweed wrote:
> Mark Rages <RemoveMEmarkragesTakeThisOuT
gmail.com> wrote:
>> On 8/25/05, Matthew Miller <spamBeGonenamiller2spamBeGone
naxs.net> wrote:
>>> I placed a 4700uF cap in parallel with the 3V battery, and measuring the
>>> voltage across the cap, wait for the voltage reading to stabilize. This
>>> voltage is V1.
>>>
>>> Next, I do my best to unhook the battery and start a stopwatch at the same
>>> instant. When the voltage reading drops to around 2.2V, I try to press the
>>> hold button on the volt meter and stop the stopwatch at the same time. This
>>> voltage is V2.
>>
>> That's a clever method, but you should probably measure the 4700uF
>> cap's actual capacitance. (electrolytic caps can vary by a lot). Use
>> the same method, but substitute a high-value 1% resistor instead of
>> the test circuit. Solve for C instead of I.
>
> You'll also want to know its internal shunt resistance (leakage current),
> so measure the time constant with no external load, or a second precision
> resistor of a different value.
Imho the best way to measure low current is with an opamp. A virtual
shunt is formed between the + and - inputs when a suitable feedback
resistor is used. The voltage drop on it will be 0 while the opamp can
drive the required current through the feedback resistor. A diode
shunting the feedback resistor provides start current etc. A DVM
connected beteween + input and output of the opamp will read 1mV/uA for
example (for Rfb = 1k 1%), and 10mV/uA for Rfb = 10k 1%. The offset can
be removed easily (disconnect load and take reading, then substract this
from reading with connected load). The opamp requires its own floating
power supply. Two 9V batteries are perfect for this.
If pulsed drain/sourcing is to be measured, adding a good quality
capacitor to shunt the Rfb provides this service, as long as the pulses
to be measured are within the power bandwidth of the opamp. They usually
are, as the load has its own decoupling capacitors and the opamp I chose
has a reasonable slew rate (13V/us). A reset switch is then also needed,
it will separate the diode-resistor network from the feedback path,
leaving only the capacitor.
I did not go below 1uA with this method but with new opamps it should be
possible to go down to a few nA by extending it a little with a better
resistor and opamp. The TL072 is rated <200pA input bias current so the
circuit should work to about 20nA as shown (20nA not tried). It will be
necessary to compensate the offset for higher sensitivity. For the
circuit shown this is not needed (at most 3mV offset appear as such at
the output, just substract them from the measurements). The easiest way
to check whether the circuit is showing ghosts is to fit a DPDT
inverting switch at the input and flick it over if ghosts are suspected.
The readout should invert (minus offset). Ghosts and leakage usually do
not invert. At very low current the diode leakage becomes a problem
(both for the input shunt and for the feedback shunt).
Peter
part 2 4579 bytes content-type:APPLICATION/pdf; name=virtual_shunt.pdf (decode)
part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)
2005\08\26@212038
by
Matthew Miller
|
Hi Jinx,
I've spent some time today running more tests and finding a more accurate
value of the cap that I'm using to measure the average current usage of the
different circuits. It has been productive. I'm very interested in the
virtual shunt that Peter posted about though.
On Fri, Aug 26, 2005 at 12:54:26PM +1200, Jinx wrote:
> Matthew, think of all this fun you'd have missed out on if
> someone at National hadn't run a red pen through the 3909
:^) I've been learning a great deal because of National's decision.
> With WDT_OFF (PIC never wakes from SLEEP) consumption
> is a few nA. With WDT_ON the consumption is 3.7uA.
My tests show ~5uA current draw while asleep with no WDT. Though my current
measurement setup isn't ideal for such low currents; this is why the virtual
shunt idea is so interesting.
> I think you can save yourself the extra components for ExtRC.
Surprisingly, I believe your right. More below.
> Output is
> a 2us pulse on GPIO,0 every 2.3s. You should be able to extra-
> polate from this what your average is going to be with an LED
> as a load. It would help you to look around for a low current one
I used similar code/setup for two tests. The output pulse to the LED is
about 1ms wide though. It would be very hard to perceive a 2us pulse of
light, atleast it would be very dim.
I ran four tests, and each test was ran using three different 12F629 chips
so that I could compare results. There were no major differences measured
between devices. Tests that used the external RC osc used these values: R=1M
and C=68pF. The resulting instruction cycle frequency was around 4kHz.
All tests used the same circuit built on a breadboard. The only exception is
if a test didn't blink the LED, the LED was removed. The schematic is here:
http://roland.sw.edu/matthew/blinker.png
Test 1. Using the external osc., no WDT, no external loads. After
initialization the pic does a goto $-1. Code is here:
http://roland.sw.edu/matthew/blinker-free.asm
The results are disappointing, a ~280uA current draw across all three
devices. Compare this to the LP osc mode current draw with Fosc=32kHz. Why
does this test show such a high current usage?
Test 2. Similar test to number 1, except that instead of an infinite loop
the device goes to sleep permanently. Code:
http://roland.sw.edu/matthew/blinker-sleep.asm
I can't say much here, but that the current draw is small. :( Around 5uA. I
need a better measurement setup. Virtual shunt here I come!
Test 3. Using the external osc and WDT a LED is flashed for 1ms after each
WDT timeout. Code: http://roland.sw.edu/matthew/blinker-ext.asm
Going to sleep makes the current draw bearable: 58uA.
Test 4. The only difference from test 3, is that the internal osc is
used. The LED flashes for the same (approximate) duration. WDT on.
code: http://roland.sw.edu/matthew/blinker.asm
The average current usage was 53uA.
What do I conclude from this? Contrary to the datasheet, the external RC osc
has an awfully high current usage. It's amazing that test 4 had similar
current draw to test 3. Maybe I'm being fooled by poor equipment? While I
feel I'm measuring everything with a reasonable accuracy, I still need to
build the virtual shunt circuit.
I appreciate everyone's feedback. I learn a lot on this list!
Sincerely,
Matthew.
--
Q) Why do C programmers put all the code in the "for" statement?
A) Because they can!
- Dr. Todd Stevens
2005\08\26@222909
by
Jinx
> My tests show ~5uA current draw while asleep with no WDT
With no special features or modules turned on, consumption will
be around 10nA. Even if you can't measure this accurately, you
would see 00.00uA on a meter. And I don't think it has to be a
particularly good one to differentiate between 5000nA and 10nA
I notice that you don't CLRF GPIO - don't know whether that
has any bearing. Perhaps one or more I/O bits are set on power-
up. As GPIO,3 is I/O you could set it to o/p and not tie it down.
My test had only Vdd, Vss and 100k p/u on MCLR
2005\08\26@223653
by
Jinx
> As GPIO,3 is I/O you could set it to o/p and not tie it down
GPIO,3 is, of course, i/p only. I knew that
2005\08\26@235430
by
Matthew Miller
|
Hi Jinx,
On Sat, Aug 27, 2005 at 02:29:04PM +1200, Jinx wrote:
> > My tests show ~5uA current draw while asleep with no WDT
>
> With no special features or modules turned on, consumption will
> be around 10nA. Even if you can't measure this accurately, you
> would see 00.00uA on a meter. And I don't think it has to be a
> particularly good one to differentiate between 5000nA and 10nA
Yeah, I don't trust the measurements in this test too much. The meter I have
now doesn't have a working current function; this prompted me figure out the
method I'm using presently.
> I notice that you don't CLRF GPIO - don't know whether that
> has any bearing.
I don't. The only input is GP3, it is grounded (I saw your other post about
this pin.) I'm just hand-waving tho, see:
http://roland.sw.edu/matthew/blinker.png
Still, I'm wondering why a 16kHz clocked chip and one clocked at 4MHz,
running firmware that does the same thing, have current usages that are so
similar. The current use in test 1 still seems awfully high.
Take care,
Matthew
--
I think our coffee machine is networked -- I keep seeing these dropped sugar
packets all around it.
-Tony Shepps
2005\08\27@000727
by
Jinx
> Yeah, I don't trust the measurements in this test too much
A 1000uF cap just grabbed out of the box added 2uA to
my measurements. Without a working meter you could be
being led astray
2005\08\27@003617
by
Matthew Miller
Hi Jinx,
On Sat, Aug 27, 2005 at 04:07:25PM +1200, Jinx wrote:
> > Yeah, I don't trust the measurements in this test too much
>
> A 1000uF cap just grabbed out of the box added 2uA to
> my measurements. Without a working meter you could be
> being led astray
You are right. My meter works, it just doesn't measure current! After
testing some fixed voltage regulators and zener diodes I have a pretty good
confidence in the voltage function of the meter.
The 4700uF cap I'm using has a ~7uA leakage current. I'm trying to account
for everything that could affect the measurements.
Maybe my measurements are too high? I don't want to think they are too high,
but maybe they are scaled badly in one direction? I still need a new meter
though... I'll start again in the morning.
Thanks Jinx!
Matthew
--
"One of the great commandments of science is:
'Mistrust arguments from authority.'" -- Carl Sagan
2005\08\27@012357
by
William Chops Westfield
On Aug 26, 2005, at 8:54 PM, Matthew Miller wrote:
> I'm wondering why a 16kHz clocked chip and one clocked at 4MHz,
> running firmware that does the same thing, have current usages
> that are so similar. The current use in test 1 still seems high.
>
Well, the "obvious" explanation is that the current that you're
measuring is NOT the dynamic current used by the CPU, but is
some other static current being consumed somewhere that we haven't
identified yet. That would fit the datasheet better; tiny current
consumed by the CPU at both 16kHz and somewhat higher speeds,
200uA going "somewhere else."
Has anyone else tried measuring such a PIC? I should have a
made board somewhere that I can turn into a blinker, but all I've
got is 12f675s...
Just out of curiosity; someone suggested that you might be able
to run a PIC at 1.5V - have you tried that at all?
BillW
2005\08\27@020844
by
Matthew Miller
|
Hi William,
I'm not in bed yet, but darn it, I'm going to sleep soon!
On Fri, Aug 26, 2005 at 10:23:54PM -0700, William Chops Westfield wrote:
{Quote hidden}> On Aug 26, 2005, at 8:54 PM, Matthew Miller wrote:
>
> >I'm wondering why a 16kHz clocked chip and one clocked at 4MHz,
> >running firmware that does the same thing, have current usages
> >that are so similar. The current use in test 1 still seems high.
> >
> Well, the "obvious" explanation is that the current that you're
> measuring is NOT the dynamic current used by the CPU, but is
> some other static current being consumed somewhere that we haven't
> identified yet. That would fit the datasheet better; tiny current
> consumed by the CPU at both 16kHz and somewhat higher speeds,
> 200uA going "somewhere else."
That's a good possibility. Tommorow I'm going to breadboard the circuit
again and the only common element will the capacitor I'm using for current
measurements.
> Has anyone else tried measuring such a PIC? I should have a
> made board somewhere that I can turn into a blinker, but all I've
> got is 12f675s...
I don't know. I've tried to be careful regarding my measurements, but errors
do creap in. Trying to simultaneously disconnect a wire and activate a
stopwatch has a delta t of several hundred milliseconds or worse.
> Just out of curiosity; someone suggested that you might be able
> to run a PIC at 1.5V - have you tried that at all?
I've not tried this suggestion on purpose. A PIC with no external load will
run at 1.5V. I saw this using the _EXTRC_OSC_CLKOUT config option and using
an oscilloscope to measure the output frequency. Without the brown out
circuit enabled a PIC will run at a very low voltage.
It is just that for my application, at around 2.5V the light output of the
LED is very dim. To run at 1.5V I think a voltage multiplier and low Vth
mosfet would be needed; I'm assuming a useful light output here. A 3 volts a
lithium cell has a much better energy capacity and volume than two alkaline
cells. I wish the 12F629 had one open-drain output; the voltage doubler idea
would be easy to use in that case.
I may need to continue this discussion after I've built a virtual shunt
circuit. Everyone, thanks for the input!
Matthew
--
"A designer knows he has arrived at perfection not when there is no longer
anything to add, but when there is no longer anything to take away."
-- Antoine de Saint-Exupery
More... (looser matching)
- Last day of these posts
- In 2005
, 2006 only
- Today
- New search...