NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Basic Electronics » Save state data to EEPROM with power cutoff capacitor value?
May 20, 2011 by gcharris |
I'm looking to build an power cutoff state saver for a project. Basically when the atmega power is cut off this will be trigger an interrupt that will save some state data to eeprom. What do you guys think would be a sufficient value capacitor to power the atmega for long enough to write a few values to eeprom (three double values and an int)? |
---|---|
May 20, 2011 by gcharris |
I'm guessing I should also have a diode to stop the capacitor from powering other non-processor loads. Any suggestions on a type? |
May 20, 2011 by Hexorg |
Well the current to the uC will be too small to damage any diode, so any regular diode should do. it's the capacitor I worry about. Let's see... ATmega168's power consumption is about 250mA at 5V... That's 250mA*5V = 1.25mW of power. That means that it will use 1.25mJ per second. Energy stored on a capacitor is:
So 1.25mJ = 1/2 * C * V2, and we know that V is 5.0V, making
You'll probably have to connect 2 47uF electrolytic capacitors in parallel to get 94uF capacitance. Also, as soon as you detect that the power has been cut off, first thing you should do is set all the pins as inputs. That will cut off any leaking power. From there one second should be enough to save everything. Once that works, you can find out how much exactly it takes to cut off all the pins, and save the data, and from there you should be able to recalculate needed capacitor value to provide you with enough power. But remember, capacitor's charge should still be well above the brown-out voltage, otherwise uC will turn off. |
May 24, 2011 by gcharris |
Thanks! I'll keep you posted on my progress. |
Please log in to post a reply.
Did you know that our USB NerdKit comes with everything you need to get started with microcontrollers? Learn more...
|