Capacitor

How a capacitor stores charge: ceramic and electrolytic, polarity, charging through a resistor, the time constant, the code 104 and what capacitors are for.

Electronics Info
Orange and yellow ceramic capacitors and blue and black electrolytic capacitors of various sizes

What is a capacitor?

A capacitor is a component that can store a little electric charge and then give it back. Think of a small bucket of water: the current fills it, and when needed, the water flows back out of it. A capacitor fills and empties very fast, but it holds much less energy than a battery.

Inside there are two metal plates with a thin insulator between them. Current doesn’t flow through the insulator; instead, charge collects on the plates: plus on one, minus on the other.

The capacitance, how much charge a capacitor can store, is measured in farads (F). One farad is a lot, so we use smaller units: the microfarad (1 µF is a millionth of a farad), the nanofarad (1 nF = 0.001 µF) and the picofarad (1 pF = 0.001 nF).

Kinds of capacitor

Left: an orange ceramic capacitor marked 104, and below it its symbol, two equal straight lines, and the value 100 nF. Right: a blue electrolytic capacitor with a light stripe and minus signs on the right; the longer leg is plus. Below it are its three symbols: the European one, with a hollow rectangle for plus and a filled one for minus, the American one, with a straight line for plus and a curved one for minus, and a third one, with a short thick line for plus and a thinner one for minus, and the value 100 µF
  • Ceramic capacitors are small and flat, often orange or yellow. They have small values, from picofarads to microfarads. They have no plus and minus, so they can go either way round.
  • Electrolytic capacitors are cylinders, often blue or black. They have large values, from 1 µF to thousands of microfarads. They have a polarity: the longer leg is plus, and a light stripe with minus signs marks minus. They are also marked with the highest voltage they may get, for example 16 V. In a schematic you may come across three symbols, so it is good to know all three. In European schematics plus is a hollow rectangle and minus a filled one. In American ones plus is a straight line and minus a curved one. In the third, plus is a short thick line and minus a thinner line on the other side. There is often a + sign at the plus as well. How to place one on a breadboard is shown on the Breadboard page.

Take care with electrolytic capacitors

  • Don't connect one the wrong way round, and don't give it a higher voltage than the one printed on it. It can swell up, leak, or even burst with a bang.
  • If a capacitor gets warm or its top bulges, switch off the power at once and call the leader.
  • A large capacitor keeps its charge even after you switch off the power (see misconception 22). Don't short its legs to discharge it.

Charging and discharging

A capacitor doesn’t fill up all at once. Let’s look at the circuit in the picture: a 5 V source, a two-way switch, a 10 kΩ resistor and a 100 µF capacitor.

Schematic: a 5 V source, a two-way switch, a 10 kΩ resistor and a 100 µF electrolytic capacitor. In position 1 the switch connects the resistor to the source's plus, and in position 2 to its minus. The voltage across the capacitor is marked U

  • In position 1 the capacitor charges through the resistor.
  • In position 2 the resistor is connected to minus, so the capacitor discharges through it.

The graph shows the voltage across the capacitor (top) and the current through it (bottom). The switch is in position 1 from the start, and after 5 seconds we move it to position 2:

Top: the voltage across the capacitor over 10 seconds. In position 1 it rises fast, then more and more slowly, reaching 63 %, 3.16 V, after 1 s and almost 5 V after 5 s. In position 2 it falls, fast, then more and more slowly, and 1 s after switching it still has 37 %, 1.83 V. Bottom: at the start of charging the current is 0.5 mA and gets smaller towards zero, and while discharging it flows the other way, from −0.5 mA towards zero

  • At the start of charging the capacitor is empty and the current is largest, 5 V / 10 kΩ = 0.5 mA. The voltage rises fast.
  • As it charges, less and less voltage is left across the resistor, so the current gets smaller and the voltage rises more and more slowly. A capacitor never charges completely, but after 5 seconds it has 4.97 V, almost the full 5 V.
  • While discharging the current flows the other way (it is negative in the graph), and the voltage falls the same way: first fast, then more and more slowly.

That is why a capacitor next to an LED can keep the LED lit for a moment after you disconnect the battery: the LED slowly dims as the capacitor discharges.

Markings on capacitors

On an electrolytic capacitor the value is printed directly, for example 100 µF 16 V. A ceramic one usually has three digits, as on a resistor: the first two are digits, and the third is how many zeros to add, in picofarads.

