Pages: [1] 2 3   Go Down
Author Topic: Eating Batteries  (Read 4644 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12858
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Interesting.

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

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12858
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12858
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Pins default to input.

- Brian
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 132
Posts: 6746
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

London, England
Offline Offline
Edison Member
*
Karma: 4
Posts: 1026
Go! Go! Arduinoooo !!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Interesting information!

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 388
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?)
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12858
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 388
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...  smiley-wink
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12858
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Full Member
***
Karma: 1
Posts: 170
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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? smiley

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

Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you compare setting to OUTPUT and LOW vs HIGH?
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 388
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1] 2 3   Go Up
Jump to: