Ground Embedded KO Subscribe

Notes / Circuit Theory

Capacitors and the RC time constant

A capacitor resists sudden changes in voltage. τ = RC is the time to charge to 63%, and by 5τ it is almost full.

GROUND EMBEDDED · NOTECircuit Theory 07Capacitors and the RC time constantτ = RC63%RC

A capacitor is a part that holds charge. As current flows in, the voltage rises gradually, and changing the voltage instantly would take infinite current. So the voltage across a capacitor does not change suddenly.

RC charging

Charging capacitor C through resistor R:

V(t) = Vin × (1 - e^(-t/RC))

Time Charge level
1τ 63%
3τ 95%
5τ 99%

Example: 10 kΩ, 100 nF → τ = 1 ms. On a reset pin, it holds reset for about 1 ms after power comes up.

Where you meet it in embedded work

  • Button debouncing: RC smooths the few ms of bounce from mechanical contacts.
  • Power-on reset delay: the RC on the MCU reset pin
  • ADC input filter: removes high-frequency noise
  • Decoupling: when a chip pulls a burst of current, the nearby capacitor supplies it first

Energy

The energy stored in a capacitor is ½CV². A large electrolytic keeps a dangerous voltage for a while after power is removed, so confirm it is discharged before working on an inverter.

In a picture: the charging curve

Vs1τ63%3τ95%5τ99%0
The voltage while a capacitor charges through a resistor. Each time τ = R × C passes, 63% of the remaining difference is filled.

τ = R × C is called the time constant. With 10 kΩ and 100 nF it is 10000 × 0.0000001 = 1 ms.

Elapsed time Fraction charged Use
1τ 63% Definition of the time constant
2.2τ About 90% Rise time from 10% to 90%
3τ 95% Roughly full
5τ 99% Taken as completely full

Use 1: button debounce

Button contacts make and break repeatedly for a few ms when pressed. Add 10 kΩ and 100 nF (τ = 1 ms) and the bounce is smeared out, so the MCU sees one smooth change. To do it in software, read twice 10 to 20 ms apart and accept the value only when both agree.

3D labRun what you have read so far→

Use 2: low-pass filter

An RC circuit reduces changes faster than fc = 1 / (2π R C).

R = 1 kΩ, C = 100 nF  →  fc ≈ 1.6 kHz

Pass 20 kHz PWM through this filter and what comes out is close to the average voltage. This is how a simple analog voltage is made from PWM. The lower the cut-off, though, the smaller the ripple and the slower the value changes.

Use 3: reset delay

To hold the reset pin LOW briefly when power comes up, use a pull-up resistor and a capacitor. With 10 kΩ and 100 nF it takes about 1.2 ms for the reset pin to reach the HIGH threshold (about 0.7 × VDD). In that time the supply and clock settle.

What a decoupling capacitor does

A chip draws a large current for an instant when it switches. The supply trace has inductance and cannot deliver that current straight away, so the 100 nF capacitor right next to the chip's power pin supplies it. Further from the pin the trace inductance makes the effect fall off sharply, so place it as close as possible.

Problems that come up in practice

  • Ceramic capacitors losing capacitance: near the rated voltage the capacitance can fall to half or less. For a 5 V circuit choose a rating of 16 V or more.
  • Electrolytic capacitor polarity: fitted backwards, it swells or bursts.
  • Inrush current of large capacitors: at the instant power is applied, a discharged capacitor looks like a short. Check that the fuse or regulator withstands this current.
3D LABBasic Circuit BenchRun what this note explains and watch it respond.Open the lab →FREE PDFGet the 3 free ebooksIf you want to keep reading this topic as one book: BLDC motor control, serial communication and sensors at book length. PDFs are in Korean.Get them free →