---
title: Current mirrors and current sources
heading: Copying a current, and making it stay put
eyebrow: C6 · Lesson 3 · Current mirrors
xp: 40
---

::: hook
Inside an integrated circuit, resistors are large and imprecise but transistors are small, cheap and closely matched. So chips bias everything with currents copied from one reference by **current mirrors**: one transistor sets a $V_{BE}$ or $V_{GS}$ for a known current, and every transistor sharing that voltage carries the same current, or a chosen multiple of it. A mirror is also a nearly ideal current source, with an output resistance far higher than any resistor you could fit, and that's what lets a single stage reach gains in the thousands (lesson 4).
:::

::: play
- A BJT mirror: a reference current of about 1 mA flows through the diode-connected $Q_1$; $Q_2$ shares its base-emitter voltage and copies the current into a load $R_L$.
- Sweep $R_L$: the output current hardly changes, rising slightly as $Q_2$'s collector voltage rises (the Early effect), until $R_L$ is so large that $Q_2$ saturates.
- That near-constant current over a wide range of voltages is what a current source is.
:::
:::

```sim circuit
RREF vcc a 9.3k                     @ 2,-2 down 3
Q1 a a 0 npn BF=100 VAF=50          @ 3,2 left
Q2 o a 0 npn BF=100 VAF=50          @ 4,2
RL vcc o 4.7k                       @ 5,-2 down 3
VCC vcc 0 10                        @ 7,-2 down 5
slider: RL 100..20k log
scope: v(o)
time: 0..1m s
meter: i(RREF), i(Q2), v(o)
```

::: predict
## A BJT mirror (β = 100, $V_A$ = 50 V) has 1 mA of reference current. Its output transistor sits at $V_{CE}$ = 5.4 V. About what does it carry?

- [ ] Exactly 1 mA
- [ ] 0.98 mA
- [x] About 1.07 mA
- [ ] About 2 mA

::: reveal
About 1.07 mA. The two base currents take 2% from the reference, giving 0.98 mA at equal collector voltages; but the output transistor's collector is 4.7 V higher than the reference transistor's, and the Early effect adds about 9%. Mirrors are accurate to a few percent unless the output's voltage is held close to the input's.
:::
:::

::: nameit
## The basic mirror

$Q_1$ is diode-connected, so the reference current sets its $V_{BE}$; $Q_2$ has the same $V_{BE}$, so if the two match it carries the same collector current. The base currents come out of the reference, so for BJTs

$$I_O = \frac{I_\text{ref}}{1 + 2/\beta}\cdot\frac{1 + V_{CE2}/V_A}{1 + V_{BE}/V_A}$$

For MOSFETs there's no gate current, and the copy scales with size:

$$I_O = I_\text{ref}\frac{(W/L)_2}{(W/L)_1}\cdot\frac{1 + \lambda V_{DS2}}{1 + \lambda V_{GS}}$$

**Output resistance:** $R_o = r_{o2}$, which is $V_A/I_O$ or $1/(\lambda I_O)$: tens of kilohms to megohms.

**Compliance:** the output keeps working only while $Q_2$ stays active: $V_{CE2} \gtrsim$ 0.3 V, or $V_{DS2} \ge v_{OV}$.

## Better mirrors

- **Cascode mirror:** a second transistor stacked on the output holds $Q_2$'s voltage still, multiplying the output resistance by about $g_mr_o$: $R_o \approx g_mr_o^2$ for MOSFETs (about $\beta r_o$ for BJTs). It costs headroom: about $V_t + 2v_{OV}$ at the output.
- **Wilson mirror:** feedback around three BJTs cancels most of the base-current error and raises $R_o$.
- **Widlar source:** a resistor $R_E$ in the output transistor's emitter makes a small current from a large reference without a huge resistor, since $I_OR_E = V_T\ln\frac{I_\text{ref}}{I_O}$.
:::

::: example
## A MOSFET mirror copies 100 µA into a device four times wider, with λ = 0.05 V⁻¹, $V_{GS}$ = 0.8 V and the output at 2 V. What comes out, and what does a cascode do to its output resistance?

::: solution
1. **Output current.** The width ratio multiplies the reference by 4, and $(1 + \lambda V_{DS})$ at each side adds the rest:
   $$\begin{aligned} I_O &= 100 \times 4 \times \frac{1.1}{1.04}\ \mu\text{A} \\ &= 423\ \mu\text{A} \end{aligned}$$
2. **Transconductance.** With $v_{OV}$ = 0.2 V,
   $$\begin{aligned} g_m &= \frac{2 \times 0.4\ \text{mA}}{0.2\ \text{V}} \\ &= 4\ \text{mS} \end{aligned}$$
