Electronics > Beginners
Writing EEPROM, sudden battery loss, capacitor keep-alive calculation?
(1/6) > >>
jnz:
This is a bit of a basic question, but I realized I've never had to learn this topic.

I have a 12V to 5V LDO regulator. A micro that may be writing it's EEPROM when the power shuts off. The datasheet makes note to make sure you have enough powder to keep the micro alive until it's done writing a block. I figure this to be about 2ms or so.

I could use a battery, but cost isn't ideal, plus I'd need some extra components to switch to/off that, plus it's a 5V system which isn't great for battery. My enclosure is extremely height limited, so adding a large electrolytic won't work. But there are other types of caps that might.


* I don't know the size of capacitor that would keep the system at 5V 50mA alive for 2ms.  Is there a calculation for this?
* And I can't fit an electrolytic... so would a tantalum work? I can fit that as a chip style in 100uF but not sure if it would give the desired results.
* Is it more desirable to "buffer" the 12V side or the 5V side? I think the 5V because I wouldn't incure losses from the LDO, but if I put too much capacitance on the 5V side my chip may start up slower/goofier, right?


german77:
You need to know the lowest operating voltage of your micro to calculate the capacitor size. And yes there are equations for this.

For example lets say you put the capacitor on the 12v side. the micro will work until the voltage reaches 6.2v. Assuming that you draw 50mA all the time you use this equation.
v(t)=-(1/C)It+v(0)

Changing the values that we already know.
6.2v=-(1/C)50mA 2ms + 12v
we got
1/58000=C= 17uf

On the 5v side and the minimum is 4v you will get a capacitance of 100uf. and it's indeed a bigger capacity. If space is an issue you already know where to put that capacitor.
mariush:
Your problem is a bit more complicated.
Capacitors don't behave like batteries,as you take energy out of the the voltage drops quickly, so you need to be aware also of the minimum voltage your microcontroller will need to actually operate at some frequency and the minimum voltage required for eeprom to be written to. For example, your micro may need 4v or more to run at 16 mhz, 3.3v or more to run at 12mhz or higher and so on ...  If you have your micro configured at some high frequency and your voltage drops, your micro may become unstable or shut down even though voltage may still be high enough

With a 100uF your voltage may be 5v initially but drop down to 2v at the end of 2 ms - I don't know, I didn't do the math .. would that be enough to keep the micro running and writing to eeprom? I don't know.

keep in mind that, depending on how often you need to write to memory and how much power your micro uses, you'd may also need to monitor the input voltage somehow and detect if you have a power loss or something. If your capacitor is too big, your micro may idle for minutes consuming uA of current still operating as the voltage does down towards the minimum the micro runs at.

either way, i'd avoid tantalum... also don't forget that some ldos are really picky about output capacitors, for example the 1117 series of LDOs want a capacitor with esr between 0.1 ohm and 1 ohm - some ceramic and tantalum capacitors can have esr below 0.1 ohm and then your regulator could oscillate in some conditions.
There are polymer capacitors that have same size as electrolytic but have much bigger capacitance and there's also supercapacitors , for example 0.1F at 5.5v in 11.5mm : elna dx series 0.1f 5.5v
jnz:
My height requirement is ~4mm.

The ARM micro claims it's operating range is 1.8V to 5V over all frequencies. It also has brownout detection at 2.25V that I'll certainly use. I looked for supercaps, but too expensive and too large. Even the smallest 5V I found was unlikely to work.

German77, I'm a little confused at that calculation. Do you think you can break it down for in a couple more steps? Obviously 100uF is 0.0001000 and 2ms is .002, but I must be doing something wrong because I'm not getting 1/58000 anytime. I am definitely missing something because the "I already know where to put it" is definitely lost on me. I think you're saying before the LDO I need 17uF because I can tolerate a larger swing from 12V to 6V and on the 5V side if I only had 1V I'd need a much larger storage. The difference here being I could go with a smaller/cheaper 10V cap on the 5V side and on the 12V side I'd need something like a 20V+ part.

... While I'm still trying to figure out the above... What happens if I have caps on both sides? I need to wait for the supply side to the LDO to drop below 6V which is when it'll cut out so then the 5V side would start it's drain - right? In this case I might be able to split the difference between size / type / cost of parts.

Momchilo:

--- Quote from: jnz on October 11, 2018, 11:13:25 pm ---Do you think you can break it down for in a couple more steps? Obviously 100uF is 0.0001000 and 2ms is .002, but I must be doing something wrong because I'm not getting 1/58000 anytime.
--- End quote ---

6.2V=-(1/C)*50mA*2ms+12V
-5.8V=-(1/C)*100µAs
-58000V/As=-(1/C)
1/58000As/V=C
C=17.24µF

I hope that helps a little bit.
Navigation
Message Index
Next page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod