theace:
Krupski: thanks about all those useful information. I do know about turning off all those modules in the processor (ADC, brown out, etc) and about the pins, but my concern is about the rest of the components on the board that can draw power.
As I said, I power my arduino mega straight through the 5V pin, so the voltage regulator is bypassed. The power led is known to draw power (I will remove it in the future). But what else is drawing that current (~18mA)?
I read different topics and the suspect might be the USB chip (ATmega16U2) that draws power regardless of the board being connected to the USB or not. This is the thing that I would want to disable, but I don’t know a reliable way. Could it be via software (modified firmware to do some sleeps), or hardware (cutting some wires or removing some components like suggesting here: http://forum.arduino.cc/index.php?topic=179013.0).
I though about making my own board, but I don’t have all the means and time to do it and, also, the ATmega2560 chip has a lot of small pins and is difficult to solder it. So I though that I could go with a normal Arduino mega 2560 and strip some of it’s parts + good sleep code to go to a 1-2mA range maximum.
Depends on what you want to do. Maybe a 328P or even an ATTiny would be enough? How many I/O pins and interrupts do you need?
By the way, 1 to 2mA in sleep in completely unacceptable. You should be able to get down into the NANOAMPS range (which is essential if you want to build a battery powered device). 1 to 2 mA will suck a battery pack dead in less than a week.
I made a nice multi function “code learning” IR remote with an RGB status indicator LED, an IR emitter, an IR detector, a piezo beeper, a 3X4 keypad and two pushbuttons using an ATTiny2313 with room, ports and interrupts to spare.
In sleep (fully powered down) mode, it doesn’t draw enough to register on my DVM which has at the lowest setting a 0-1.999 milliamp current range. All it shows is 0.000
I’ve been thinking about powering the board through a resistor and measure the voltage drop across it to try and determine the sleep mode current. I’ll have to probably take into account the input impedance of the meter (10 megohm)!
By the way, please see this link: AVR POWER SAVING
This is a link to Nick Gammon’s excellent website, the AVR power save discussion section. It has all the info you will ever need. By the way, do yourself a favor and look over the rest of his site… TONS of great info there.
Some of the info (red highlight by me):
Summary of methods
Use as many of the techniques listed here as are practical in your application. They are described in further detail below.
-
Run the processor at a lower frequency
-
Run the processor at a lower voltage
-
Turn off unneeded internal modules in software (eg. SPI, I2C, Serial, ADC)
-
Turn off brownout detection
-
Turn off the Analog-to-Digital converter (ADC)
-
Turn off the watchdog timer
-
Put the processor to sleep
-
Don’t use inefficient voltage regulators - if possible run directly from batteries
-
Don’t use power-hungry displays (eg. indicator LEDs, backlit LCDs)
-
Arrange to wake the processor from sleep only when needed
-
Turn off (with a MOSFET) external devices (eg. SD cards, temperature sensors) until needed
In regards to the suggestion “Run at a lower frequency”, if you don’t need full clock speed you can programmaticly change your clock speed. You can divide the main F_CPU by any power of 2 from 1 to 256 using the clock prescale function (part of the AVR library, not an Arduino command) - like this:
[b]
clock_prescale_set (clock_div_n);[/b]
…where the parameter is “[b]clock_div_1[/b]
” thru “[b]clock_div_256[/b]
” (that is, 1, 2, 4,…64, 128, 256).
To make sure your timing loops work properly, do code like this at the start of your program:
#include <avr/power.h> // may be needed
#undef F_CPU
#define F_CPU (16000000UL/2)
clock_prescale_set (clock_div_2);
Of course, the F_CPU/n and clock_div_n must match. If you do “[b]16000000UL/[color=red]8[/color][/b]
” for example, then you need “[b]clock_div_[color=red]8[/color][/b]
” obviously.
Good luck!