# Using supercapacitor as backup for MCU

I have this project that requires some kind of backup power supply. and I am planning to use a 5V 4F super cap.

there are my questions:

1. I am planning to charge the cap with a diode and 100 ohm resistor to a 5V VCC (Good idea?). how can I connect the cap to the MCU. direct connection will not work because it will take some time for the cap to charge up.

2. Normally the circuit will consume 20mA, in power-off mode, it will use about 200uA, how long will this 4F cap last?

• +1 for the username (and also the interesting question). – Electrical Architect Jun 10 '16 at 18:17
• I have built these circuits before. The supercap is meant for back-up ONLY. At 200uA it will last a few days at most, depending on the dropout voltage of the MPU. The MPU will need to use a pin to control what the power source is, or use 2 low-leakage diodes. One for main power, the other to charge the super-cap. A P-Channel mosfet driven by an O.C. pin would provide full power to MPU when it wakes up. I am assuming the MPU stops working at 2 to 3 volts. Please provide more MPU details. – user105652 Jun 10 '16 at 18:24
• haha literally an ATMEGA 328 just asking casually for advice for project to use as his own backup power – KyranF Jun 10 '16 at 18:38
• If you aren't tied to that specific CPU and need longer sleep life, there are micros that take under 1 uA while asleep. – user_1818839 Jun 10 '16 at 19:02
• – Ayhan Jun 11 '16 at 8:29

Assuming ideal conditions i.e. no leakage current in capacitor and other parts of circuit.

Case 1: Your micro controller is running and drawing 20 mA. Lets assume your micro controller will work fine till voltage reaches 4V. However for atmega 328, you can make it run at even lower voltages if you choose to run it at a lower clock frequency.

Assuming 20 mA at 5V, your load resistance will be 5V/0.02A = 250 ohms

Here is complete theory in one image:

Initial Vo = 5V and final Vc = 4V. Solving for time gives 225 seconds.

It means, your micro-controller will keep functioning for another 225 seconds after you lose power, provided the capacitor was charged to 5V.

Case 2: Your micro-controller is in power off mode consuming 200 uA.

R = 25000 ohms.

Solving for time gives 6.25 hours.

This is the theoretical max time you are getting. Things can't get better than this unless you are planning to run your controller at a lower clock frequency.

Just for you reference, Atmega328 can run from 1.8V. For this you get a time between 17 minutes and 28.33 hours

These are theoretical values. Practical values will be even lesser due to leakage in your diode, capacitor itself and other circuit elements.

• It depends on the regulator, but I'd assume a constant current load in the absence of any better information. – Sean Houlihane Jun 10 '16 at 18:44

For the connection of the battery to the MCU's VCC pin, you can use a simple dual Diode "OR" with low-forward drop diodes. This will mean as VCC is lost, the cap still stop charging and the diode input for VCC will drop, but the diode input for Cap-> MCU's VCC will continue on until the discharge curve shown by Whiskeyjack reaches a critical point where the Atmega's brown-out detection circuit kicks in and it shuts down. You may want to check your settings fuses for the brown-out-detection voltage by the way, it's pretty important.

simulate this circuit – Schematic created using CircuitLab

Note: Part numbers for the diodes are just default values in the circuit maker thing. Find some 300-400mV forward drop diodes.

• Just about the same circuit I was thinking of. Schottky diodes will have less Vdrop, but tend to have a high leakage current. This may be a moot point with a 200uA idle current drain for the MPU. Maximum idle time before shutdown looks to be 1 day or less. – user105652 Jun 10 '16 at 18:54

To build your circuit, I would suggest using a super-capacitor charger IC. LTC makes great products, and something similar to the LTC4425 would serve you well. This will do a great job of super-capacitor management.

Also, 20mA is reasonably high current draw from a super-capacitor, so you have to watch out for ESR, or Equivalent Series Resistance. All real capacitors have a parasitic resistance inside them which is modeled into the circuit as in series. At 30 ohms and 20 mA, you will see a 0.6V drop, which is quite a waste. Be sure to find something in the 30mohm range.