CodePicofaradsValue
10110 and one zero = 100 pF100 pF
10210 and two zeros = 1000 pF1 nF
47347 and three zeros = 47,000 pF47 nF
10410 and four zeros = 100,000 pF100 nF = 0.1 µF

You can also convert the code with the capacitor calculator. A letter after the number is the tolerance: J is ±5 %, K ±10 % and M ±20 %.

What are capacitors for?

  • Smoothing a voltage. In a rectifier, a capacitor fills the gaps between the waves of the voltage, as on the page Rectifiers and voltage regulators.
  • Decoupling. A 100 nF ceramic capacitor next to every chip gives it current for fast changes before that current can arrive from the power supply (misconception 19).
  • Measuring time. A capacitor always charges through a resistor at the same speed, so it is used to make timers and circuits that blink.
  • Storing energy. A camera’s flash charges a capacitor and then empties it through the lamp in a fraction of a second.
  • Touch. A phone’s screen feels your finger because the finger changes the capacitance of tiny plates in the screen.

The capacitor in the Arduino workshop

From here on, this page is for the Arduino workshop.

Charge and the time constant

The charge on a capacitor is:

\[ Q = C \cdot U \]
A 100 µF capacitor on 5 V holds a charge of 0.0001 F · 5 V = 0.0005 C (coulombs).

How fast it charges through a resistor is given by the time constant:

\[ \tau = R \cdot C = 10\,000\ \Omega \cdot 0.0001\ \text{F} = 1\ \text{s} \]
In the time τ the capacitor charges to 63 % of the voltage, and in 5τ to more than 99 %. While discharging, it falls to 37 % in the time τ. In the graph above τ is 1 s: after 1 s the voltage is 3.16 V, and 1 s after switching to discharging it is 1.83 V. The voltage while charging is:
\[ U(t) = U_0 \cdot \left(1 - e^{-t/\tau}\right) \]
A larger capacitor or a larger resistor means slower charging (misconception 17).

Series and parallel

With capacitors it is the other way round from resistors:

  • in parallel the capacitances add up: two of 100 µF give 200 µF,
  • in series the total capacitance is smaller than each one: two of 100 µF give 50 µF.

Left: two 100 µF capacitors in parallel, the meter shows 200 µF. Right: the same capacitors in series, the meter shows 50 µF
\[ C_{parallel} = C_1 + C_2 \qquad \frac{1}{C_{series}} = \frac{1}{C_1} + \frac{1}{C_2} \]
Work them out with the calculator for capacitors in series and the calculator for capacitors in parallel.

A capacitor’s voltage

The voltage printed on a capacitor is the highest it may get. Choose it with a margin: for 5 V a capacitor of at least 10 V, and for 12 V one of at least 25 V. A higher rated voltage does no harm, but the capacitor is then usually bigger.

What did we learn?

  • A capacitor stores charge on two plates separated by an insulator. Capacitance is measured in farads: µF, nF and pF.
  • Ceramic capacitors have no polarity. Electrolytic ones do: the longer leg is plus, and the stripe marks minus.
  • Through a resistor a capacitor charges and discharges first fast, then more and more slowly. The time constant is τ = R · C: in that time it charges to 63 %.
  • The code 104 means 10 and four zeros picofarads, that is 100 nF.
  • In parallel capacitances add up, and in series the total is smaller, the other way round from resistors.

Short quiz

1. How do you know which leg of an electrolytic capacitor is minus?
On the minus side there is a light stripe with minus signs, and that leg is shorter.
2. What is the capacitance of a ceramic capacitor marked 103?
10 and three zeros picofarads: 10,000 pF = 10 nF.
3. When is the charging current of a capacitor largest?
At the very start, while the capacitor is empty. As it charges, the voltage across the resistor gets smaller, and so does the current.
4. What is the time constant of a 4.7 kΩ resistor and a 100 µF capacitor?
τ = 4700 Ω · 0.0001 F = 0.47 s. In that time the capacitor charges to 63 %, and in about 2.4 s (5τ) almost completely.
5. You connect two 100 µF capacitors in parallel. What is the total capacitance?
200 µF. In parallel the capacitances add up.
6. A circuit runs on 12 V. May you put in an electrolytic capacitor marked 10 V?
No. The voltage on the capacitor is higher than allowed, so it can swell up and burst. Use one of at least 25 V.