---
title: Switched-capacitor circuits
heading: Resistors from capacitors, charge pumps and sample-and-hold
eyebrow: C2 · Lesson 22 · Switched capacitors
xp: 40
---

::: hook
Inside a chip, a precise 1 MΩ resistor would be enormous, but a 10 pF capacitor flipped back and forth by a pair of switches 100,000 times a second carries charge exactly as a 1 MΩ resistor would, and its value is set by a clock and a capacitor ratio that chips make very accurately. Switches and capacitors also double voltages without inductors, as in the charge pumps that make the ±10 V for an RS-232 port from 3.3 V, and they freeze a changing voltage for an analog-to-digital converter to read. All of this comes from moving packets of charge.
:::

::: play
- A charge-pump voltage doubler: a "flying" capacitor $C$ charges to $V_\text{in}$, then switches on top of $V_\text{in}$ to charge the output. The line is the output voltage against load current.
- With no load the output is $2V_\text{in}$. Each milliamp of load costs $\frac{1}{fC}$ volts per amp: the pump behaves like a source with that output resistance.
- Raise the switching frequency or the capacitor to stiffen it. The efficiency readout shows the cost of a heavy load.
:::
:::

```sim plot
view: graph
x: I = 0..20 mA
y: V = 0..10 V
slider: Vin = 1.8..5 step 0.1 = 3.3 V
slider: f = 10..1000 = 100 kHz log
slider: C = 0.1..10 = 1 µF log
slider: I0 = 0..20 step 0.5 = 5 mA
plot: 2*Vin - (I/1000)/(f*1000*C*1e-6) | label: output voltage
readout: output resistance, Ω = 1/(f*1000*C*1e-6) | digits: 3
readout: efficiency at the marked load, % = 100*(2*Vin - (I0/1000)/(f*1000*C*1e-6))/(2*Vin) | digits: 3
marker: x = I0 | label: load
```

::: predict
## A 10 pF capacitor is switched between two nodes 100,000 times a second. What resistance does it imitate?

- [ ] 10 Ω
- [ ] 100 kΩ
- [x] 1 MΩ
- [ ] It can't act like a resistor

::: reveal
1 MΩ. Each cycle carries a charge $C\Delta V$ from one node to the other, so the average current is $fC\Delta V$, proportional to the voltage difference: a resistance of $\frac{1}{fC} = \frac{1}{10^5 \times 10^{-11}} = 1$ MΩ. Change the clock and the resistance changes with it.
:::
:::

::: nameit
## The switched-capacitor resistor

A capacitor $C$ alternately connected to node 1 (at $V_1$) and node 2 (at $V_2$), $f$ times a second, picks up charge $CV_1$ and drops it at $CV_2$, carrying $C(V_1 - V_2)$ per cycle. The average current is

$$I = fC(V_1 - V_2) \quad\Rightarrow\quad R_\text{eq} = \frac{1}{fC}$$

Switched-capacitor filters on chips use this: time constants become ratios of capacitors times the clock period, which are accurate to a fraction of a percent, unlike on-chip resistors.

## Charge pumps

A **doubler** charges a flying capacitor to $V_\text{in}$, then stacks it on top of $V_\text{in}$ to charge the output capacitor toward $2V_\text{in}$. Under a load $I_\text{out}$, each cycle tops up the charge the load drew, and the output sags:

$$V_\text{out} \approx 2V_\text{in} - \frac{I_\text{out}}{fC}$$

The input supplies twice the output current, so the efficiency is $\frac{V_\text{out}}{2V_\text{in}}$: the shortfall is the charge-sharing loss of lesson 3. Swapping the switching order makes an **inverter**, $-V_\text{in}$.

## Sample-and-hold

A switch charges a capacitor to the input voltage, then opens and holds it while a converter reads it.

- **Acquisition:** the capacitor charges through the switch's resistance, so the switch must stay closed for several RC time constants.
- **Droop:** leakage current $I$ drains the held voltage at $\frac{I}{C}$ volts per second.
- **Noise:** opening the switch freezes in a random thermal voltage of RMS size $\sqrt{kT/C}$, about 64 µV for 1 pF at room temperature, which sets a floor on how small the capacitor can be.
:::

