# Charging a capacitor in parallel with a resistor from a constant current source.

#### ChrisG01

Joined Dec 5, 2022
3
I'm modifying a legacy design and have come across an interesting problem which my maths skills are far too rusty to derive.

I have a subcircuit which is simply a capacitor connected in parallel with a resistor, and supplied by a constant current source.

The initial condition under consideration is with the PD across the capacitor as 0V, and the input current at 0A.
Would anyone be able to help me derive a formula to determine the time taken for the capacitor to charge, following application of a constant current I, to a defined voltage V, given R, C, and I?

#### MrChips

Joined Oct 2, 2009
27,681
Welcome to AAC!

The voltage on the capacitor will rise linearly given by the equation,

V = Q / C

where V is the capacitor voltage (volts)
Q is the charge (coulombs)

The charge Q = I x t
where I is current (amps)
t is time (seconds)

Hence
V = I x t / C

Solving for time t

t = C x V / I

#### WBahn

Joined Mar 31, 2012
27,880
This sounds like a Circuits I homework problem. Is it (a homework problem of some kind)?

First thing is to determine whether it will ever reach the desired voltage. What is the max voltage it can charge to?

Then, convert the current source and resistance into an equivalent Thevenin circuit.

You now have a simple RC circuit having an exponential voltage-time relationship and can solve for the time to reach a particular voltage.

#### WBahn

Joined Mar 31, 2012
27,880
The voltage on the capacitor will rise linearly given by the equation,

V = Q / C

where V is the capacitor voltage (volts)
Q is the charge (coulombs)

The charge Q = I x t
where I is current (amps)
t is time (seconds)

Hence
V = I x t / C

Solving for time t

t = C x V / I
You are assuming that ALL of the current is going into the capacitor. It's not.

#### MrChips

Joined Oct 2, 2009
27,681
You are assuming that ALL of the current is going into the capacitor. It's not.
You are correct. I didn't see "capacitor in parallel with a resistor".
The current through R is V(t)/R.
So the current to the capacitor is I - V(t)/R.
This becomes a differential equation.

#### MrChips

Joined Oct 2, 2009
27,681
For an expedient solution, calculate the time to reach a voltage V given that R = ∞.
What are your real values of I, V, R, C? These can influence the significance or R.

#### ChrisG01

Joined Dec 5, 2022
3
This sounds like a Circuits I homework problem. Is it (a homework problem of some kind)?

First thing is to determine whether it will ever reach the desired voltage. What is the max voltage it can charge to?

Then, convert the current source and resistance into an equivalent Thevenin circuit.

You now have a simple RC circuit having an exponential voltage-time relationship and can solve for the time to reach a particular voltage.
No, it's not a homework problem, unless you count me having to dig out text books later to try and remember a lot of maths I've just discovered I've forgotten!

For context, the circuit in question is a current limiting circuit for an external supply. A high side current sense IC provides a near ideal constant current I proportional to the load voltage across a sense resistor, which is supplied to a resistor R within the monitoring circuitry, with a capacitor C in parallel to provide a trip delay as the output load is quite inductive. The resultant voltage developed across R is then compared against a fixed reference voltage in order to switch off the load should an overcurrent occur.

I can scale I by modifying the value of the sense resistor in order to vary the ratio of monitoring current to load current, and would like to explore tweaking both this along with R and C in order to alter the trip delay for various levels of overcurrent.

#### WBahn

Joined Mar 31, 2012
27,880
You are correct. I didn't see "capacitor in parallel with a resistor".
The current through R is V(t)/R.
So the current to the capacitor is I - V(t)/R.
This becomes a differential equation.
Yeah, but there's no need to solve any differential equations directly since the form of the solution is well known -- namely an exponential going from an initial voltage to a final voltage according to the equation

$$v(t) \; = \; V_{final} \; - \; \left( V_{final} - V_{initial} \right) e^{\frac{-t}{RC}}$$

#### MrChips

Joined Oct 2, 2009
27,681
The primary circuit is an integrator that integrates charge over time.
Calculate the time t to reach a desired voltage V.

The resistor across the capacitor makes it a leaky integrator with a time-constant of RC.
Compare this time-constant with the charging time.

#### WBahn

