Learn / Passive components / Capacitors

Capacitors & Inductors

ReviewedBeginnerFreeAbout 5 min
In short

Capacitors & Inductors: the short answer

A capacitor stores charge, a little like a tiny rechargeable tank. It resists sudden changes in voltage, which makes it useful for smoothing supplies and filtering noise. Example: The pin sees one clean change instead of several. Many makers do this in code instead, but the RC filter works with no software at all.

Level
Beginner
Time
About 5 min
Topic
Passive components
You will learn to

Explain what capacitors and inductors do in a circuit and work out an RC time constant.

Before this: Voltage, Current & Resistance

A capacitor stores charge, a little like a tiny rechargeable tank. It resists sudden changes in voltage, which makes it useful for smoothing supplies and filtering noise. Its value is in farads; real parts are usually µF (millionths) or nF (billionths).

Charging a capacitor through a resistor takes time. The time constant is τ = R × C. After one τ it reaches about 63 % of the final voltage, and after five τ it is effectively full.

An inductor stores energy in a magnetic field and resists sudden changes in current. Motors, relay coils and solenoids are inductors too. When you switch one off, the stored energy tries to keep current flowing and makes a voltage spike, which is why they need a flyback diode.

Two practical rules: put a 100 nF ceramic capacitor close to every chip's power pins, and never exceed an electrolytic capacitor's voltage rating or reverse its polarity.

Two ways to see a capacitor

For a slow change, a capacitor is a tank: it fills and empties through whatever resistance connects to it, and the voltage across it cannot jump. For a fast change, it is nearly a wire: a sudden step in voltage passes straight through, which is why capacitors couple signals and short out noise.

The tank view explains timing circuits and smoothing. The wire view explains decoupling, filters and why a capacitor across a supply makes a spike look smaller. The same part does both jobs; frequency decides which one you see.

Reading the time constant

τ = R × C is the time for the voltage to cover 63 % of the remaining distance. After 2τ it has covered 86 %, after 3τ 95 %, and after 5τ 99.3 %. A 10 kΩ resistor and a 100 µF capacitor give τ = 1 s, so the capacitor is practically full after 5 s.

The same τ applies to discharging. This is the idea behind reset delays, debouncing a switch, fading an LED and the simplest analog timers. Large resistors with large capacitors are slow, but leakage in electrolytics limits how long a delay you can trust.

Types and their quirks

Ceramic capacitors (100 nF, 1 µF) are small, cheap and fast, the right choice for decoupling. Some types (Y5V, Z5U) lose most of their capacitance under DC bias or heat, so a 10 µF part can behave like 3 µF. X7R and C0G keep their value much better.

Electrolytic capacitors give large values (10 µF to thousands of µF) for bulk storage but are polarised: the stripe marks the negative lead, and reversed they can vent. They also age, especially when hot, so derate: use a voltage rating at least 1.5 to 2 times what they will see.

Inductors and the spike

An inductor resists a change in current, as a capacitor resists a change in voltage. Its voltage is V = L × (change in current ÷ time). Break the current quickly and the voltage across it shoots up. A relay coil switched off in a microsecond can produce a spike of tens or hundreds of volts, which is what the flyback diode is for.

Real inductors have limits. Above the saturation current the core can no longer hold more magnetic energy, the inductance collapses and the current rises sharply. Always check the inductor's rated current against your peak current, not only the average.

Common mistakes
  • Using a capacitor's marked value in a timing calculation when it is a 20 % tolerance electrolytic or a ceramic that loses capacitance under voltage.
  • Putting a polarised capacitor in backwards, or running it at its full voltage rating.
  • Switching a coil without a flyback diode or snubber.
Key formulas
Q = C × V
charge in coulombs
E = ½ C V²
energy stored in a capacitor
τ = R × C
time constant in seconds
Try it: Charge a capacitor through a resistor

How the capacitor charges

0 %50 %100 %0 s2 s4 sTimeτ, 63 %

Change R and C and watch the time constant move. Bigger R or C means a slower curve.

τ = R × C = 1 s

ChargingDischargingCapacitor voltage against time. After one time constant (1 s) it reaches 63 %; after 5τ it is above 99 %.

Work it with your own numbers: RC time constant · Capacitor energy

Worked example

Debounce a button with an RC filter

  1. A button bounces for a few milliseconds when pressed.
  2. Choose R = 10 kΩ and C = 100 nF.
  3. τ = 10 000 × 0.0000001 = 0.001 s = 1 ms.
  4. Five τ is 5 ms, longer than most bounce.

Result. The pin sees one clean change instead of several. Many makers do this in code instead, but the RC filter works with no software at all.

Try it

Charge a 100 µF capacitor through a 10 kΩ resistor from 5 V and watch the voltage on your meter. Estimate τ first, then time how long it takes to pass 3.2 V (about 63 %).

Check yourself

3 quick questions

  1. What is τ for 10 kΩ and 100 µF?

  2. Why place a 100 nF capacitor near a chip's power pin?

  3. What protects a transistor when a relay coil switches off?

Common questions

What will I learn in "Capacitors & Inductors"?

Explain what capacitors and inductors do in a circuit and work out an RC time constant.

How do I debounce a button with an RC filter?

A button bounces for a few milliseconds when pressed. Choose R = 10 kΩ and C = 100 nF. τ = 10 000 × 0.0000001 = 0.001 s = 1 ms. Five τ is 5 ms, longer than most bounce. The pin sees one clean change instead of several. Many makers do this in code instead, but the RC filter works with no software at all.

What is τ for 10 kΩ and 100 µF?

1 s. τ = R × C = 10 000 × 0.0001 = 1 second.

Why place a 100 nF capacitor near a chip's power pin?

To supply short current bursts and filter noise. A small ceramic capacitor close to the pin supplies fast current spikes and shunts noise to ground.

What protects a transistor when a relay coil switches off?

A flyback diode across the coil. The coil's stored energy makes a spike; a diode across it gives that current a safe path.