::: example
## A 3.3 V doubler uses a 1 µF flying capacitor at 100 kHz and supplies 5 mA. What does it output, and how efficiently?

::: solution
1. **Output resistance.**
   $$\begin{aligned} R_\text{out} &= \frac{1}{fC} \\ &= \frac{1}{10^5 \times 10^{-6}}\ \Omega \\ &= 10\ \Omega \end{aligned}$$
2. **Output voltage.**
   $$\begin{aligned} V_\text{out} &= (6.6 - 0.005 \times 10)\ \text{V} \\ &= 6.55\ \text{V} \end{aligned}$$
3. **Efficiency.**
   $$\begin{aligned} \eta &= \frac{6.55}{6.6} \\ &= 99.2\% \end{aligned}$$
4. **At a heavier load.** At 100 mA it would sag to 5.6 V and only 85%.

**Answer:** it outputs 6.55 V at 99.2% efficiency.
:::
:::

::: example
## A sample-and-hold uses 100 pF with 1 nA of leakage and holds for 1 ms. How much does it droop?

::: solution
1. **Droop.**
   $$\begin{aligned} \Delta V &= \frac ICt \\ &= \frac{10^{-9}}{10^{-10}} \times 10^{-3}\ \text{V} \\ &= 10\ \text{mV} \end{aligned}$$
2. **Compare with the converter.** That's too much for a 12-bit converter on a 3.3 V scale (an LSB is 0.8 mV): a larger capacitor or a shorter hold is needed.

**Answer:** it droops 10 mV, too much for a 12-bit converter on a 3.3 V scale.
:::
:::

::: example
## A 1 pF capacitor is switched between two nodes at 1 MHz. What resistance does it act like, and what corner frequency does it make with a 10 pF integrating capacitor?

::: solution
1. **Average current.** Each cycle it carries a charge CΔV from one node to the other, so the average current is $fC\Delta V$.
2. **Equivalent resistance.**
   $$\begin{aligned} R_{eq} &= \frac{1}{fC} \\ &= \frac{1}{10^6 \times 10^{-12}}\ \Omega \\ &= 1\ \text{M}\Omega \end{aligned}$$
3. **Corner frequency.** With a 10 pF integrator the time constant is
   $$\begin{aligned} \tau &= R_{eq}C_2 \\ &= 10\ \mu\text{s} \end{aligned}$$
   a corner of 15.9 kHz.
4. **Why chips use it.** The corner depends on a capacitor ratio and the clock, both easy to control on a chip, where a precise 1 MΩ resistor would be huge and drift with temperature.

**Answer:** it acts like 1 MΩ, and with the 10 pF integrating capacitor it makes a corner at 15.9 kHz.
:::
:::

::: check
given: f = 10 | 100 | 1000; C = 1 | 10 | 100
answer: 1/(f*1000*C*1e-12)/1e6
unit: MΩ
tolerance: 0.5%

## A {C} pF capacitor is switched at {f} kHz. What resistance does it imitate?

::: right
Right. $\frac{1}{fC}$ = {answer}.
:::

::: misses
- [1/(2*pi*f*1000*C*1e-12)/1e6] That's a capacitor's reactance; a switched capacitor gives $1/(fC)$.
- [any] Not yet. $R = 1/(fC)$.
:::
:::

::: check
given: f = 50 | 500; C = 2 | 20; dV = 1 | 3
answer: f*1000*C*1e-12*dV*1e6
unit: µA
tolerance: 0.5%

## A {C} pF capacitor ferries charge between nodes {dV} V apart at {f} kHz. What average current flows?

::: right
Right. $fC\Delta V$ = {answer}.
:::

::: misses
- [any] Not yet. Charge per cycle times cycles per second.
:::
:::

::: check
given: Vin = 3.3 | 5; Io = 10 | 30; f = 50 | 100; C = 0.47 | 1
answer: 2*Vin - (Io/1000)/(f*1000*C*1e-6)
unit: V
tolerance: 0.5%

## A doubler from {Vin} V switches a {C} µF flying capacitor at {f} kHz and supplies {Io} mA. What is its output?

::: right
Right. $2V_\text{in} - \frac{I}{fC}$ = {answer}.
:::

::: misses
- [2*Vin] That's with no load.
- [any] Not yet. Output resistance $1/(fC)$.
:::
:::