Joined Mar 31, 2012
27,880
No, it's not a homework problem, unless you count me having to dig out text books later to try and remember a lot of maths I've just discovered I've forgotten!

For context, the circuit in question is a current limiting circuit for an external supply. A high side current sense IC provides a near ideal constant current I proportional to the load voltage across a sense resistor, which is supplied to a resistor R within the monitoring circuitry, with a capacitor C in parallel to provide a trip delay as the output load is quite inductive. The resultant voltage developed across R is then compared against a fixed reference voltage in order to switch off the load should an overcurrent occur.

I can scale I by modifying the value of the sense resistor in order to vary the ratio of monitoring current to load current, and would like to explore tweaking both this along with R and C in order to alter the trip delay for various levels of overcurrent.
It probably wouldn't be a bad idea to do a bit of a refresher on first-order circuits.

Be that as it may, given

$$v(t) \; = \; V_{final} \; - \; \left( V_{final} - V_{initial} \right) e^{\frac{-t}{RC}}$$

You've specified that V_initial = 0 V, so this reduces to

$$v(t) \; = \; V_{final} \left( 1 - e^{\frac{-t}{RC}} \right)$$

You want to find the value of t=T at which v(T) = V0

$$v(T) \; = \; V_0 \; = \; V_{final} \left( 1 - e^{\frac{-T}{RC}} \right)$$

Now solve for T

$$e^{\frac{-T}{RC}} \; = \; \left( 1 \; - \; \frac{V_0}{V_{final}} \right)$$

$$\frac{-T}{RC} \; = \; \text{ln} \left( 1 \; - \; \frac{V_0}{V_{final}} \right)$$

$$T \; = \; -RC \cdot \text{ln} \left( 1 \; - \; \frac{V_0}{V_{final}} \right)$$

The final voltage is determine by the voltage at which all of the current, which I will call Icc, is going through the resistor

$$V_{final} \; = \; I_{cc} R$$

$$T \; = \; -RC \cdot \text{ln} \left( 1 \; - \; \frac{V_0}{I_{cc} R} \right)$$

This can be made, perhaps, a bit more tractable from a computation standpoint

$$T \; = \; RC \cdot \text{ln} \left( \frac{I_{cc} R}{I_{cc} R - V_0} \right)$$

#### WBahn

Joined Mar 31, 2012
27,880
The primary circuit is an integrator that integrates charge over time.
Calculate the time t to reach a desired voltage V.

The resistor across the capacitor makes it a leaky integrator with a time-constant of RC.
Compare this time-constant with the charging time.
I would argue that this is a needlessly complicated view that doesn't lead to a quantitative result. What does it mean to "compare" the time constant with the charging time? What do you do with the result of that comparison?

The circuit is nothing more than a first-order RC circuit and the solution is exactly the same as if someone said that they had a constant voltage source charging a capacitor through a resistor and wanted to know at what time the capacitor reaches a particular voltage.

#### ChrisG01

Joined Dec 5, 2022
3
I would argue that this is a needlessly complicated view that doesn't lead to a quantitative result. What does it mean to "compare" the time constant with the charging time? What do you do with the result of that comparison?

The circuit is nothing more than a first-order RC circuit and the solution is exactly the same as if someone said that they had a constant voltage source charging a capacitor through a resistor and wanted to know at what time the capacitor reaches a particular voltage.
Unfortunately this doesn't seem to be the case, presumably because with a constant current, the charge of the capacitor alone is essentially linear until the max voltage of the supply.

I got to something quite similar to your derivation, however (v(t)=Vfinal−(Vfinal−Vinitial)e−tRCv(t)=Vfinal−(Vfinal−Vinitial)e−tRC) doesn't resolve to the same as a simple spice model of the circuit.
Perhaps i'm doing something fundamentally wrong, but for t = 0.2, I = 0.1, R = 1k and C as 100u, spice suggests a charge of 86.45V

#### Attachments

• 35.7 KB Views: 7

#### MrChips

Joined Oct 2, 2009
27,681
TS simply wants to tweak R and C for a given over-current limit.

Without R, V(t) will be reached in time t = C x V / I .
Add R in parallel will make t longer to reach V(t).

When I say "compare" I mean what is the value of t compared with RC?

#### ericgibbs

