Global Moderator
Dallas
Offline
Shannon Member
Karma: 129
Posts: 10379
|
 |
« on: May 24, 2009, 07:58:47 pm » |
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
God Member
Karma: 0
Posts: 572
|
 |
« Reply #1 on: May 25, 2009, 12:20:47 am » |
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
Shannon Member
Karma: 129
Posts: 10379
|
 |
« Reply #2 on: May 25, 2009, 02:03:12 am » |
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
God Member
Karma: 0
Posts: 572
|
 |
« Reply #3 on: May 25, 2009, 02:06:55 am » |
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
Shannon Member
Karma: 129
Posts: 10379
|
 |
« Reply #4 on: May 25, 2009, 02:37:00 am » |
Pins default to input.
- Brian
|
|
|
|
|
Logged
|
|
|
|
|
SF Bay Area (USA)
Offline
Faraday Member
Karma: 80
Posts: 5513
Strongly opinionated, but not official!
|
 |
« Reply #5 on: May 25, 2009, 04:20:35 am » |
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
Edison Member
Karma: 3
Posts: 1026
Go! Go! Arduinoooo !!!
|
 |
« Reply #6 on: May 27, 2009, 01:39:07 pm » |
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
Brattain Member
Karma: 282
Posts: 15443
Measurement changes behavior
|
 |
« Reply #7 on: May 27, 2009, 01:56:01 pm » |
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
Sr. Member
Karma: 0
Posts: 388
|
 |
« Reply #8 on: May 29, 2009, 10:25:35 pm » |
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
Shannon Member
Karma: 129
Posts: 10379
|
 |
« Reply #9 on: June 13, 2009, 02:53:09 am » |
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. , or 6-7 minutes per hour of battery life. How do you get that? 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
Sr. Member
Karma: 0
Posts: 388
|
 |
« Reply #10 on: June 13, 2009, 07:14:54 pm » |
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... 
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 129
Posts: 10379
|
 |
« Reply #11 on: June 14, 2009, 02:53:59 am » |
10-12% of 60 minutes Dang! I must be sleep-reading. :-[ Somehow I missed the "per hour" part of your message. Sorry about that. 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
Full Member
Karma: 1
Posts: 170
|
 |
« Reply #12 on: June 15, 2009, 10:00:25 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 77
Arduino rocks
|
 |
« Reply #13 on: June 15, 2009, 10:14:30 pm » |
Did you compare setting to OUTPUT and LOW vs HIGH?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 0
Posts: 388
|
 |
« Reply #14 on: June 15, 2009, 10:29:33 pm » |
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
|
|
|
|
|
|