---
title: Bipolar lab
heading: Gummel numbers, current gain, Early voltage, f_T and saturation, in Python
eyebrow: S1 · Lesson 31 · Bipolar lab
xp: 60
---

::: hook
A bipolar transistor's datasheet numbers all trace back to its base: the charge in it sets the saturation current, recombination in and around it sets the gain at low current, its width modulation sets the Early voltage, and the time carriers spend crossing it sets the speed. This lab turns each of those relations into a short Python model, the kind used to fit a compact model to measured Gummel plots and output curves.
:::

::: play
- The curve is current gain against collector current, from three parts of the base current: the ideal $I_C/\beta_F$, recombination in the emitter-base depletion region growing as $\sqrt{I_C}$, and high injection, which cuts the gain at large currents.
- Raise the recombination current: gain falls at low currents and the peak moves up.
- Lower the knee current: gain falls sooner at high currents.
:::

```sim plot
view: graph
x: I = 1e-9..0.1 A log
y: b = 0..250
slider: e = 1..100 = 20 log
slider: k = 0.005..0.5 = 0.05 A log
plot: I/(I*(1 + I/k)/200 + e*1e-14*sqrt(I/1e-15)) | label: current gain
```

::: predict
## A base doped $2 \times 10^{17}$ cm⁻³ for 0.1 µm and $5 \times 10^{16}$ for 0.1 µm has the same Gummel number as what uniform base 0.2 µm wide?

- [ ] $10^{17}$ cm⁻³
- [x] $1.25 \times 10^{17}$ cm⁻³
- [ ] $2 \times 10^{17}$ cm⁻³
- [ ] $5 \times 10^{16}$ cm⁻³

::: reveal
The Gummel number is the base's total charge per area, $\int N\,dx = 2 \times 10^{12} + 0.5 \times 10^{12} = 2.5 \times 10^{12}$ cm⁻², which spread over 0.2 µm is $1.25 \times 10^{17}$. Only the integral matters for the saturation current, not the shape.
:::
:::

::: nameit
## The models

- **Saturation current:** $I_S = qAD_nn_i^2/G_B$ with Gummel number $G_B = \int N_B\,dx$.
- **Gain:** $I_B = \frac{I_C(1 + I_C/I_{KF})}{\beta_F} + I_{SE}\sqrt{I_C/I_S}$; its peak is at $I_C^* = \left(\frac{\beta_FI_{KF}I_{SE}}{2\sqrt{I_S}}\right)^{2/3}$.
- **Early voltage:** extrapolate the active-region output curve back to $I_C$ = 0; the intercept is $-V_A$.
- **Speed:** $\frac{1}{2\pi f_T} = \tau_F + \frac{(C_{je} + C_{jc})V_T}{I_C}$.
- **Saturation:** Ebers–Moll gives $V_{CE,\text{sat}} = V_T\ln\dfrac{1/\alpha_R + (I_C/I_B)/\beta_R}{1 - (I_C/I_B)/\beta_F}$.
:::

::: check
kind: python

## Write `gummel_is(A, Dn, N, dx, ni=1e10)`: the base doping is the list N (cm⁻³) on a grid of spacing dx (cm); return ($I_S$, Gummel number).

```python starter
def gummel_is(A, Dn, N, dx, ni=1e10):
    return (0.0, 0.0)
```

```python solution
Q = 1.602e-19

def gummel_is(A, Dn, N, dx, ni=1e10):
    G = sum(n * dx for n in N)
    return (Q * A * Dn * ni * ni / G, G)
```

```python tests
Is, G = gummel_is(1e-5, 20.7, [1e17] * 200, 0.2e-4 / 200)
assert abs(G - 2e12) / 2e12 < 1e-9 and abs(Is - 1.658e-15) / 1.658e-15 < 1e-3, "Uniform 1e17 over 0.2 µm: G = 2e12, IS = 1.66e-15 A."
Is2, G2 = gummel_is(1e-5, 20.7, [2e17] * 100 + [5e16] * 100, 0.2e-4 / 200)
assert abs(G2 / 0.2e-4 - 1.25e17) / 1.25e17 < 1e-9, "The two-step base equals 1.25e17 uniform."
```

::: right
Right. The saturation current falls in proportion to the base charge: doping or widening the base cuts it.
:::
:::

::: check
kind: python

## Write `beta(IC, bF, IKF, ISE, IS)` from the gain model above, and `beta_peak(bF, IKF, ISE, IS)`: the collector current where gain peaks.

```python starter
import math

def beta(IC, bF, IKF, ISE, IS):
    return bF

def beta_peak(bF, IKF, ISE, IS):
    return 1e-3
```

```python solution
import math

def beta(IC, bF, IKF, ISE, IS):
    IB = IC * (1 + IC / IKF) / bF + ISE * math.sqrt(IC / IS)
    return IC / IB

def beta_peak(bF, IKF, ISE, IS):
    return (bF * IKF * ISE / (2 * math.sqrt(IS))) ** (2 / 3)
```

