Home · ← Blog posts

Robotics

What Is a Capacitor? How It Works, Types, Formulas and the 104 Code

Probot Studio

What we'll do

  1. Look inside a capacitor and see how it stores charge.
  2. Learn the types, the symbols, and how to read codes like 104.
  3. Watch a capacitor charge and discharge in a live lab and see τ = R·C for ourselves.
  4. Learn where capacitors go on a robot, how to test one and how to discharge it safely.

Why it's useful: an Arduino that resets when the motor starts, or a sensor reading that jitters, is very often fixed by one small capacitor in the right spot.

A battery is wired to two metal plates with an insulator between them. Plus charges collect on the plate tied to the battery's plus terminal and minus charges on the other; current flows while it charges and stops when it is full

What is a capacitor?

A capacitor is a two-legged component that stores electric charge for a short time: two conducting plates with an insulator between them.

Unlike a battery, it can't power anything for hours, but it charges and empties very quickly. That makes it good at filling voltage dips, filtering noise and timing things.

The unit is the farad (F). One farad is huge; on real circuits you'll see:

Unit Equals Example
µF (microfarad) 0.000001 F Electrolytic: 10 µF, 100 µF, 1000 µF
nF (nanofarad) 1/1000 of a µF Ceramic: 100 nF (code 104)
pF (picofarad) 1/1000 of a nF Ceramic: 22 pF, 100 pF

How does a capacitor work?

Connect it to a battery and positive charge builds up on one plate, negative on the other. No current crosses the insulator: current only flows in the wires while it charges, then stops. Remove the battery and the charge stays on the plates.

The stored charge is proportional to the voltage:

Q = C × V      (charge = capacitance × voltage)

Physics class note: for a parallel-plate capacitor, C = ε × A / d. Bigger plates (A) mean more capacitance; a wider gap (d) means less; ε depends on the insulator.

Capacitor types and symbols

Left: a ceramic capacitor, symbol of two straight parallel lines, a disc with two equal legs that can go in either way. Right: an electrolytic, symbol with a plus-marked straight plate and a curved plate, a stripe on the minus side and a longer plus leg

Type Polarity Values Where on a robot
Ceramic None, fits either way pF, nF, a few µF 100 nF next to chips, across motor terminals
Electrolytic Yes: striped leg is minus µF up to thousands of µF Power inputs, next to the motor driver

An electrolytic also shows a voltage rating (for example 25 V). It must be well above the highest voltage in your circuit.

How to read capacitor codes: what is 104?

104 = 100 nF = 0.1 µF. The first two digits are the number, the third is how many zeros to add, and the unit is picofarads (pF).

The code 104: the first two digits give 10, the third digit means four zeros; 100,000 pF, which is 100 nF or 0.1 µF. 472 is 4.7 nF and 223 is 22 nF; a trailing letter is the tolerance

Code In pF Value
101 100 pF 100 pF
472 4,700 pF 4.7 nF
223 22,000 pF 22 nF
104 100,000 pF 100 nF = 0.1 µF
105 1,000,000 pF 1 µF

Electrolytics just print the value ("100µF 16V"). A letter after a ceramic code is the tolerance: J ±5%, K ±10%, M ±20%.

Capacitor formulas: series and parallel

What Formula Example
Charge Q = C·V 100 µF at 12 V → 1.2 mC
Energy E = ½·C·V² 100 µF at 12 V → 7.2 mJ
Time constant τ = R·C 10 kΩ, 100 µF → 1 s
Parallel C = C1 + C2 100 µF and 47 µF → 147 µF
Series 1/C = 1/C1 + 1/C2 10 µF and 10 µF → 5 µF

It's the opposite of resistors: resistors add up in series, capacitors add up in parallel (resistor color code).

Charging and discharging: what does τ = R·C mean?

Charged through a resistor, a capacitor's voltage rises fast at first, then slowly. Every τ = R·C closes 63% of the remaining gap: 63% after 1τ, 99.3% after 5τ. When discharging, 37% of the voltage is left after 1τ.

The charging curve reaches 63 percent at 1τ and 99.3 percent at 5τ; the discharging curve has 37 percent left after 1τ

Try it: with 10 kΩ and 100 µF, press Charge; the curve hits 63% in one second. Then press Discharge and watch the LED. Make R or C bigger and the time grows by the same factor.

This is an interactive charge and discharge lab with R, C and voltage sliders, plus a series/parallel, charge, energy and 104 code calculator. It needs JavaScript; if it doesn't load, the graph above shows the same curves.

