# Two beginner capacitor questions

#### exscape

Joined Jan 19, 2012
28
I'm a bit stuck on understanding capacitors properly. I can use them for the simple things, but without a clear understanding of exactly how they work.

First: if the current flowing into a capacitor is related to the change in voltage, wouldn't it always be empty in a simple parallel DC battery/capacitor/LED circuit? The voltage across the capacitor will be 0 volts before we power up the circuit; then, power is connected, and the voltage across the leads is now 9 volts (without any ramp-up time... or is this where the answer lies?).

I guess you could think of it as an infinite rate of change during an infinitely short time, but clearly the battery can't fill the capacitor in that time, if nothing else then due to internal resistance.
So... what actually happens here? Will the capacitor change fully (to 9 volts in this example)? Or not at all?

Second question: if we assume that the cap charges up well and nice, and we then remove the battery, causing it to discharge... Wouldn't the current from the capacitor be in the "wrong direction", passing onto the cathode of the LED, thus either doing nothing or possible causing damage to it?

As I'm sure you can see, I'm rather confused, and reading 10 different explanations of capacitors didn't quite sort that out, as most explain them in a near-identical way.

Joined Dec 26, 2010
2,148
There is indeed an inrush of current when a DC supply is connected to a circuit having capacitors in parallel with its supply input. The value of the inrush current is limited by the internal resistance of the supply (or battery), plus the effective series resistance of the capacitor, plus wiring resistance, and possibly parasitic inductances if these are large enough to have a significant effect on it. In some cases the inrush is so large as to be hazardous, but this is not usually the case with small battery-powered circuits.

Upon disconnection of the supply from a circuit with capacitors across it, current flows out from the capacitor in the opposite direction than the initial inrush but the voltage does not reverse unless there is sufficient inductance in the circuit to give a relatively un-damped resonance.

Thus a large capacitor across the supply to a typical LED circuit might lead to a slower fade-out when the power was disconnected instead of a sudden cut-off, but it is very unlikely that the LEDs would get reverse-biased unless the circuit contained very large inductance. Note that in any case the electrolytic capacitors often used for supply decoupling at lower frequencies cannot themselves tolerate reverse voltage.

Joined Dec 26, 2010
2,148
I see that I didn't give a straight answer your first question: that is, whether the supply capacitor charges fully. The answer is that it does, and pretty quickly too, as the charging current is typically only limited by parasitic resistances.

Actually, I can't see how you could ever think that a capacitor in parallel with a supply could not charge. Almost every electronic appliance you might name (radios, TVs, computers...) has at least one capacitor across a power supply, typically many are used. Since components in parallel share the same voltage, the capacitors not charging would mean that nothing received any voltage - so none of these appliances would work!!!

#### colinb

Joined Jun 15, 2011
351
I see that I didn't give a straight answer your first question: that is, whether the supply capacitor charges fully. The answer is that it does, and pretty quickly too, as the charging current is typically only limited by parasitic resistances.
Although, strictly speaking, a capacitor never quite fully charges, because the equation for the voltage on a capacitor is asymptotic and increases forever in an RC circuit:
$$V(t) = V_0 e^{-\frac{t}{RC}}$$
where V0 is the capacitor voltage at time t=0. (Since R is never 0.)
but for all practical purposes, it charges fully when R is very small. #### t_n_k

Joined Mar 6, 2009
5,455
Although, strictly speaking, a capacitor never quite fully charges, because the equation for the voltage on a capacitor is asymptotic and increases forever in an RC circuit:
$$V(t) = V_0 e^{-\frac{t}{RC}}$$
where V0 is the capacitor voltage at time t=0. (Since R is never 0.)
but for all practical purposes, it charges fully when R is very small. That's actually the discharge equation but your point is pertinent.

#### exscape