Joined Jan 29, 2010
16,790
hi Chris,
E

#### MrChips

Joined Oct 2, 2009
27,681
... but for t = 0.2, I = 0.1, R = 1k and C as 100u, spice suggests a charge of 86.45V
Without R,
the voltage will rise to 200V after 200ms.
With RC = 100ms, without going into the math I can estimate that V will rise to about 80V after 200ms.

Another way of looking at it, at V = 50V, R is stealing 50mA, 50% of the charging current. Thus the charging rate of C is 50% slower at 50V.

#### crutschow

Joined Mar 14, 2008
31,123
for t = 0.2, I = 0.1, R = 1k and C as 100u, spice suggests a charge of 86.45V
It's not complicated, you don't need a fist full of equations, just .
The RC time-constant of the simulated is100ms, and the final voltage is 100V due to the current and resistance values.
Thus the voltage will reach a 1 time-constant of voltage or 632.2V @ 100ms, or 86.4V for a 2 time-constant voltage @ 200ms, as the simulation shows.

Last edited:

#### ericgibbs

Joined Jan 29, 2010
16,790
hi chris
This is what LTS shows.

E

#### ericgibbs

Joined Jan 29, 2010
16,790
Hi chris,
A little more detail.
E

Last edited:

#### MrChips

Joined Oct 2, 2009
27,681
The current to the capacitor is I - v(t)/R.
The voltage is
v(t) = 1/C x ∫i.dt
v(t) = 1/C x ∫(I - v(t)/R).dt
v(t) = 1/RC x (IR.t - ∫v(t).dt)
v(t) = Vfinal.t/RC - 1/RC∫v(t).dt

#### WBahn

Joined Mar 31, 2012
27,880
Unfortunately this doesn't seem to be the case, presumably because with a constant current, the charge of the capacitor alone is essentially linear until the max voltage of the supply.
It would be linear only if ALL of the current from the current source goes into the capacitor. But it doesn't. As soon as the capacitor has ANY voltage across it, there is also a voltage across the resistor, which means that some of the current from the supply is flowing through the resistor and only the remainder is going into the capacitor. Thus the rate at which the capacitor voltage changes slows. The more the capacitor charges, the higher the voltage across it, so the higher the voltage across the resistor, so the more current is shunted through the resistor and the slower and slower the capacitor charges. Eventually, the voltage gets to the point at which ALL of the current is flowing through the resistor, none of it is going into the capacitor, and the capacitor stops charging any further. That voltage is when

I_cc = I_resistor

I_cc = Vo / R

Solving for Vo:

Vo = I_cc · R

I got to something quite similar to your derivation, however (v(t)=Vfinal−(Vfinal−Vinitial)e−tRCv(t)=Vfinal−(Vfinal−Vinitial)e−tRC) doesn't resolve to the same as a simple spice model of the circuit.
Perhaps i'm doing something fundamentally wrong, but for t = 0.2, I = 0.1, R = 1k and C as 100u, spice suggests a charge of 86.45V
I assume you mean I = 0.2 A

That would make the final voltage equal to 100 V, which agrees with your simulation.

At t = 0.2 s, the voltage across the capacitor should be

$$v(t) \; = \; V_{final} \left( 1 - e^{\frac{-t}{RC}} \right)$$

$$v(200 ms) \; = \; 100 V \left( 1 - e^{\frac{-200 ms}{1 k\Omega \cdot 100 \mu F}} \right)$$

$$v(200 ms) \; = \; 100 V \left( 1 - e^{\frac{-200 ms}{100 ms}} \right)$$

$$v(200 ms) \; = \; 100 V \left( 1 - e^{-2} \right)$$

$$v(200 ms) \; = \; 100 V \left( 1 - e^{-2} \right)$$

$$v(200 ms) \; = \; 100 V \left( 1 - 0.13534 \right)$$

$$v(200 ms) \; = \; 100 V \left( 0.86466 \right)$$

$$v(200 ms) \; = \; 86.466 V$$

That would seem to agree awfully close with your simulation result. The slight (~0.02%) difference is likely (as in "almost certainly") due to the fact that simulators must work in discrete time steps and thus only yield approximate answers. If you force the maximum timestep to be a smaller value, you will likely get better agreement.