Saving power with arduino

I am building a "universal remote" with arduino. Basicaly it is not realy universal remote. It is a simple compact device that I can put on a table and with push of a button an turn on the projector and speakers, control the volume and temperture in the room. The whole thing isn't realy complicated to make - but the is one problem. I want this to be battery powered.

I found three ways to do this:
1.) Simple swich that turns the power on/off.
2.) Relay that does the same as the switch but can be controlled with a pushbutton - But in principle it is the same thing as before.
3.) Put aruino to sleep when not in use. This sounds good in theory but there are problems - like Atmega 168 with 16MHz crystal... I want this to be powered with something like 9V battery so I need the powe regulator which if I hear things correctly needs a lot of power (around 10mA). And if I calculated this correctly only the regulator would work on a battery around 8 days - which is too little. Another problem is that when I was testing with duemillanove board it actualy uses 27mA when powerd on and in sleep (it actualy goes to about 25mA here) (I put it to sleep with this: Arduino Playground - ArduinoSleepCode ). And I have no idea why - probably because of the voltage regulator and the power LED. I wouldnt implement the power LED on my custom board but I would still have the voltage regulator.

I need ideas how to get around 1 month of battery life from it.

Try Narcoleptic - Google Code Archive - Long-term storage for Google Code Project Hosting.

Why a 9V battery? Why not use 4 AA's? I believe 9Vs tend to have a few hundred mA-H of capacity while AAs are on the order of 2000-2500 (at least the rechargeable I have on my desk are that high.)

Electronics tend to use 9V because of the need for the higher voltage (such as audio equipment) not because of it is capacity.

Go with the AAs and you get significantly more capacity and do not need a regulator (unless some other part of the design needs >6V).

Why 4 AA batteries? Wouldn't 3 be better? 4 Is 6V which as far as I know is too much.

Have a look at the following links:

http://interface.khm.de/index.php/lab/experiments/sleep_watchdog_battery/
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1273507808
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1281416433/2

Udo

With narcoleptic it still uses 8mA. Which is quite good but it could be better. I don't have any LEDs turned on. The only things consuming power are an IR reciever (but since I am not using it the consuption should be around 0), Atmega and that is about it. There are a few capacitors and a resistors (those are active only when someone actualy pushes the button). So it is still a little too much. If I am using three AA batteries this should still give me about a month of operation shouldn't it?

What about the regulator and the serial interface? That is: do you use a barebones chip or do you run a standard Arduino?

Udo

My own PCB design. So I don't have a regulator (well I have it so I can choose between battery power (it is bypassed) and external power source). And I am not using serial interface at all.

If it is your own design, the first step would be to lower the crystal to 8MHz and thus lower the voltage. That is you could then run it reliably with 3 AA Batteries without a regulator.

The next step would be to double check your code. 8mA implies that the chip is not sleeping to much.

For further help we would need to see you code.

Udo

Hmmm I don't know if changing the crystal to 8MHz would work. IR emitter library probaby only works with 16MHz crystals.

And here is the code - too simple actualy:

#include <IRremote.h>
#include <Narcoleptic.h>

//int RECV_PIN = 11;

//IRrecv irrecv(RECV_PIN);

//decode_results results;


IRsend irsend;

void setup()
{
 // irrecv.enableIRIn(); // Start the receiver
  
  
  pinMode(2, INPUT);
}

void loop() {
  
  /*if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    Serial.println(results.bits);
    irrecv.resume(); // Receive the next value
  }*/
  
  
  Narcoleptic.delay(500);
  
  
  if (digitalRead(17) == HIGH)
  {    
      irsend.sendNEC(0xB14E00FF, 32);
      delay(100);
  }
  
  if (digitalRead(16) == HIGH)
  {    
      irsend.sendNEC(0x807F20DF, 32);
      delay(3500);
      irsend.sendNEC(0x807FC837, 32);
      delay(100);
      
  }
  
  if (digitalRead(15) == HIGH)
  {    
      irsend.sendNEC(0x807F609F, 32);
      delay(100);
  }
  
  if (digitalRead(14) == HIGH)
  {    
      irsend.sendNEC(0x807FA05F, 32);
      delay(100);
  }
  
  
  if (digitalRead(2) == HIGH)
  {    
      irsend.sendNEC(0xB14E00FF, 32);
      delay(100);
      
      irsend.sendNEC(0x807F20DF, 32);
      delay(3500);
      irsend.sendNEC(0x807FC837, 32);
      delay(100);
      
      irsend.sendNEC(0x807F609F, 32);
      delay(100);
      
      irsend.sendNEC(0x807F609F, 32);
      delay(100);
      
      irsend.sendNEC(0x807F609F, 32);
      delay(100);
  }
  
  
}

Hmmm I don't know if changing the crystal to 8MHz would work. IR emitter library probaby only works with 16MHz crystals.

You might be surprised. I'm working on an Arduino clone with an integrated TI TLC5940 and it runs at 8Mhz (basically it's a lilypad).

So far everything I've thrown at it has worked without too much problems (tinygps, servo, TLC5940). No guarantee but worth a try.

I think for real power savings you'll have to slow things way down.

Brad.

For your application Narcoleptic is the wrong approach. Basically your application could sleep in power down mode almost all of the time. The proper approach is:

  1. Use 8MHz and 3 AA Batteries to get rid of a regulator
  2. Setup pin change interrupts for the pins you are looking at (in order to wakeup the CPU)
  3. Instead of using Narcoleptic in your main loop just set the CPU to powerdown and make it sleep

This should easily get down your standby current consumption to <<10uA.

Even the playground example provides enough details for this.

Udo

I would use that but I think that interrupts don't work on analog pins. I know that pins 2 and 3 are the real interrupts and that there is some additional interrupt library - but don't know if it actualy supports any other pins.

Interrupts work on all pins. INT0,1,2 are tied to some specific pins. PCINT works for all pins. Why would you use an analog pin anyway? I thought you want to read one button?

Udo

I want to read five buttons. And I have them connected on analog inputs just because it was easier to design a PCB that way. And since digitalRead still works...

So you use the analog pins as digital inputs --> PCINT works.

Udo