\section{Bipolar junction transistor (BJT)}
\begin{figure}[h]
    \centering
    \caption{BJT}
    \includegraphics[width=.75\textwidth]{imgs/bjt_terminals_and_functioning.png}
\end{figure}

But what's going on?
If $V_{BE}>0$ injection of electrons from E to B, of holes from B to E.
If  $V_{BC}<0$  extraction of electrons from B to C, of holes from C to B.


\subsection{BJT characteristics}
\begin{align}
    I_E & = -I_C-I_B \\
    \begin{split}
        \beta &= \frac{I_C}{I_B}
        =\frac{n_{pB_0}\frac{D_n}{W_B}}{p_{nE_0}\frac{D_p}{W_E}}\\
        &=  \frac{N_{dE} D_n W_E}{N_{aB} D_p W_B}
    \end{split}
\end{align}

Collector current,
focus on electron diffusion in base:
\begin{align}
    n_{pB}(0) & =n_{pB_0}e^{\frac{qV_{BE}}{kT}}                                                     \\
    n_{pB}(x) & =n_{pB}(0)(1-\frac{x}{W_B})                                                         \\[1em]
    \begin{split}
        J_{nB} &= qD_n\frac{\mathrm{d} n_{pB}}{\mathrm{d}x}\\
        &= -qD_n\frac{n_{pB}(0)}{W_B}
    \end{split} \\
    \begin{split}
        I_C &=-J_{nB}A_E\\
        &=qA_E\frac{E_n}{W_B}n_{pB_0}e^{\frac{qV_{BE}}{kT}}
    \end{split}                        \\
    I_C       & = I_Se^{\frac{qV_{BE}}{kT}}
\end{align}
Base current,
focus on hole injection and recombination in emitter:
\begin{align}
    p_{nE}(-x_{BE})     & =p_{nE_0}e^{-\frac{qV_{BE}}{kT}}                                                                                        \\
    p_{nE}(-W_E-x_{BE}) & =p_{nE_0}                                                                                                               \\
    p_{nE}(x)           & =\left[ p_{nE}(-x_{BE}-p_{nE_0}) \right]\left( 1+\frac{x+x_{BE}}{W_E} \right)+P_{nE_0} & \leftarrow \text{Hole Profile} \\[1em]
    \begin{split}
        J_{pE}&=-qD_p\frac{\mathrm{d}p_{nE}}{\mathrm{d}x}\\
        &=-qD_p\frac{p_{nE(-x_{BE})-p_{nE_0}}}{W_E}
    \end{split}                                                                                              \\
    \begin{split}
        I_B&=-J_{pE}A_E\\
        &=qA_E\frac{D_p}{W_E}p_{nE_0}\left( e^{\frac{qV_{VE}}{kT}} -1 \right)
    \end{split}                     \\
    I_B                 & =\frac{I_S}{\beta}\left(e^{\frac{qV_{BE}}{kT}}-1\right)                                                                 \\
    I_B\approx\frac{I_C}{\beta}
\end{align}

\subsubsection{`Good' transistor}
We want  collector and emitter current to be identical and so we define $\alpha$ as measurement of how close we are:
\begin{align}
    I_C   & =-\alpha I_E                \\
          & =\alpha\left(I_B+I_C\right) \\
          & =\frac{\alpha}{1-\alpha}I_B \\
          & =\beta I_B                  \\
    \beta & =\frac{\alpha}{1-\alpha}
\end{align}

\subsection{Summary forward active}
\begin{align}
    I_C & = I_Se^{\frac{qV_{BE}}{kT}}                              \\
    I_B & = \frac{I_S}{\beta}\left(e^{\frac{qV_{BE}}{kT}}-1\right) \\
    I_E & = -I_C-I_B
\end{align}

For reverse, it is the same but $\beta_R\approx [0.1,5]\ll\beta$.

\subsection{Summary cut-off}
\begin{alignat}{2}
    I_{B1} & = -\frac{I_S}{\beta}  &  & =-I_E \\
    I_{B2} & =-\frac{I_S}{\beta_R} &  & =-I_C
\end{alignat}

\subsection{Summary saturation}
\begin{align}
    I_C & =I_S\left(e^{\frac{qV_{BE}}{kT}} - e^{\frac{qV_{BC}}{kT}}\right)-\frac{I_S}{\beta_R}\left( e^\frac{qV_{BC}}{kT} - 1 \right)  \\
    I_B & =\frac{I_S}{\beta}\left( e^{\frac{qV_{BE}}{kT}}-1 \right)+\frac{I_S}{\beta_R}\left( e^{\frac{qV_{BC}}{kT}} -1 \right)        \\
    I_E & =\frac{I_S}{\beta}\left(e^{\frac{qV_{BE}}{kT}} - 1\right) - I_S\left( e^{\frac{qV_{BE}}{kT}} -e^{\frac{qV_{BC}}{kT}} \right)
\end{align}

\subsection{Ebers-Moll model}
\begin{center}
    \begin{circuitikz}
        \draw (0,0) node[left] {B} to [short,*-] ++(1,0)
        to [Do,l=$\frac{I_S}{\beta_R}\left( e^{\frac{qV_{BC}}{kT}} -1 \right)$] ++(0,2)
        to [short] ++(2,0)
        to [I,l=$I_S\left( e^{\frac{qV_{BE}}{kT}} - e^{\frac{qV_{BC}}{kT}} \right)$,i=$$] ++(0,-4)
        to [short] ++(-1,0);
        \draw (1,0) to [Do,l_=$\frac{I_S}{\beta}\left( e^{\frac{qV_{BE}}{kT}}-1 \right)$] ++(0,-2)
        to [short] ++(1,0)
        to [short,-*] ++(0,-1) node [below] {E};
        \draw (2,2) to [short,-*] ++(0,1) node[above] {C};
    \end{circuitikz}
\end{center}

\subsection{Early effect}
With increasing $V_{CE}$, the depletion region inceases.
To not have to deal with that, we introduce a correction factor
\begin{equation}
    I_C = I_S e^{\frac{V_{BE}}{V_{th}}}\left(1+\frac{V_{CE}}{V_A}\right)
\end{equation}

\subsection{Transfer characteristics}
We evaluate the transistor at its operating point ($OP$ or $Q=(V_{BE},V_{CE})$) to find the transconductance $g_m$.
\begin{equation}
    \label{label:eq:bjt_transconductance}
    g_m = \left. \frac{\partial i_C}{\partial V_{BE}} \right|_{OP} = \frac{qI_C}{kT}
\end{equation}