::: check
given: Vin = 3.3 | 5; Vout = 5.5 | 6.2 | 9
answer: 100*Vout/(2*Vin)
tolerance: 0.5%

## A doubler from {Vin} V delivers its load current at {Vout} V. What is its efficiency?

::: right
Right. The input supplies twice the output current: $\frac{V_\text{out}}{2V_\text{in}}$ = {answer}%.
:::

::: misses
- [100*Vout/Vin] The input current is twice the output current.
- [any] Not yet. Power out over power in, with $I_\text{in} = 2I_\text{out}$.
:::
:::

::: check
given: I = 0.1 | 1 | 10; C = 10 | 100; t = 10 | 1000
answer: I*1e-9/(C*1e-12)*t*1e-6*1000
unit: mV
tolerance: 0.5%

## A hold capacitor of {C} pF with {I} nA of leakage holds for {t} µs. How much does it droop?

::: right
Right. $\frac{I}{C}t$ = {answer}.
:::

::: misses
- [any] Not yet. Leakage removes charge $It$.
:::
:::

::: check
given: C = 0.1 | 1 | 10
answer: sqrt(1.381e-23*300/(C*1e-12))*1e6
unit: µV
tolerance: 0.5%

## What RMS noise voltage does sampling onto {C} pF freeze in at 300 K?

::: right
Right. $\sqrt{kT/C}$ = {answer}.
:::

::: misses
- [1.381e-23*300/(C*1e-12)*1e6] Take the square root: $\sqrt{kT/C}$ is a voltage.
- [any] Not yet. $\sqrt{kT/C}$ with $k = 1.381 \times 10^{-23}$ J/K.
:::
:::

::: check
kind: parts
given: C = 0.5 | 1 | 5; f = 0.1 | 1; k = 10 | 20

## A {C} pF capacitor is switched at {f} MHz and feeds an integrating capacitor {k} times larger.

::: part
answer: 1/(f*1e6*C*1e-12)/1e6
unit: MΩ
tolerance: 0.5%

### What resistance does it act like?

::: misses
- [any] $R = \frac{1}{fC}$.
:::
:::

::: part
answer: f*1e6/(2*pi*k)/1000
unit: kHz
tolerance: 0.5%

### What corner frequency does the integrator have?

::: misses
- [any] $\frac{1}{2\pi R C_2} = \frac{fC_1}{2\pi C_2}$.
:::
:::
:::

::: check
kind: derivation
vars: C = 0.0000000000001..0.000000001, f = 1000..10000000, V = 0.1..5

## A capacitor C is switched at f between nodes differing by V.

::: step
answer: C*V

### How much charge does it move each cycle?
:::

::: step
answer: f*C*V

### What's the average current?
:::

::: step
answer: 1/(f*C)

### What resistance does that look like?
:::

::: right
Right. Doubling the clock halves the equivalent resistance.
:::
:::

::: explain
## Why do chip designers build filters from switched capacitors instead of resistors and capacitors?

::: model
An integrated resistor's value can be off by 20% or more and drifts with temperature, so an on-chip RC time constant is imprecise. A switched-capacitor circuit replaces each resistor with a capacitor toggled by a clock, so every time constant becomes a ratio of two capacitors times the clock period. Capacitors made side by side on one chip match each other to a fraction of a percent, and the clock can be crystal-accurate, so the filter's frequencies come out precise. Changing the clock also retunes the whole filter.
:::
:::

::: practice

::: check
given: R = 1 | 10; f = 10 | 100
answer: 1/(R*1e6*f*1000)*1e12
unit: pF
tolerance: 0.5%

## What capacitor, switched at {f} kHz, imitates {R} MΩ?

::: misses
- [any] $C = 1/(fR)$.
:::
:::

::: check
given: Vin = 1.8 | 2.5 | 3.3 | 5 | 9
answer: -Vin
unit: V
tolerance: 0.5%

## What does an unloaded inverting charge pump make from {Vin} V?

::: misses
- [any] $-V_\text{in}$.
:::
:::

::: check
given: I = 1 | 10; C = 1 | 10
answer: I/C
unit: V/s
tolerance: 0.5%

## How fast does {I} nA of leakage drain {C} nF?

::: misses
- [any] $I/C$.
:::
:::
:::
