# RC Circuit: Charging and Discharging a Capacitor

Level 3 (with higher mathematics)
Level 3 requires the basics of vector calculus, differential and integral calculus. Suitable for undergraduates and high school students.
Updated by Alexander Fufaev on

RC circuit is a useful component that you will often encounter in electronics. For example, they are used as a so-called low-pass filter, with which you can filter out high frequencies of the applied AC voltage. 'Low pass' basically means that low frequencies are allowed to pass and high frequencies of the AC voltage are blocked. Other applications of an RC circuit include:

• Generation of a sawtooth-shaped voltage

• Turn signal lights of a car

• Artificial pacemaker

## What is an RC circuit?

The 'R' stands for a Resistor and the 'C' stands for a Capacitor. So an RC circuit is a simple resistor-capacitor circuit. The resistor and capacitor are connected in series.

In illustration 1 or 2 you can see such an RC circuit. A capacitor connected with a resistor is of course useless without an applied voltage. Therefore the circuit also has a switch which can be switched to the left or to the right to turn off or on the source voltage.

• When the switch is turned to the left, a constant voltage $$U_0$$ is applied to the RC element (illustration 1). An electric current $$I(t)$$ (a charging current) starts to flow through the resistor and capacitor. The current decreases over time. On the other hand, the voltage $$U_{\text C}(t)$$ on the capacitor, which was zero at the beginning, increases with time until the capacitor is fully charged to the value $$U_0$$.

• If the switch is turned to the right, the capacitor is discharged again via the resistor (illustration 2). The flowing current $$I(t)$$ (a discharge current) is maximum at the moment the switch has just been pushed and decreases with time until it becomes zero when the capacitor is completely discharged. The voltage $$U_{\text C}(t)$$ across the capacitor also decreases with time.

## Charging a capacitor

As soon as the switch is turned to the left, a constant voltage $$U_0$$ (source voltage) is immediately applied to the resistor and the capacitor (RC element). This is the total voltage that is continuously applied to the RC element. But, what about the current flowing through the RC element? And, what about the voltage $$U_{\text R}$$ across the resistor and the voltage $$U_{\text C}$$ across the capacitor individually?

### Formulate differential equation for the charging current

To examine these three quantities, we use the Kirchhoff's voltage law (2nd Kirchoff law). According to the Kirchhoff's voltage law, the sum of all signed voltages must be zero. In our case the source voltage $$U_0$$ is the total voltage. That means the voltage $$U_{\text R}$$ at the resistor and the voltage $$U_{\text C}$$ at the capacitor together form the total voltage:

Total voltage is the sum of the individual voltages
Formula anchor

The source voltage $$U_0$$ is known because we set it ourselves. The voltages $$U_{\text R}$$ and $$U_{\text C}$$ on the other hand are not known. Therefore we have to try to represent them in a different way.

According to Ohm's law, we can express the voltage $$U_{\text R}$$ at the resistor $$R$$ with the help of the current $$I$$ flowing through the entire circuit:

U0 equals R times I plus Uc
Formula anchor

For the capacitor having the capacitance $$C$$, the charge $$Q$$ on its capacitor plates is given by: $$Q = C \, U_{\text C}$$. If we rearrange this formula for $$U_{\text C}$$ and substitute in 2, we get:

U0 equals R times I plus Q divided by C
Formula anchor

We haven't won much yet, since $$I$$ and $$Q$$ are also unknown. But now comes the crucial step: We see in the experiment that the current $$I$$ is time dependent: $$I(t)$$. Thus the charge $$Q$$ on the capacitor plates must increase with time. The charge must therefore also be time-dependent in some way: $$Q(t)$$. We just don't know how yet! To figure out this time dependence exactly, we need to turn the equation 3 we set up into a differential equation. For this purpose we differentiate the whole equation with respect to time $$t$$:

Sum of voltages differentiated with respect to time
Formula anchor

Since the constant voltage $$U_0$$ is time independent, its derivative is omitted. The resistance $$R$$ is also constant, therefore we may move it before the time derivative. This is also true for the capacitance $$C$$. The time derivative of the charge $$Q(t)$$ is exactly the definition of the current $$I(t)$$:

Zero equals resistance times time derivative of current plus 1 divided by capacitance times current
Formula anchor

Let's also divide the whole equation by $$R$$ for a more compact representation and put the time derivative to the left side:

Differential equation for the charging current
Formula anchor

Wir haben durch die Zeitableitung eine sogenannte homogene lineare Differentialgleichung 1. Ordnung für den Strom $$I(t)$$ erhalten. Wenn wir diese Differentialgleichung lösen, dann bekommen wir heraus, wie der Strom $$I(t)$$ genau von der Zeit $$t$$ abhängt. Wir können beispielsweise die Lösungsmethode 'Trennung der Variablen' aus der Mathematik benutzen, um diese Differentialgleichung zu lösen. Zu der Differentialgleichung brauchen wir noch eine sogenannte Anfangsbedingung, damit unsere Lösung für den Strom eindeutig wird. Der Strom $$I_0$$ zum Zeitpunkt $$t = 0$$ entsprach dem Wert, der durch unsere Quellspannung vorgegeben ist: $$I_0 ~=~ \frac{U_0}{R}$$. Und das ist unsere Anfangsbedingung. We have obtained a so-called homogeneous linear differential equation of 1st order for the current $$I(t)$$. If we solve this differential equation, we get how the current $$I(t)$$ depends exactly on the time $$t$$. For example, we can use the 'separation of variables' solution method from mathematics to solve this differential equation. In addition to the differential equation we need a so-called initial condition to make our solution for the current unique. The current $$I_0$$ at time $$t = 0$$ corresponded to the value given by our source voltage: $$I_0 ~=~ \frac{U_0}{R}$$. And this is our initial condition.

