Is there a nice rule/formula for this or do we always need to go off of the datasheet? I read today (in a datasheet, no less) that the capacitance should be customized for a given application (no further explanation provided), and I was also told that added caps are not required if the input voltage is stable.
There are basically 2 types of capacitors around a voltage regulator:
- relatively small ones (order of 100's nf): These are required to get the regulator stable, to let it properly do its job, to prevent it from oscillating and are always mentioned in the datasheet.
- relatively big ones (order of 100's μF): These are to reduce ripple at the input of the controller. This ripple is visualized in the image below. (Ripple@Wikipedia) Rule of thumb is 2200-4700μF per ampère output current at 50Hz. The idea of these capacitors is to prevent the rectified input voltage from the transformer to drop below the minimum input voltage of the regulator. In case of a LM78xx-like regulator input voltage must always be some 3V higher than its output voltage.
It is also good to notice that a single big electrolytic capacitor cannot replace the smaller capacitor from the datasheet (unless the datasheet states otherwise). The smaller capacitors have a much better high frequency response than the ecap and therefore you want them both.
Beware not to make output capacity too large: Most regulators don't like it when output voltage (due to a charged output capacitor) is higher than its input voltage (due to a switched off transformer). Some datasheets do mention a maximum output capacitance. This is why you sometimes see a reversed diode across the regulators in and output pins.
Those capacitors are part of the regulator's control loop to keep it from oscillating. You can't say what values they have to be without knowing the exact details of the regulator's internals. Just follow the advice given in the datasheet, they usually will give you a fixed value (I've never seen this being written as to be customized for the application). Not just capacitance, keep an eye on ESR (Equivalent Series Resistance) too if that's mentioned.
Even if you would use a large electrolytic capacitor on the input place the 100 nF ceramic if the datasheet says so. By the way, there's no limit to the capacitance on the input. You can feed the regulator from another regulator's output, and that's equivalent to an infinite capacitance.
Determining the stability of a linear regulator is a non-trivial task at the best of times.
You get some indication by directly scoping the output and applying a step load (looking at the response) but can you guarantee stability over all conditions?
The compensation is often internal and inaccessible, so conventional methods of stability analysis (voltage injection combined with gain/phase measurements from a frequency response analyzer) cannot be used.
The only alternative is to measure the output impedance and mathematically calculate the phase margin based on the measured group delay (from which you can derive Q, from which you can estimate phase margin to within a few percent).
If the manufacturer recommends certain values, go with them! If not, you may need to do a lot of empirical 'change-test' iterations to find something that appears stable, or bite the bullet and buy/rent some sophisticated test equipment to prove stability.
What capacitance should be added over the inputs and outputs of a voltage regulator? Is there a nice rule/formula for this or do we always need to go off of the datasheet?
There IS a nice rule/formula - it is that you MUST use the datasheet unless you are a Jedi Master and/or blackbelt electronicianado. The former can stop oscillations occurring by using the force. The latter has learned by heart* the characteristics of all known regulators and many unknown ones.
The reason is that regulator implementations vary and requirements vary and if you do not know the characteristics of the one you have then an answer that is ideal for one can be fatally bad for another.
Some regulators are unconditionally stable regardless of output capacitance.
Some regulators are unconditionally stable with output capacitance above a certain value.
Some regulators are unconditionally stable if the output capacitance is above some specific value and below some other specified value AND if output cap ESR is above a certain value and below some other specified value.Notice how bounded this is - on an ESR - capacitance plot the safe operating area is a rectangle with unstable areas around it in every direction.
Input capacitor is usually mostly about getting a half low input impedance but lack of one or enough can lead to instability.
What sort of regulator are you using.
I read today (in a datasheet, no less) that the capacitance should be customized for a given application (no further explanation provided), and I was also told that added caps are not required if the input voltage is stable.
The latter could be correct for some regulators. The former should be qualified somewhere - ie HOW stable does it need to be.
In the good old days when the LM7805 was king the output capacitor was largely to supply fast surge current or to provide temporary peak current in excess of the regulator's capability. You could add as much more as you sensibly wanted to. Those days have largely gone. Cout is now often as much a part of loop stability as about filtering per se. There is now usually no right limit above which all will be well - only a right range that must be stayed within. SOME modern regulators do not have this requirement. In exchange for the tighter requirements you often get much better specs.
*- Learned by heart = English expression = knows and can recall perfectly.