Supercap in voltage regulator to obtain residual power?

I'd like to have a circuit that provides a few seconds of power to an ATTiny circuit after the main power is removed. Using a simple 7805 voltage regulator circuit as an example (below), can I add a super capacitor somewhere into that circuit to do this. Eg in the output stage? Across + and -? The idea being that 12V would be supplied to the regulator input, when 12V is removed the supercap would kick in and provide a few moments residual power before the circuit shuts off?

See reason for not doing that. High output capacitance can cause damage when regulator input drops lower then output voltage. Bypass diode can protect possible damage mechanism, but would also discharge the 'super cap' faster.

http://arduino.cc/forum/index.php/topic,70322.new.html#new

We have a suggested circuit here:

http://ruggedcircuits.com/html/circuit__13.html

You can also put the supercap on the input side of the regulator as long as it can handle the voltage (many low-cost supercaps are only good to 5V or even lower).

I wouldn't worry too much about backfeeding current through the regulator in your case because you have a blocking diode to the power supply.

--
The Basic Motor Driver: simple, inexpensive motor driver for 1 stepper motor or 2 DC motors

If you add capacitance to the output of the regulator you need a diode from in to out on the regulator. If the input is shorted even 25uF is enough to damage the regulator. The output of the regulator does not sink current so if output is greater than input you can damage the regulator without a diode. Unfortunately, as retolefy said, it will discharge the supercap (through the diode and into the input of the regulator).

If you add the supercap to the input it will safely power the regulator.
The diode, as shown in the 7805 crt. will only protect reverse input voltage.

What about putting the supercap on the output and having a transistor/relay (powered by the input) disconnect the supercap from the regulator when power is removed?

Thanks for the tips everyone..

I use a setup like below to help protect my 5v servo chip from power dips when the servos move. You could do something similar with a super cap in place of the 10uf cap. Been working for ~6 years.

That seems nicer. You could use a variable regulator if 5V - the diode drop is not enough for crt. but the ATtiny (0 to 10MHz min.) will be happy enough with that.
What is the diode on the regulator gnd for?

What is the diode on the regulator gnd for?

It causes the 7805 output to change from 5v to 5.7v due to the .7v voltage drop across the diode. The 5.7v output is dropped back to 5v due to the same voltage drop across the second diode. The second diode also prevents the 10uf capacitor from being discharged back into the servos when supply voltage drops.

Right. Thanks.
Very nice!