Show Posts
|
|
Pages: 1 ... 3 4 [5]
|
|
61
|
Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Is there a low power mode?
|
on: October 28, 2009, 08:04:04 pm
|
|
I'm looking for something related to sleep modes.
I'd like to know the list of Arduino commands that I can execute just prior to a sleep, to know (guarantee) that all features, devices, and pins I've used in the program get return to the default / idle / off state.
Why? I have built a battery powered application that has a strange power consumption. I have built a target board, so now the chip is not socketed onto Arduino board, but rather my board. When I apply power, the program starts, which is to setup both external interrupt buttons to input w/ pullup, then sleep. The idle consumption in this state is 0.11 mA. It stays this way until one of the interrupt buttons (I use both) is pressed, then it goes into action and transmits over a radio, spiking up to 45mA when doing that, then I sleep the radio (it's active low), and change all the atmega pins to inputs no pullup, except for pullups on the interrupt buttons... Then I call a reset routine (jump to address 0). Now, power consumption is 0.29mA, and it doesn't drop below that. The cycle can be repeated of pushing buttons, spike, settle... but never again down to 0.11mA. Unless I remove power from the board, and reapply... then it starts at 0.11mA
So, I'd like to run all commands necessary to force the chip into the state it was in when power was first applied. I'll run these commands as the last step before I call the reset routine - that promptly leads to a sleep.
Advice?
|
|
|
|
|
63
|
Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: turn off analog power?
|
on: November 01, 2009, 01:06:03 pm
|
|
Aha! Found the following in init() section of code in wiring.c, the comments say init() is called before setup(). Anyways:
// enable a2d conversions sbi(ADCSRA, ADEN);
So, this means in my application I'm going to do as you say:
ADCSRA &= ~(1<<ADEN); Or, probably cbi(ADCSRA, ADEN) because it looks cleaner.
And reading the low power section of the 328P specsheet, there is a power register I'm going to explicitly de-power the ADC before sleep using what it suggests. And also disable brownout, that sucks resting power too. And make sure internal voltage reference is off.... lot's of advice there.
Then upon waking up, sbi(ADCSRA, ADEN), and re-power or do whatever else is needed.
Be cool if Arduino took care of this housing keeping when a specific sleep mode is called. I can always wish for 0018 or 19.. or whatever
|
|
|
|
|