Given: a load that needs 100 mA from a 5 V supply. The NPN transistor has \(\beta_{\min} = 50\) and \(V_{BE} = 0.7\,\text{V}\text{.}\) The GPIO outputs \(V_{\text{GPIO}} = 3.3\,\text{V}\text{.}\)
Step 1, collector current: the load sets \(I_C = 100\,\text{mA}\text{.}\)
Step 2, minimum base current to saturate:
\begin{equation*}
I_{B,\min} = \frac{I_C}{\beta_{\min}} = \frac{100\,\text{mA}}{50} = 2\,\text{mA}
\end{equation*}
Step 3, apply a safety margin. Component tolerances and temperature variation mean the real \(\beta\) can be lower than the datasheet minimum. A factor of 2 is standard, so target \(I_B = 4\,\text{mA}\text{.}\)
Step 4, voltage across Rlim: Kirchhoff’s voltage law (KVL) around the base-emitter loop gives
\begin{equation*}
V_{R_{\text{lim}}} = V_{\text{GPIO}} - V_{BE} = 3.3 - 0.7 = 2.6\,\text{V}
\end{equation*}
Step 5, resistance:
\begin{equation*}
R_{\text{lim}} = \frac{V_{R_{\text{lim}}}}{I_B} = \frac{2.6\,\text{V}}{4\,\text{mA}} = 650\,\Omega
\end{equation*}
Choose the nearest standard value at or below this (e.g., 620 Ω or 560 Ω) to ensure the transistor stays in saturation.


