I have a small circuit with a µC in it. Sometimes it can happen that the circuit looses the power connection, resulting in instantanious shutdown. I am looking now for a capacitor which provides me powe for a short time so that my µC can shut down correctly (the µC gets noticed when the main power is lost, so it can start its shutdown routines.
The capacitor has to provide power for maximum half a second only for the µC for writing the current data into its memory and afterwards shut down. The µC is an ATtiny, therefore it does not need so much power while kept alive.
Is using a 100 µF-cap enough for this task?
Additional Informations:
Voltage level: 3.3V
Supply current: max. 300 µA

Regarding the questions, how to detect the power loss: The circuit is connected to two different power sources, one of them running at 32 V, and the other at 3.3 V (µC circuit). If there is a power loss, both circuits loose power at once, so I can test the 32 V circuit for power loss.

  • 2
    \$\begingroup\$ How much current does the device use when shutting down, and what are the supply and BOR voltages? \$\endgroup\$ – Ignacio Vazquez-Abrams Jan 29 '15 at 14:56
  • \$\begingroup\$ Added the informations, the device afaik uses no BOR. \$\endgroup\$ – arc_lupus Jan 29 '15 at 15:11
  • 1
    \$\begingroup\$ How are you detecting a loss of power? \$\endgroup\$ – scld Jan 29 '15 at 15:19
  • \$\begingroup\$ @scld: Did not think about that now, but I assume via a Schmitt-Trigger (seems like the best way for me) \$\endgroup\$ – arc_lupus Jan 29 '15 at 15:19
  • 1
    \$\begingroup\$ @arc_lupus If you have a cap backing up your power, then there will be no 'visible' voltage drop when power is disabled. So, your trigger should have a separate power source. \$\endgroup\$ – Nazar Jan 29 '15 at 15:22

Do the math instead of asking us. (300 µA)(500 ms)/(100 µF) = 1.5 V. Can the microcontroller and whatever else it needs to do the shutdown still run from 1.8 V. If no, then your 100 uF cap is clearly inadequate.

However, instead of trying to hold up a regulated supply after the regulator, it is usually better to hold up the supply into the regulator. That way the voltage the micro is running from will be constant during the shutdown period. For example, if the 3.3 V supply is made by a buck regulator from the 32 V supply, then a diode followed by the holdup cap on the input of this buck regulator would do it.

You need (3.3 V)(300 µA)(500 ms) = 500 µJ. Lets say you need twice that on the input of the buck switcher to be conservative, so 1 mJ. Let's say the buck switcher needs 5 V minimum. To see where we're at, let's see how much energy a simple 10 µF ceramic cap can provide dropping from 32 V to 5 V. (32 V)²(10 µF)/2 = 5.12 mJ and (5 V)²(10 µF)/2 = 125 µJ, so the energy available from a 10 µF cap is 5 mJ. That's 5 times more than we conservatively estimated is required. In theory that means a 2 µF cap would do it, but ceramic caps are usually ±20%, and you're not going to save anything by using 2 µF instead of 10 µF. Note that it needs to be good to 35 V.


Scld made a good point in a comment that should be mentioned here. The calculations above assume the voltage drops from 32 V to 5 V during the backup power period. However, this only starts after the input voltage has already dropped some. You need to do the energy calculation starting with whatever voltage threshold you are using to detect that input power has dropped out. The energy in a capacitor is proportional to the square of the voltage, so at 1/2 voltage there is only 1/4 the energy available.

It looks like the 10 µF in the example above would still work for reasonable threshold votlages. Let's say you use 24 V as the threshold to detect input power lost. (24 V)²(10 µF)/2 = 2.9 mJ, leaving about 2.8 mJ available down to 5 V. That's still a good margin above the 1 mJ we decided was needed on the input of the buck regulator, so that's fine. Note however, that this also shows 10 µF is not enough if the power-out detection threshold is significantly lower. Keep in mind that the starting voltage you use for these caclulations is the lowest is could be worst case with all tolerances taken into account, and after the diode from the main 32 V supply.

Another point is that there would almost certainly be at least 10 µF on the input of the switcher anyway. If you set the power-out detection threshold appropriately, you may not need to add any parts at all.

|improve this answer|||||
  • \$\begingroup\$ That's a good idea, using a cap like this. Thanks! \$\endgroup\$ – arc_lupus Jan 29 '15 at 15:51
  • \$\begingroup\$ @arc_lupus make sure that you are calculating backup power not just from the 32V level, but from the level that triggers a "power bad" condition. If you're setting that level to 16V (for example), your backup power will be 1/4th what you're estimating with 32V. \$\endgroup\$ – scld Jan 29 '15 at 15:56
  • \$\begingroup\$ @scld: Does it matter if the backup power is bigger than needed? \$\endgroup\$ – arc_lupus Jan 29 '15 at 15:57
  • \$\begingroup\$ No, as long as your code stops processing data after that last write, which I assume it will or else you'd defeat your own purpose. Too much backup power is only a minor concern in terms of cost (not relevant here). As long as you properly set your low power detection circuit level you'll be fine with Olin's advice. \$\endgroup\$ – scld Jan 29 '15 at 16:01
  • \$\begingroup\$ @scld: Good point. I have added it to the answer. \$\endgroup\$ – Olin Lathrop Jan 29 '15 at 16:13

You need to know how much current your circuit draws. This way you can calculate how much charge you need for a 0.5 second period. Then you need to know your minimum power supply voltage tolerance (let's say it's 2.8V). This means that your cap should drop no lower than 2.8V after 0.5 second.

i = C (dV/dt),

so if your power voltage is 3.3V and you can afford voltage drop down to 2.8V your dV/dt is (3.3-2.8)/0.5 = 1 V/s.

Let's say your circuit draws about 100mA, this way, C= i / 1V/s. So, 0.1A / 1V/s = 0.1F which is 100 mili Farades.

*this assumes that the current is constant

You need to revise this calculations.

|improve this answer|||||
  • \$\begingroup\$ After my current draws around 500 µA (maximum) after my first calculation, I think a 200 µF cap should be enough. \$\endgroup\$ – arc_lupus Jan 29 '15 at 15:20
  • \$\begingroup\$ It's easy to make the circuit and measure the voltage/time curve - practical results worth more. \$\endgroup\$ – Nazar Jan 29 '15 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.