40. Control high-side load

Circuit

Loading simulator…

Design Approach

A 3.3 V GPIO cannot turn a 12 V PNP high-side switch off simply by driving its base to 3.3 V. The solution uses an NPN transistor to translate the low-voltage control into a safe drive signal for a PNP transistor connected to the 12 V supply.

How the Circuit Works

  1. Use Q2 to switch the supply. The supplied PNP Q2 has its emitter at VCC = 12 V and collector feeding R_LOAD = 240 Ω. The load return stays directly connected to system ground.
  2. Control its base indirectly. When CTRL_IN rises to 3.3 V, the NPN Q1 switches on and sinks current from Q2’s base through the added R_DRIVE = 2.2 kΩ. This pulls the PNP base below its emitter, turning Q2 on.
  3. Limit and restore the drive. R_B = 4.7 kΩ limits the GPIO-to-Q1 base current to roughly 3.3−0.74.7kΩ≈0.55mA\frac{3.3 - 0.7}{4.7\,\mathrm{k}\Omega} \approx 0.55\,\mathrm{mA}. R_OFF = 10 kΩ pulls Q2’s base back toward its 12 V emitter when Q1 is off, reliably removing PNP base drive.
  4. Check the load. With both BJTs saturated, V_LOAD approaches 12 V and exceeds 11 V. When CTRL_IN = 0 V, Q1 turns off, R_OFF turns off Q2, and V_LOAD falls near zero.

Verify the Circuit

Test CTRL_IN at 0 V and 3.3 V. Confirm VLOAD≤0.2VV_{\mathrm{LOAD}} \le 0.2\,\mathrm{V} when off and ≥11V\ge11\,\mathrm{V} when on, with I_GPIO < 1 mA. Inspect the transistor regions during the ON test: the validator requires both Q1 and Q2 in saturation.

Key Learnings

  • A driver transistor solves the voltage-level mismatch between a GPIO and a high-side PNP emitter.
  • R_DRIVE sets PNP base drive, while R_OFF ensures a reliable OFF state; neither resistor is redundant.