Simple backup power

I was wondering if any of you guys have any simple back up power ideas
I don't like loosing all my settings when the power goes out, I was thinking like a 9v battery.
Guess I need diodes so it it wont get over charged, maybe there is a kit I don't know about.
Thanks

places the settings in EEPROM and read them at startup?

Well I guess the settings I'm referring to, is the program runs various things 14 plus days, depending on how long some things take. Then the whole thing loops and starts over.I suppose I can store it at what point it was at, in eprom then on startup it can start at that point, but that sure sounds super complicated.

Oh ya, then if you wanted to start it at the beginning instead of at your saved point wow more complicated stuff.

I can store it at what point it was at, in eprom then on startup it can start at that point, but that sure sounds super complicated.

Depends on the complexity of the algorithm itself. If your program is essentially a loop that have e.g. 10 variables that change during one iteration of the loop you can simply add some logic to store those ten vars every 2 hour to eeprom. In setup they are read from EEPROM.

void setup()
{
  ...
  readStateFromEeprom(...);
}
void loop()
{
  if (millis() - lastStore > 2L * 60L * 60L *1000L)
  {
    lastStor = millis();
    saveStateToEeprom(.....);
  }
  // rest of your code

to make it really fail safe you need to have at least 2 sets of variables in EEPROM including timestamp and a checkbyte to see it the written set is not corrupted due to a blackout during the save.

Just don't forget that EEPROM has limited write cycles. I would use RTC with nvram and 3v battery. This way you could store the values every time as they change. If you google you will find how-tos about hooking up RTC to arduino. And you also get the clock - how cool is that? :wink:

I have sometimes used a 12V lawnmower or motorcyle battery with a Harbor Freight trickle charger ($5).

Cheers,
John

What are the power requirements? Volts, amps ...

In my case it was 7-12V and about 150ma. Don't know about the OP.