You calculate it thus:
Realize the capacitor is there to control the supply impedance.
You have three constraints on impedance:
1. Stability: for the regulator
2. Dynamics: if you have a peaky load, will it under/overshoot an excessive amount?
3. Inrush: the input should be well damped and/or clamped, so that if someone hot-plugs the DC adapter, nothing blows up.
- Stability is simple enough, but hard to quantify, because they don't ever draw stability diagrams for regulator inputs. They rarely draw them for outputs, as it is (usually in terms of ESR vs. C, for LDOs that are susceptible to instability, but absence of such a diagram is not evidence for absence of instability -- most are just lazy!). Let's say you should have an impedance that is below, say, 10 ohms, and dominant resistive or capacitive, with no crazy peaks. This is most likely to behave, and be representative of the regulator's intended environment.
- Dynamics are easier, because we can put numbers here. A 78L05 delivers maximum 100mA, so let's say the maximum step load change is 100mA. This step must not cause dropout (rising current step) or overvoltage (falling current step). A typical case might be 1V of allowable ripple, in which case you get a 10 ohm equivalent. Any lower impedance will do.
- Inrush works similarly, but instead of a current step, we assume a voltage step, at the adapter's open circuit voltage. Consider the typical adapter: a transformer, rectifier and electrolytic capacitors, then ~2m of cable (usually twin lead, Zo ~ 100 ohms). OCV is typically 1.5 times nameplate (they have pretty awful regulation). The input voltage step causes a voltage and current hump, with the cable having equivalent inductance, and the two capacitors (one inside the adapter, one on your device) acting in series. This is a simple RLC series resonant circuit.
In any case, the main offender is the cable: it has equivalent inductance, so dominates the impedance above a few kHz. How much inductance? If Zo ~ 100 ohms, that's about a third the impedance of free space (377 ohms, but I'm rounding down to account for dielectric constant), so the inductance is about a third of mu_0, or (1.257) / 3 ~= 0.4 uH/m. So a two meter cable is 0.8uH. A simple transmission line argument, reduced to the simplest of ratios.
The adapter will probably be on the order of 1000uF and 0.1 ohm ESR. Unless you need a large capacitor (>100uF), we can assume this is a Thevenin voltage source with OCV and ESR as given.
Inrush is probably the most stringent of the three conditions. But it can be assisted with a TVS (say a P6KE18A or SMAJ18A, which clamps the overshoot at 20-25V, well within the 78L05's capability), so we don't need to design to it, necessarily.
If we do: we need C large enough that sqrt(L/C) is smaller than total ESR.
Suppose we use 1uF ceramic, with ESR ~ 0.1 ohm. Z = sqrt((0.8 ) / (1)) is about 1 ohm, which is 10 times ESR, so will ring like a motherfucker. What's worse, it won't merely ring up to twice the input (~36V), but it will overshoot considerably more, due to ceramic capacitor saturation (maybe 60V or more!). We could clamp this with a TVS, but we still have the problem that the impedance peak is ~10 ohms at the resonant frequency (which, really, may not be a problem, given the assumptions mentioned earlier).
We might then add 4.7uF in parallel with this, with a 1 ohm series resistor, to dampen the network. (Or an electrolytic with the same parameters, but you can't find an electrolytic with stable ESR, so it's not the best.) Overshoot still sucks (need TVS), but all the dynamics are satisfied: the impedance is capacitive above ~180kHz, and the peak impedance is about 1 ohm.
If we go with electrolytic alone, we'll expect to find a part with ESR > 0.2 ohms in smaller values. Plus the adapter's ESR, we need to find C such that: 0.3 ohm <= sqrt((0.8uH) / C). Chug chug chug, and we see 10uF or more will do.
When C is relatively large, the supply voltage comes up relatively quickly (most of the charging current is dropped across the ESR), and doesn't overshoot, but just kind of whumps up to its normal value. I might go with 47uF just because it's a little bigger... safer, maybe?
Note that peak currents are tremendous here! An 18V supply into 10uF 0.3 ohm is a peak current around 60A, if only for a few microseconds! You don't want to route this through any semiconductors, if you can help it.
You can still use a TVS, though it won't save you much at this point -- if someone plugs in a reverse polarity or excessively high voltage adapter, the TVS is toast, and the device is simply dead. A series diode addresses reverse polarity; overvoltage might be better treated with a crowbar (a SIDAC, perhaps?) and polyfuse. This is really only needed for higher level foolproofing where product reliability is paramount.
Tim