Introduction.
Whenever you need to power electronic stuff you need a constant voltage source. Circuits are specified to work for certain supply voltages, for example 5 volts plus or minus 10%. Circuits also like to draw different amounts of current depending on what they're doing, and that's bad for the power supply, who must struggle to keep a constant voltage output as the current demand from its load varies in time. So what happens if the power supply is suddenly required to provide more current for, let's say, a processor that's waking up from sleep and starting to do some work. Or a light or motor or something. It's bad. It can't keep the voltage constant. The voltage will drop for a very short time until the supply can sense that through its feedback loop and stabilize it. If it drops more than 10% or whatever the design margin is, the circuits might malfunction. When the circuit is done working and reduces its current demand, the opposite thing can happen and the supply voltage overshoots for a short amount of time. It it overshoots too high, the load circuit is fried.
So how can we fix this? Well, it's very simple in theory. Don't change the load current abruptly, so the supply has time to follow it and compensate for its change and mantain constant voltage output. The simplest way to do that is to throw a capacitor across the load. If the supply is slow to respond, the difference in current will come out of the capacitor instead of the supply, and the voltage variation will be much lower and everyone's happy.
Because the supply voltage is now constant, it means that various modules can't talk to each other through the supply wires (which would be bad), so they're being decoupled. That's why they're called (supply) decoupling capacitors.
My Problem.
People have always recommended using many small ceramic capacitor near integrated circuits and a few big electrolytic capacitors. The idea is that ceramics take care of the higher frequencies (rapid current variations), while the electrolytics deal with the lower ones. For a long time I've been wanting to actually test the effect of different kinds of capacitors on a power supply that's required to quickly switch between two values of current. Now I decided it was finally time to do that.
So I took a piece of copper-clad board and cut some trenches in the copper, isolating two big islands for the power and ground nodes where the action takes place, and some small islands for the other voltages. I soldered a good-old 7805 voltage regulator with capacitors on the input but not on the output, and a genric transistor that would suck a little bit less than 100mA when turned on by a signal generator. Some ports for the control signal, oscilloscope and raw power input, some very tight construction to avoid "parasitic inductance and capacitance", and it was ready. So here's the schematic:

So here is how the regulated voltage (that's supposed to be constant) looks like when current is switched on and off.
First, with no capacitor at all:

Here you can see a zoom-in on the negative spike:

So I soldered in a 4.7 uF (microfarad) electrolytic capacitor, rated for 63V, and here is what I got:

Then I did something horrible. I desoldered the capacitor, which was soldered close to the board, and put in a new one, holding it with my fingers. Its leads were about 1 inch long, which is supposed to be a big no-no: long leads means inductance, which slows down "reaction time" and prevents the capacitor from absorbing rapid current variations, leading to the voltage spike you saw in the first picture. But it was not the case:

Next I connected a 10uF, 16V tantalum capacitor. That's supposed to have a better frequency response than the usual electrolytics, as well as lower ESR (effective series resistance) - the stuff that limits how well it can filter spikes (think voltage drop over the ESR caused by the current you draw from the capacitor). It looks a little better:

Here's a 22uF, 25V electrolytic with short leads (it's 20mV/div as before):

On all the pictures you can see the command signal feedthrough: when it goes down, the current is shut down and the voltage goes up temporarilly. But before the current is shut down and the voltage goes up, you can see a small downwards spike that's caused by the current injected from the command signal through parasitic capacitors. Because it's very fast, it gets through (it's coupled even through very small parasitics).
Next I connected a serious 100uF/50V capacitor with 1cm leads. You wouldn't normally want to use less than 100uF for decoupling a usual circuit. The improvement is clear:





So if you want to get rid of those fast spikes, electrolytics are by no means totally useless as some might say, but a ceramic does a better job, especially if it's a low-inductance SMD (surface-mounted device) that has no leads.
Here is a 100nF ceramic disc capacitor, rated for 2kV (it's quite big for a ceramic, 1 cm in diameter), with ~1cm leads:

The nasty thing is that it's a high-frequency oscillation, about 5MHz. It can go totally unnoticed if one doesn't have an oscilloscope, and low-frequency circuits would start acting in all sorts of weird ways. Plus, you don't want radio-frequency oscillations if you don't need them, because they could radiate and interfere with stuff. If they don't radiate directly from the circuit board, then signal and power wires on outside connectors are incredibly good antennas.
RF oscillation aside, a very important thing must be noted: no more fast (10-20 ns) spikes. You can see the fast voltage drop is slightly longer than with the electrolytic capacitors. That means better high-frequency filtering. But don't expect any low-frequency filtering from such a small capacitor - There's still a 1.2V drop.
At this point I soldered a 10nF SMD capacitor very close to the switching transistor. The oscillation is now much weaker, and you can see it's dying out - that's just my luck, the supply could have oscillated with 10nF just as well, and I would have had to find another value.

Here you can see the steep drop that's not nearly as steep as with no capacitor:

Here is the 100nF ceramic added in parallel:

Here's the tantalum added:

Anyway, here's a zoom-out with just the ceramic 10nF SMD capacitor:


You can see two modes of oscillating, one high-frequency on turn-on and one low-frequency on turn-off. They both die out, but it's still not good for supplying a circuit.
Here are both ceramic capacitors:

The tantalum capacitor kills it for good, but gives that weird shape on turn-on:




So I added another 50 ohm resistor directly on the output, so I would switch between 100 and 200mA.
Here it is, with the 10nF SMD capacitor:

The 100nF ceramic stops the oscillation:




I took out the SMD cap and here is what I got:


Next I had to debunk a myth related to electrolytic capacitors. It seems that electrolytic caps get worse as they get older: their capacitance decreases, their ESR increases, their ability to filter decreases. So I took some capacitors I had lying around that I had taken out of some old monitors for the specific purpose of testing them. Now the time has come! :)
I should point out that said capacitors come from a scrapyard and have been rained on repeatedly. The other components on the PCB had their leads severely coroded. Compare with fresh off-the-shelf 10uF tantalum and 100uF electrolytic seen a few graphs above.
1000uF/35V:




Well, there you go. Dirty old rained-on electrolytics filtering very well, quite better than new ones I might say. Of course, if they've leaked or grown internal pressure, scrap therm.
Now to try some film capacitors. These are big, but designed for high voltage, high current use, and I guess they also have less leakage than electrolytics.
Here is a huge 1.5 inch, 3.3uF/400V from the same scrapyard:

Here is a smaller 330nF/250V with its leads spaced about 1 inch apart:

In conclusion: when in doubt, use a bigger capacitor.
No comments:
Post a Comment