3. **Simple mirror's output resistance.**
   $$\begin{aligned} r_o &= \frac{1}{0.05 \times 0.4\ \text{mA}} \\ &= 50\ \text{k}\Omega \end{aligned}$$
   so the simple mirror's $R_o$ = 50 kΩ.
4. **With a cascode.**
   $$\begin{aligned} R_o &\approx 4\ \text{mS} \times (50\ \text{k}\Omega)^2 \\ &= 10\ \text{M}\Omega \end{aligned}$$

**Answer:** 423 µA comes out, and a cascode raises the output resistance from 50 kΩ to about 10 MΩ.
:::
:::

::: example
## A Widlar source must make 10 µA from a 1 mA reference. What emitter resistor?

::: solution
1. **Emitter resistor.**
   $$\begin{aligned} R_E &= \frac{V_T}{I_O}\ln\frac{I_\text{ref}}{I_O} \\ &= \frac{0.02585 \times \ln 100}{10\ \mu\text{A}} \\ &= 11.9\ \text{k}\Omega \end{aligned}$$
2. **Compare a plain mirror.** A plain mirror would need an output transistor a hundred times smaller than the reference, or a reference resistor of about 1 MΩ.

**Answer:** an 11.9 kΩ emitter resistor.
:::
:::

::: example
## A BJT mirror uses transistors with β = 50. How large is the base-current error of a simple mirror, and of one with a beta helper (an emitter follower that supplies the bases)?

::: solution
1. **Simple mirror.** It loses the two base currents from the reference:
   $$\begin{aligned} I_O &= \frac{I_\text{ref}}{1 + 2/\beta} \\ &= 0.9615I_\text{ref} \end{aligned}$$
   which is 3.8% low.
2. **With a beta helper.** The reference only has to supply the follower's base current, which is $\beta + 1$ times smaller:
   $$\begin{aligned} I_O &= \frac{I_\text{ref}}{1 + \frac{2}{\beta(\beta + 1)}} \\ &= 0.99922I_\text{ref} \end{aligned}$$
   which is 0.08% low.
3. **What the helper costs.** It takes one more $V_{BE}$ of headroom at the reference. Power transistors and lateral PNPs, with low β, are where it matters most.

**Answer:** the simple mirror's output is 3.8% low, and the beta helper cuts the error to 0.08%.
:::
:::

::: check
given: Iref = 0.1 | 1; beta = 50 | 200
answer: Iref/(1 + 2/beta)
unit: mA
tolerance: 0.2%

## A matched BJT mirror with β = {beta} has {Iref} mA of reference current. Ignoring the Early effect, what does it copy?

::: right
Right. $I_\text{ref}/(1 + 2/\beta)$ = {answer}.
:::

::: misses
- [Iref] Close: the two base currents come out of the reference.
- [any] Not yet. Both base currents are supplied by the reference.
:::
:::

::: check
given: Iref = 1 | 2; VA = 30 | 100; VCE = 3 | 10
answer: Iref/1.02*(1 + VCE/VA)/(1 + 0.7/VA)
unit: mA
tolerance: 0.2%

## A BJT mirror (β = 100, $V_A$ = {VA} V) copies {Iref} mA, with its output at $V_{CE}$ = {VCE} V and $V_{BE}$ = 0.7 V. What does it carry?

::: right
Right. {answer}.
:::

::: misses
- [Iref/1.02] Include the Early effect: the output transistor's collector is higher than the reference's.
- [any] Not yet. Base-current correction, then the ratio of the two $(1 + V_{CE}/V_A)$ factors.
:::
:::

::: check
given: Iref = 10 | 50; W1 = 2 | 10; W2 = 20 | 80; lam = 0.02 | 0.1; VDS = 1 | 3
answer: Iref*W2/W1*(1 + lam*VDS)/(1 + lam*0.7)
unit: µA
tolerance: 0.2%

## A MOSFET mirror's reference device is {W1} µm wide and its output device {W2} µm wide (same length). With {Iref} µA in, λ = {lam} V⁻¹, $V_{GS}$ = 0.7 V and the output at {VDS} V, what comes out?

::: right
Right. {answer}.
:::

::: misses
- [Iref*W2/W1] Include channel-length modulation at the two drain voltages.
- [any] Not yet. Scale by $W_2/W_1$, then the λ factors.
:::
:::

::: check
given: VA = 25 | 100; IO = 0.01 | 0.5
answer: VA/IO
unit: kΩ
tolerance: 0.5%

## What output resistance does a basic BJT mirror ($V_A$ = {VA} V) have at {IO} mA?

::: right
Right. $r_{o2} = V_A/I_O$ = {answer}.
:::

::: misses
- [any] Not yet. The output transistor's $r_o$.
:::
:::

::: check
given: ID = 0.05 | 0.5; Vov = 0.15 | 0.3; lam = 0.05 | 0.1
answer: 2*ID/Vov*(1/(lam*ID))^2/1000
unit: MΩ
tolerance: 0.5%

