37. Design NPN switch

Circuit

Loading simulator…

Design Approach

A 3.3 V GPIO cannot conveniently drive a 12 V, roughly 80 mA load directly. An NPN transistor handles the larger load current, while a base resistor limits how much current the control pin must supply.

How the Circuit Works

  1. Use low-side switching. The supplied Q1 has its emitter returned to ground and its collector connected to R_LOAD = 150 Ω and the 12 V supply. A HIGH base drive allows Q1 to complete the load current path.
  2. Set the base current. For CTRL_IN = 3.3 V, with approximately 0.7 V across the base-emitter junction, the solution adds R_B = 1 kΩ. Estimated base current is:IB≈3.3V−0.7V1kΩ=2.6mAI_{\mathrm{B}}\approx\frac{3.3\,\mathrm{V}-0.7\,\mathrm{V}}{1\,\mathrm{k}\Omega}=2.6\,\mathrm{mA}

    This falls inside the 2–3 mA range.

  3. Check load operation. With the transistor driven strongly ON, load current is approximately 12−VCE(sat)150Ω\frac{12 - V_{\mathrm{CE}}(\mathrm{sat})}{150\,\Omega}, close to 79 mA for a small saturation drop—above the 75 mA minimum.
  4. Check the OFF state. When CTRL_IN = 0 V, base current falls near zero, Q1 cuts off, and the load no longer has a complete path to ground.

Verify the Circuit

Test CTRL_IN = 0 V and 3.3 V. Check I_LOAD < 0.1 mA with the input LOW, and ILOAD≥75mAI_{\mathrm{LOAD}} \ge 75\,\mathrm{mA} with I_B between 2 mA and 3 mA when HIGH.

Key Learnings

  • A BJT lets a small control current switch a larger load current.
  • Base drive must be sized for reliable switching, not merely for operation in the transistor’s active region.