```python tests
p = beta_peak(200, 0.05, 2e-13, 1e-15)
assert abs(p - 1e-3) / 1e-3 < 1e-9, "The peak sits at 1 mA for these values."
b = beta(p, 200, 0.05, 2e-13, 1e-15)
assert abs(b - 188.68) < 0.01, "Peak gain 188.7."
assert beta(0.9 * p, 200, 0.05, 2e-13, 1e-15) < b and beta(1.1 * p, 200, 0.05, 2e-13, 1e-15) < b, "It's a maximum."
assert beta(1e-8, 200, 0.05, 2e-13, 1e-15) < 50, "At 10 nA recombination drags the gain down."
```

::: right
Right. Setting the derivative of $I_B/I_C$ to zero gives the peak in closed form.
:::
:::

::: check
kind: python

## Write `early(VCE, IC)`: fit a straight line to active-region (VCE, IC) points by least squares and return the Early voltage, the magnitude of the line's intercept on the VCE axis.

```python starter
def early(VCE, IC):
    return 100.0
```

```python solution
def early(VCE, IC):
    n = len(VCE)
    mx, my = sum(VCE) / n, sum(IC) / n
    b = sum((x - mx) * (y - my) for x, y in zip(VCE, IC)) / sum((x - mx) ** 2 for x in VCE)
    a = my - b * mx
    return a / b
```

```python tests
V = [1, 2, 3, 4, 5]
assert abs(early(V, [1e-3 * (1 + v / 50) for v in V]) - 50) < 1e-9, "Exactly linear data: VA = 50 V."
assert abs(early(V, [2e-3 * (1 + v / 80) for v in V]) - 80) < 1e-9, "Independent of the current level."
```

::: right
Right. All the output curves of one transistor point back to roughly the same intercept: that's what makes $V_A$ a single parameter.
:::
:::

::: check
kind: python

## Write `ft(IC, tauF, C)`: $f_T$ from $1/(2\pi f_T) = \tau_F + CV_T/I_C$, and `ic_for_frac(tauF, C, frac)`: the collector current at which $f_T$ reaches the given fraction of its limit $1/(2\pi\tau_F)$.

```python starter
import math

def ft(IC, tauF, C):
    return 0.0

def ic_for_frac(tauF, C, frac):
    return 0.0
```

```python solution
import math

VT = 0.02585

def ft(IC, tauF, C):
    return 1 / (2 * math.pi * (tauF + C * VT / IC))

def ic_for_frac(tauF, C, frac):
    return C * VT / (tauF * (1 / frac - 1))
```

```python tests
assert abs(ft(1e-3, 5e-12, 50e-15) / 1e9 - 25.29) < 0.01, "1 mA: 25.3 GHz."
assert abs(ft(10e-3, 5e-12, 50e-15) / 1e9 - 31.03) < 0.01, "10 mA: 31.0 GHz, approaching the 31.8 GHz limit."
i = ic_for_frac(5e-12, 50e-15, 0.9)
assert abs(ft(i, 5e-12, 50e-15) * 2 * math.pi * 5e-12 - 0.9) < 1e-9, "At that current fT is 90% of its limit."
```

::: right
Right. At low currents the junction capacitances' charging time dominates; at high currents the transit time sets the limit.
:::
:::

::: check
kind: python

## Write `vcesat(IC, IB, bF, bR)`: the Ebers–Moll saturation voltage, with $\alpha_R = \beta_R/(1 + \beta_R)$. Return `None` if $I_C/I_B \ge \beta_F$ (not saturated).

```python starter
def vcesat(IC, IB, bF, bR):
    return 0.2
```

```python solution
import math

VT = 0.02585

def vcesat(IC, IB, bF, bR):
    f = IC / IB
    if f >= bF:
        return None
    aR = bR / (1 + bR)
    return VT * math.log((1 / aR + f / bR) / (1 - f / bF))
```

```python tests
assert abs(vcesat(10e-3, 1e-3, 100, 1) - 0.0670) < 1e-4, "Forced β of 10: 67 mV, as in lesson 27."
assert vcesat(10e-3, 0.05e-3, 100, 1) is None, "Forced β 200 exceeds βF: not saturated."
assert vcesat(10e-3, 2e-3, 100, 1) < vcesat(10e-3, 1e-3, 100, 1), "More base drive: deeper saturation, lower VCE."
```

::: right
Right. Overdriving the base pushes $V_{CE,\text{sat}}$ down toward $V_T\ln(1/\alpha_R)$, at the cost of more stored charge and slower turn-off.
:::
:::

::: explain
## Why does a bipolar transistor's current gain fall at both low and high collector currents?

::: model
At low currents a significant part of the base current comes from recombination in the emitter-base depletion region and at surfaces, which grows only as the square root of the collector current, so it makes up a larger fraction of the base current the smaller the collector current is, and the gain falls. At high currents the injected electron density in the base becomes comparable to the base doping, so the base effectively gets more heavily doped, the emitter's injection efficiency drops and the collector current grows more slowly than the base current. The gain peaks in between, where the ideal diffusion currents dominate.
:::
:::