## A MOSFET cascode mirror carries {ID} mA with {Vov} V of overdrive and λ = {lam} V⁻¹. What is its output resistance?

::: right
Right. $g_mr_o^2$ = {answer}.
:::

::: misses
- [1/(lam*ID)/1000] That's a simple mirror; the cascode multiplies it by $g_mr_o$.
- [any] Not yet. $g_m = 2I_D/v_{OV}$, $r_o = 1/(\lambda I_D)$, then $g_mr_o \cdot r_o$.
:::
:::

::: check
given: Iref = 0.5 | 2; IO = 5 | 20
answer: 0.02585*ln(Iref*1000/IO)/(IO*1e-6)/1000
unit: kΩ
tolerance: 0.5%

## A Widlar source makes {IO} µA from {Iref} mA. What emitter resistor does it need?

::: right
Right. $\frac{V_T}{I_O}\ln\frac{I_\text{ref}}{I_O}$ = {answer}.
:::

::: misses
- [any] Not yet. $I_OR_E = V_T\ln(I_\text{ref}/I_O)$.
:::
:::

::: check
given: Vt = 0.4 | 0.6; Vov = 0.15 | 0.3
answer: Vt + 2*Vov
unit: V
tolerance: 0.5%

## How low can a MOSFET cascode mirror's output go ($V_t$ = {Vt} V, {Vov} V of overdrive) before it stops working?

::: right
Right. About $V_t + 2v_{OV}$ = {answer}.
:::

::: misses
- [Vov] That's a simple mirror's limit; the cascode stacks a second device.
- [any] Not yet. The cascode device's gate sits a $V_{GS}$ above the lower device's gate.
:::
:::

::: check
kind: parts
given: b = 20 | 50 | 150; I = 0.1 | 1

## A BJT mirror with β = {b} has a {I} mA reference.

::: part
answer: I/(1 + 2/b)
unit: mA
tolerance: 0.5%

### What does a simple mirror deliver?

::: misses
- [I] The two base currents come out of the reference.
- [any] $\frac{I_\text{ref}}{1 + 2/\beta}$.
:::
:::

::: part
answer: (1/(1 + 2/(b*(b + 1))) - 1)*100
unit: %
tolerance: 0.5%

### What's the percentage error of one with a beta helper?

::: misses
- [(1/(1 + 2/b^2) - 1)*100] Close; the helper's base current is $\frac{2I_B}{\beta + 1}$.
- [any] $\frac{I_\text{ref}}{1 + \frac{2}{\beta(\beta + 1)}}$.
:::
:::
:::

::: check
kind: derivation
vars: I = 0.000001..0.01, J = 0.0000001..0.001, T = 0.02..0.03

## A Widlar source makes a small current J from a reference I, at thermal voltage T.

::: step
answer: T*ln(I/J)

### What voltage must the emitter resistor drop?
:::

::: step
answer: T*ln(I/J)/J

### What emitter resistor?
:::

::: step
answer: T*ln(I/J)/J/(T/J)

### How many times the output transistor's $r_e$ is that?
:::

::: right
Right. The resistor is $\ln\frac{I_\text{ref}}{I_O}$ times $r_e$: modest, which is the point.
:::
:::

::: explain
## Why does a current mirror depend on the transistors being matched?

::: model
A mirror doesn't measure the reference current and copy it; it copies a voltage. The reference current sets the diode-connected transistor's $V_{BE}$ or $V_{GS}$, and the output transistor, sharing that voltage, carries whatever current that voltage produces in it. That's the same current only if the two transistors follow the same law, with the same $I_S$ or K and threshold. Transistors made side by side on one chip match to a fraction of a percent, which is why mirrors are the standard way to bias integrated circuits, and why they work poorly with separate discrete transistors.
:::
:::

::: practice

::: check
given: VCC = 5 | 15; R = 4.3 | 22
answer: (VCC - 0.7)/R
unit: mA
tolerance: 0.5%

## A BJT mirror's reference resistor of {R} kΩ runs from {VCC} V. What reference current flows?

::: misses
- [any] $(V_{CC} - 0.7)/R$.
:::
:::

::: check
given: Iref = 20 | 100; k = 2 | 8
answer: Iref*k
unit: µA
tolerance: 0.5%

## An ideal MOSFET mirror's output device is {k} times wider than its reference. With {Iref} µA in, what comes out?

::: misses
- [any] Scaled by the width ratio.
:::
:::

::: check
given: lam = 0.02 | 0.1; ID = 0.1 | 1
answer: 1/(lam*ID)
unit: kΩ
tolerance: 0.5%

## What is the output resistance of a simple MOSFET mirror with λ = {lam} V⁻¹ at {ID} mA?

::: misses
- [any] $1/(\lambda I_D)$.
:::
:::
:::
