Go Down

Topic: Eating Batteries (Read 5491 times) previous topic - next topic

Coding Badly

I discovered^ that floating pins can, relatively speaking, consume a significant amount of power.  This is particular important for battery powered applications.  In my case, by enabling the internal pullup resistors, my project went from consuming about 28ma to consuming a steady 25ma.

- Brian


^ "Discovered" in the sense that it's news to me; a newbee.  I searched these forums for a similar post but couldn't find one.

trialex

Interesting.

What if you left the pins as "undefined", as in not either INPUTS or OUTPUS? Would that have an effect on the consumption?

Coding Badly

Quote
What if you left the pins as "undefined"


As far as I can tell, that isn't possible.  It's my understanding that a pin can be configured in three ways...

 INPUT  - this is the default on power-up
 INPUT w/ Internal Pull-up Enabled
 OUTPUT

If you know of a way to make a pin undefined, please let me know.  I'm certainly willing to test.

- Brian

trialex

So what happens on startup, if you don't do a pinmode() on a particular pin? Does it default to either input or output?

Coding Badly

Pins default to input.

- Brian

westfw

Pins do default to inputs, and it is generally NOT a good idea to leave digital inputs unconnected to anything; they can float "in between" the allowed digital states, which can cause excessive power consumption.  Turning on the pullups is a good solution, actually...

Mike Mc

Interesting information!

Why not have the Arduino in the next bootloader version set all inputs to have the pull-ups enabled as default?

retrolefty

Quote
Why not have the Arduino in the next bootloader version set all inputs to have the pull-ups enabled as default?


Probably best to not mess with the AVR default for input pins, say if interfacing with 3.3volt logic levels or other obscure interfaces the pull-ups be a problem.

Lefty


TBAr

1. @ Coding Badly, is there a typo in your original post, re: 28ma vs. 25ma? I reckon that as a 10-12% difference, or 6-7 minutes per hour of battery life.

2. Keeping retrolefty's caveat in mind, would it be better for minimal power consumption to use setup() to consciously set the internal pull-ups on unused pins, or set all unused pins to output? (output LOW? HIGH?)

Coding Badly

Quote
1. @ Coding Badly, is there a typo in your original post, re: 28ma vs. 25ma? I reckon that as a 10-12% difference


No typo.  I've measured the current using a few applications and the difference seems to be fairly consistent.  

Bear in mind I'm using a multimeter to measure the current and, when the inputs are floating, the current can fluctuate wildly so it's a little difficult to get a accurate number.  In other words, your milage may vary.  

Quote
, or 6-7 minutes per hour of battery life.


How do you get that?

Quote
would it be better for minimal power consumption to set the internal pull-ups or set all unused pins to output


When I have time and if I can remember, I'll do some testing.

- Brian

TBAr

Quote
Quote
or 6-7 minutes per hour of battery life.
How do you get that?

10-12% of 60 minutes

If you're using a multimeter, I can do that here too.  I'll race you...  ;)

Coding Badly

Quote
10-12% of 60 minutes


Dang!  I must be sleep-reading.   :-[  Somehow I missed the "per hour" part of your message.  Sorry about that.


Quote
I'll race you...


You'll definately win!  Our new puppy arrived yesterday.  Last night she kept us up all night and, from the look in her eyes, she is planning to do the same tonight.  :'(


- Brian

Kitep

Quote
In my case, by enabling the internal pullup resistors, my project went from consuming about 28ma to consuming a steady 25ma.


I assume this is on a 14-pin Duemilanove?  Can you imagine what it would be on a Mega? :)

Did you set just the digital pins, or the analog pins as well?


rFree

Did you compare setting to OUTPUT and LOW vs HIGH?

TBAr

I myself have not gotten around to answering that question with my multimeter.  I may not get to it right away either. In any case, we should have a number of independent measurements to compare to. I'll keep the thread posted with my results when I get to it.

Go Up