Go Down

Topic: Simple backup power (Read 686 times) previous topic - next topic

perkunas

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

robtillaart


places the settings in EEPROM and read them at startup?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

perkunas

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.

perkunas

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

robtillaart

Quote
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.

Code: [Select]


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.


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Arty

#5
Dec 21, 2012, 02:35 pm Last Edit: Dec 21, 2012, 02:39 pm by Arty Reason: 1
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? ;)

johncc

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

Cheers,
John

Jack Christensen

What are the power requirements? Volts, amps ...
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

johncc


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


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

Go Up