Joined Jan 19, 2012
28
Actually, I can't see how you could ever think that a capacitor in parallel with a supply could not charge. Almost every electronic appliance you might name (radios, TVs, computers...) has at least one capacitor across a power supply, typically many are used. Since components in parallel share the same voltage, the capacitors not charging would mean that nothing received any voltage - so none of these appliances would work!!!
I know (though I didn't think of your last point) - but the theory confuses me despite knowing how it works in practice! My calculus is a little rusty. Anyhow:

If the instantaneous current flowing into to the capacitor is $$i = C \frac{dv}{dt}$$, and the voltage never ramps up between 0 and 9 volts, wouldn't dv/dt be either 0 (before and after connecting power) or infinite (the instant power is connected)? Meaning i is only either infinite (not possible due to internal/wire resistances etc.) or 0? If so, I assume that's only true in theory and never in practice, which is why it actually does work? Or is my error elsewhere?

Now, my guess on where I'm wrong would probably be that the relevant voltage isn't the one over the power source, but the one over the capacitor's pins...? Though I'm not sure what difference that makes as I'm still unsure how I would calculate that (not knowing I or R for the calculation).

#### t_n_k

Joined Mar 6, 2009
5,455
You have overlooked the point made earlier that there will always be some series resistance (& inductance) - parasitic or otherwise - between the source and the capacitor.

Suppose you have a 9V battery with an internal resistance of 1Ω switched onto an ideal 100uF uncharged capacitor.

The capacitor is initially at zero volts. So the current at the point of switching will be 9Amps.

So using

$$i(t)=C\frac{dV_c}{dt}$$

at t=0

$$i(0)=9=10^{-4}\frac{dV_c}{dt}$$

giving @ t=0

$$\frac{dV_c}{dt}=90,000 \ volts/sec = 0.09 \ volts/usec$$

Last edited:

#### Wendy

Joined Mar 24, 2008
23,269
1 RC time constant = 68% charge.

5 RC time constants is considered a full charge, or close enough. It actually works out to pretty close to 98.3% of a full charge.

I drew a precision charge curve a while back so I could illustrate some of my articles. It comes in handy for some other stuff too. #### exscape

Joined Jan 19, 2012
28
I've also been trying to use LTSpice to help me get this straight, but it's not quite cooperating. I set up a circuit with a 9V voltage source (1 ohm series resistance), parallel with a 100µF cap and a resistor/LED (those two in series, obviously). LTSpice tells me the current through the cap is in the 0.9 femtoampere range (it never goes higher). That current is also fairly constant even in a 2-hour simulation.

Of course, the above just confuses me further. Is something in LTSpice "too ideal", or am I just doing something plain wrong?
I attached a screenshot of my circuit.

#### t_n_k

Joined Mar 6, 2009
5,455
You need to get a grasp of the time scales involved.

A 1Ω resistor and a 100uF capacitor have a time constant of 100 μsec. In other words the capacitor would charge in about 3-5 time constants or 300-500 μseconds. It's all over in less than half a millisecond. That's miniscule in comparison to the time scale you have of ~1 minute.

#### exscape

Joined Jan 19, 2012
28
You need to get a grasp of the time scales involved.

A 1Ω resistor and a 100uF capacitor have a time constant of 100 μsec. In other words the capacitor would charge in about 3-5 time constants or 300-500 μseconds. It's all over in less than half a millisecond. That's miniscule in comparison to the time scale you have of ~1 minute.
Ah, very true, but it doesn't show up with any time scale (there's a peak to the very left, but it's ALWAYS at the very left, even in a 1 picosecond simulation; I tried 50 ms down through 1 ps)... so LTSpice is of little help. Unless there's some way to display aggregate current in coulombs somehow, that is.

Anyway, just to clarify:
1) A real capacitor on a regular DC circuit will load "fully" (ignoring the asymptotic curve) in a very short time, assuming a µF-range capacitance and no noteworthy (tens or hundreds of ohms) current-limiting?
2) An ideal capacitor on a 100% constant voltage source (say directly connected to an ideal battery), where there are no resistances (parasitical or not) anywhere... won't load up unless there's a changing voltage over time?

Also, ugh, sorry for being a bit slow regarding this subject. #### colinb

Joined Jun 15, 2011
351
That's actually the discharge equation but your point is pertinent.
OK, that's true. But since charging and discharging are really the same, here's the general equation that covers both:
$$v(t) = v_1+(v_0-v_1)e^{-\frac{t}{RC}}$$
where $$v_0$$ is the initial voltage on the capacitor and $$v_1$$ is the supplied nominal voltage.

#### exscape

Joined Jan 19, 2012
28
OK, so I fixed my LTSpice problem, and my understanding is bettering now that I found the last chapter of the e-book's DC volume. (I had read all the previous chapters.)

Not only does it discuss exactly this, but it also mentions (not clearly, but I noticed it) a SPICE option to the .tran directive, called uic... or in LTSpice, "Skip initial operating point solution". Wih that option checked, both capacitors and inductors behave as I'd expect at the beginning of a simulation! Hooray!

#### t_n_k

Joined Mar 6, 2009
5,455
Ah, very true, but it doesn't show up with any time scale (there's a peak to the very left, but it's ALWAYS at the very left, even in a 1 picosecond simulation; I tried 50 ms down through 1 ps)... so LTSpice is of little help. Unless there's some way to display aggregate current in coulombs somehow, that is.

Anyway, just to clarify:
1) A real capacitor on a regular DC circuit will load "fully" (ignoring the asymptotic curve) in a very short time, assuming a µF-range capacitance and no noteworthy (tens or hundreds of ohms) current-limiting?
2) An ideal capacitor on a 100% constant voltage source (say directly connected to an ideal battery), where there are no resistances (parasitical or not) anywhere... won't load up unless there's a changing voltage over time?

Also, ugh, sorry for being a bit slow regarding this subject. I'm sceptical that LTspice won't give a valid solution.

On the matter of ideal capacitor switched across an ideal voltage source you will have an infinite current impulse of infinitesimal duration. No physical 'real world' equivalent of this would exist in practice.

Last edited:

#### t_n_k

Joined Mar 6, 2009
5,455
Well not so fast on my part - It seems LTspice doesn't handle straight DC source transient problems very well. One has to use something like a pulse generator source, such as in the attachment screen capture.

EDIT: