laghari123 / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Sleep function - for low power applications #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
On the previous Bugs and Suggestions page, this was the most vote for item
(13 votes). People really would like a sleep function to save power on
arduino when used in certain environments, on battery, etc.

Original issue reported on code.google.com by josiah.ritchie on 8 Jun 2009 at 2:41

GoogleCodeExporter commented 9 years ago
Can we get the blessing of the administration for including this in core in v 
17 if
some coders work on it?

Original comment by pbad...@verizon.net on 13 Jun 2009 at 2:50

GoogleCodeExporter commented 9 years ago
It would be cool if this function came in two forms:
 * sleep(time) - sleep for a given period of time (seconds?  milliseconds?)
 * sleep() - sleep until an external interrupt (allows a deeper sleep mode)

Original comment by dmel...@gmail.com on 13 Jun 2009 at 3:31

GoogleCodeExporter commented 9 years ago
This would be awesome, one of the thing I would really like to see.  This and 
perhaps
the ability to run at 1mhz, for real low power use

Original comment by aristotl...@gmail.com on 4 Aug 2009 at 8:47

GoogleCodeExporter commented 9 years ago
Aristotle, is their an issue open here for the 1mhz thing? If not, consider 
adding
one. :-) Better to track things like that individually.

Original comment by josiah.ritchie on 4 Aug 2009 at 8:50

GoogleCodeExporter commented 9 years ago
that would be a nice thing! hope it makes it into the next release :)

Original comment by designer2k2 on 7 Aug 2009 at 10:34

GoogleCodeExporter commented 9 years ago
Aristotle... this changes clock to 1MHz at runtime.

  CLKPR = (1<<CLKPCE);
  CLKPR = B00000011; 

taken from http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1163418637 although 
syntax
for binary constants needed changing.

Original comment by pixelfre...@gmail.com on 5 Sep 2009 at 12:36

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by dmel...@gmail.com on 6 May 2010 at 6:40

GoogleCodeExporter commented 9 years ago
To get significant power savings (i.e., to go from 3 mA to less than 3 uA!), 
you must use the "power-save" mode of the AVR.  However, to get a timed wakeup 
from power-save mode, you need timer/counter 2 to be clocked asynchronously 
from a 32.768 kHz external crystal.

A millisecond-precision timed deep sleep function would be extremely helpful.

Unfortunately you can't use the external crystal as the system clock source 
while also using a 32.768 kHz watch crystal for the low frequency timer/counter 
2 asynchronous mode clock, so do serial communications with the UART is 
difficult then, since the internal RC oscillator is not stable enough for 
reliable UART communication (unless continuous runtime calibration is 
performed).

How can significant power savings into the micro-amp range be achieved with the 
ATmega328P's capabilities, and specifically the current Arduino hardware 
platform that has no 32.768 kHz crystal?

Original comment by sky...@gmail.com on 16 Jun 2010 at 12:08

GoogleCodeExporter commented 9 years ago
For example an ATmega168 @16Mhz uses 10mA in active mode, and 2mA in idle mode.

So support for an idle sleep would be better than nothing.

Original comment by ldro...@gmail.com on 28 Sep 2010 at 7:15

GoogleCodeExporter commented 9 years ago

Original comment by dmel...@gmail.com on 20 Dec 2010 at 3:25

GoogleCodeExporter commented 9 years ago
I think some hardware tweak would be great in addition to sleep related 
software funcions. A jumper or configuration to disconnect the USB in the 
Arduino board circuitry if not needed, saving energy.

I've measured the current flowing in a simple sketch and got more than 100mA 
with all pins in input mode.Even if the avr was in deep sleep, probably the 
solution still would not be suitable for projects where low / ultra low 
consumption are mandatoy, because of the extra circuitry drain. 

With this tweak, we could do this kind of projet without installing the AVR in 
a custom board.

Original comment by ampbra...@gmail.com on 25 Jan 2012 at 8:49

GoogleCodeExporter commented 9 years ago
I did something very similar in the design of the Mosquino board (an Arduino 
variant specifically designed for low power operation) - the USB-serial 
converter is powered from Vusb rather than Vcc. It's that easy :-) The board 
uses the old FT232 converter, but the same should work on the Uno/etc.'s 
USB-serial solution. With this change and a more efficient LDO, sleep power 
consumption on the board is a few uA (most of that is due to a hardware RTC and 
other onboard features).

The current schematic for this board is at 
http://code.google.com/p/mosquino/source/browse/?repo=hardware#hg%2Fmain

CAVEAT: In the unpowered state (USB unplugged), driving the TX pin into the 
FT232 high will still consume current. This is probably true with the Uno 
converter too. For lowest power consumption with this fix, the user code should 
disable Serial when there is no PC attached.

Original comment by drmn...@gmail.com on 5 Apr 2012 at 2:51