What do capacitors do on a robot?

A battery feeds a motor driver, which drives a DC motor; an Arduino controls the driver. 1: an electrolytic at the driver input, 2: a 0.1 µF ceramic across the motor, 3: a 0.1 µF ceramic between the Arduino's 5V and GND

How to test a capacitor with a multimeter

Use the capacitance setting, but discharge the capacitor and take it out of the circuit first (how to use a multimeter):

  1. Turn the power off, discharge it as shown below, and check for 0 V.
  2. Remove it from the circuit: other parts throw off the reading.
  3. Turn the dial to capacitance (the capacitor symbol or F).
  4. Touch the probes to the legs (red to + on an electrolytic) and wait a few seconds.
  5. Compare with the label; a difference within the tolerance is normal (often ±20% for electrolytics).

"OL" means the value is above the range or the capacitor is bad. A bulging or leaking electrolytic doesn't need testing: replace it.

No capacitance setting? Measure τ with an Arduino

Wiring: D8 through 10 kΩ to a node; D9 through 1 kΩ to the same node. The node goes to A0 and to the + leg of a 100 µF capacitor; the − leg goes to GND (what is Arduino).

// RC charge curve: a 100 µF cap charges through 10 kΩ; A0 measures its voltage.
const int CHARGE_PIN = 8;
const int DISCHARGE_PIN = 9;
const int SENSE_PIN = A0;
const float R_OHM = 10000.0;           // charging resistor

void setup() {
  Serial.begin(9600);
}

void loop() {
  // 1) Discharge: D8 floats, D9 goes LOW (to GND through 1 kΩ)
  pinMode(CHARGE_PIN, INPUT);
  pinMode(DISCHARGE_PIN, OUTPUT);
  digitalWrite(DISCHARGE_PIN, LOW);
  while (analogRead(SENSE_PIN) > 2) { }
  delay(300);
  pinMode(DISCHARGE_PIN, INPUT);

  // 2) Charge and print the voltage every 50 ms
  pinMode(CHARGE_PIN, OUTPUT);
  digitalWrite(CHARGE_PIN, HIGH);
  unsigned long start = millis();
  unsigned long tau = 0;
  while (millis() - start < 5000) {    // 5 s = 5τ (10 kΩ × 100 µF = 1 s)
    int raw = analogRead(SENSE_PIN);   // 0..1023, 5 V = 1023
    if (tau == 0 && raw >= 647) {      // 647 = 63.2% of 1023
      tau = millis() - start;
    }
    Serial.println(raw * 5.0 / 1023.0);
    delay(50);
  }
  Serial.print("tau (ms): ");
  Serial.println(tau);
  Serial.print("C (uF): ");
  Serial.println(tau * 1000.0 / R_OHM);  // C = tau / R
  delay(3000);
}

Open the Serial Monitor (9600) to see the voltage rise, then τ and C = τ / R. Thanks to tolerance, anything from 0.8 to 1.2 s is normal; the sketch measures in 50 ms steps.

How to discharge a capacitor safely

Safety: do not open camera flashes, microwave ovens, air conditioners or TVs. Their capacitors can hold a potentially lethal charge even after the device is unplugged. A faulty AC unit capacitor is a job for a qualified technician.

Only for small, low-voltage capacitors like the ones in a robot kit:

  1. Turn the power off.
  2. Clip a resistor of about 1 kΩ across the legs with alligator leads; for 1000 µF, wait 5 seconds (5τ).
  3. Check for 0 V with a multimeter. An electrolytic that sits for a while can build up a little charge again, so discharge it again before use.

Don't short it with a screwdriver: it sparks and damages the leads and the capacitor.

Why do capacitors explode?

The first time you power a new circuit, don't lean over the electrolytics, and wear safety glasses.

Common mistakes

Symptom Cause Fix
Arduino resets when the motor starts Motor noise, supply dip 0.1 µF across the motor, electrolytic at the driver input; power the motor from its own battery
Electrolytic gets hot or bulges Reversed, or voltage rating too low Power off; fit a new one the right way round with a higher rating
The capacitor across my motor blew It was polarized; reversing the motor reversed its voltage Use a non-polarized ceramic
Multimeter reading differs from the label Measured in circuit, or tolerance Remove it, discharge it, measure again
Arduino sketch prints tau 0 It never reached 63% within 5 s Check the wiring, the capacitor's direction and its value
I read 104 as 104 µF The code is in pF 104 = 100 nF = 0.1 µF

Sources

Accessed: 17 October 2026