### Current during charging

Solving the differential equation 6 together with the associated initial condition, yields a formula for the current $$I(t)$$, with $$I_0 ~=~ \frac{U_0}{R}$$:

Formula anchor

This is the charging current that flows through the resistor and capacitor as soon as we turn the switch to the left, that is apply the voltage $$U_0$$ to the RC element. The current decreases exponentially. You can see this directly from the minus sign in the exponential function. If you plot the function $$I(t)$$ in a current-time diagram, you will get such a graph:

From the graph we can get the following information about the current:

• At the time $$t = 0$$ (that is at the time of switching on) the current had its maximum value $$I_0 = \frac{U_0}{R}$$. We can control this maximum value by choosing a different resistor $$R$$ or a different voltage $$U_0$$.

• The current $$I(t)$$ decreases exponentially with time to zero. Once the current is practically zero, we expect the capacitor to be fully charged.

If you look at the exponential equation 7 for the current, you will see that the factor $$\frac{1}{RC}$$ occurs in the exponent. We call the product $$R\,C$$ the time constant. It is so called because it has the unit of time and, because it is a constant, since both $$R$$ and $$C$$ are constant. For example, we can ask the following question:

What is the current when the time $$t = R\,C$$ has passed?

Let's insert this time into the equation 7:

Formula for the charging current after time RC
Formula anchor

Answer: After the time $$t = R\,C$$ the current decreases to 37% of the maximum value $$\frac{U_0}{R}$$

With this time constant $$R\,C$$ we can practically experimentally adjust the slope of the exponential function to our needs.

• If you want the capacitor to take longer to charge, then you must choose the resistance $$R$$ or capacitance $$C$$ as LARGE as possible, so that the time constant $$R\,C$$ also becomes as large as possible. Due to a larger time constant, the exponential function becomes flatter and the current decreases more slowly to zero. The capacitor is therefore charged more slowly.

• If you want the capacitor to be charged as fast as possible, then you have to choose the resistance $$R$$ or capacitance $$C$$ as SMALL as possible, so that the time constant $$R\,C$$ is as small as possible. Due to a smaller time constant, the exponential function becomes steeper and the current drops to zero faster. The capacitor is therefore charged more quickly.

### Voltage at the capacitor during charging

What about the voltage $$U_{\text C}$$ across the capacitor when the capacitor is charged? To answer this question, we just need to use the equation 2 written down earlier for the total voltage:

Total voltage equals resistance times current plus capacitor voltage
Formula anchor

Here, Ohm's law $$R\, I(t)$$ was used for $$U_{\text R}(t)$$. Let's rearrange equation 11 for the capacitor voltage and insert the exponential function 7 for the current:

Capacitor voltage equals U0 minus resistance times exponentially decreasing current
Formula anchor

If we now only cancel the resistance $$R$$ and factor out the source voltage (U_0\), we get the time-dependent voltage across the capacitor:

Formula anchor

We can illustrate the capacitor voltage in a voltage-time diagram:

From the graph we can obtain the following information:

• The capacitor voltage $$U_{\text C}(t)$$ increases with time. This means that the applied source voltage $$U_0$$ is not immediately present between the capacitor plates.

• The capacitor voltage $$U_{\text C}(t)$$ practically reaches a saturation value at some point, namely the given source voltage $$U_0$$. Then the capacitor is fully charged.

### Voltage at the resistor during charging

What about the voltage $$U_{\text R}(t)$$ across the resistor while the capacitor is charging? For this we only have to insert the found capacitor voltage 13 into the voltage equation 1:

Initial voltage equal to voltage at resistor Plus inserted capacitor voltage
Formula anchor

Rearrange for $$U_{\text R}(t)$$ and bracket out $$U_0$$:

Voltage at resistor equal to exponentially decreasing initial voltage
Formula anchor

The 1 cancels out and you get:

Formula anchor

## Discharging a capacitor

Now we come to the discharging process. After we have charged the capacitor, we can discharge it again by turning the switch to the right. Then the RC element is basically short-circuited. At the beginning, a discharge current $$I_0 ~=~ \frac{U_0}{R}$$ flows in the opposite direction and this decreases exponentially, as during the charging process:

Formula anchor

The current $$I(t)$$ flows in the opposite direction during discharging to the current during charging. We take this into account with the minus sign in front of $$I_0$$. ($$I_0$$ is the magnitude of the initial current and is always positive here). Besides that,, the current behaves in the same way when discharging as when charging. Of course, we can omit the minus sign if we are not interested in the fact that the current now flows the other way around.

To get the voltage $$U_{\text R}(t)$$ across the resistor, all we have to do, according to Ohm's law, is multiply the equation 18 by the resistance $$R$$, because $$U_{\text R}(t) ~=~ R \, I(t)$$:

Voltage at the resistor during discharge
Formula anchor

Here is $$U_0 = R \, I_0$$. Also here we have a minus sign. This means that during discharging the polarity of the voltage at the resistor is exactly opposite to the voltage during charging. Otherwise nothing has changed for $$U_{\text R}(t)$$: The voltage $$U_{\text R}(t)$$ at the resistor decreases exponentially as during charging.

If we use the Kirchhoff's voltage law, then we get an equation for voltages during discharge:

Voltage at resistor Plus Capacitor voltage equal to zero
Formula anchor

If we now insert the voltage $$U_{\text R}(t)$$ and rearrange for $$U_{\text C}(t)$$, we get:

Formula anchor

The difference to the capacitor voltage during the charging process is that the voltage at the beginning, that is at the time $$t = 0$$, is not zero but has the value $$U_0$$. The capacitor voltage decreases exponentially.

Now you know what happens to the voltage and current through the resistor and capacitor in time when the capacitor is charged or discharged.