I am trying to use a PNP transistor as a high-side switch, as shown here: enter image description here

How would I determine the values for R1 and R2? My circuit has a 12V battery connected as shown, and an Arduino digital pin connected to R1. my load is just a resistor and an LED to ground. The transistor I am using is this. The load needs a maximum of 140mA.

A few more questions I have regarding this circuit is: 1) Do I need a diode between the Arduino and R1? It seems like when I hook up the pin without a diode it is constantly on no matter what, even when the Arduino pin goes HIGH. 2) Since the 12V line for now is connected via battery, when I shut off the Arduino the load doesn't turn on but the LED I have in series with the Arduino and R1 does turn on. Why does it do this.

Many of these questions come from a misunderstanding of PNP transistors, so I am sorry for that.

Thank you in advance.

  • \$\begingroup\$ Based on what you know about beta or hFE how much base current needs to flow to properly activate your load? \$\endgroup\$
    – Andy aka
    Apr 19, 2020 at 9:46
  • \$\begingroup\$ You cannot control a p-n-p transistor with a standard voltage-type digital output except the case when Vcc = 5 V or you add another but n-p-n transistor before. This stage can be controlled by an open collector output. \$\endgroup\$ Apr 19, 2020 at 9:46
  • 1
    \$\begingroup\$ You need special magic care and luck to use that cct as is. The PNP needs about 0.7V across Vbe. The arduino swings 0/5V. There is about 7V between Arduino+ and base at 12V which you need to deal with. The ARduino does not tolerate 12V on a resistor when pin = high. | One method is a zener in series with R1. An 8V2 zener MAY work. When pin = 5, Base != 5 + 8V2 = 13V2 - which is not available, so 12V, so off. | When pin = 0, top of zener ~= 0+8V2 = 8.2. So base sees 4V across R1. | A fairly unreliable method. Adding a low side NPN to drive the PNP base makes it MUCH easier to design well. \$\endgroup\$
    – Russell McMahon
    Apr 19, 2020 at 9:48
  • 1
    \$\begingroup\$ @Circuitfantasist ... or add a zener as er my comment - but, not recommended. \$\endgroup\$
    – Russell McMahon
    Apr 19, 2020 at 9:48
  • \$\begingroup\$ @Russell McMahon, Yes, it is possible... I agree... \$\endgroup\$ Apr 19, 2020 at 9:50

2 Answers 2


Here is the circuit of a basic high side load driver with low side input.

Vin high turns on Q1.
Q1 on pulls Q2 base low via R3 turning on Q2.

R2 is optional - if Vin is always defined R2 is not needed.
If Vin is eg a microcontroller pin that may be open-circuit after reset until initialised R2 ensures that the circuit stays off until Vin is asserted high under program control.

R4 is usually not essential but in some extreme cases stops Q2 turning on due to base current leakage. This is usually only an issue when very low load currents may be significant.

R3 is designed to provide enough base drive for Q2.
Q2 current gain = Beta-Q2.
Q2 requires a base current of >= Iload_max/Beta_Q2
Usually Beta is forced at a value usefully lower than the datasheet value.
eg if a transistor has a beta of 200-300 under the relevant conditions then driving it with at least say Iload_max/100 (forced beta of 100) ensures it is turned on hard for all likely production samples of Q2.

Q1 switches Ib_Q2.
So Ib_Q1 >= Ib_Q2/Beta_Q1.
This is usually a very low current value and it is usual to overdrive Q1 substantially 'just because'.
eg say Iload_max = 500 mA and Beta_Q2 =200
Decide to drive Q2 at beta=100.
Ib_Q2 = IloadMax/BetaQ1
= 500/100 = 5 mA.

For Vdd=12V, R3 = V/R ~= (12-0.6)/0.005A = 2280 ohm.
R3 of 2k2 is OK but 1k is also OK.

Ib_Q1 = Ib_Q2/Beta_Q1
= 5 mA/100 say = 0.05 mA.
With 5V Vin, R1 =
V/I = (5-0.6)/0.05 mA = 88kohm.
While a value of say 82k or 68k could be used. it's more usual to use a 10k for Ib_Q1 ~= 0.5 mA.
This is well within the drive spec of any microcontroller.

If speed is an issue then a lower value of R1 may be used and a "speedup capacitor" may be connected across R1 - but that's getting beyong the basic circuit.


simulate this circuit – Schematic created using CircuitLab


NOT recommended:

ZD1 effectively "level shifts" Vin up by about 8V.
So for Vin = 0/5V, Q2 sees about 4/0 volts drive.
Hence Vin low = on and Vin high = off.

The zener must reduce the Vdd supply enough for the microcontroller to NEVER see more than Vcc_microcontroller at the Vin pin.

A say 100k resistor from the R1- Zd1 junction to ground may be wise to ensure this point is not ever pulled above Vcc_uC. This resistpor needs to be large enough to not turn on Q3 by itself in any situation. Hard to design well.


simulate this circuit

  • \$\begingroup\$ Hi, I just have one more quick question. I'm assuming that it is ok if the 12v source and the 5V source share a common ground? I have seen some configurations where it is not okay but I'm just checking before I wire important things up and ruin them lol \$\endgroup\$ May 9, 2020 at 3:32
  • 1
    \$\begingroup\$ @JaredCohen It is ESSENTIAL that the 5V and 12V supplies share a common ground. Voltages are always expressed relative to a reference point, and in this case that point is a commonly connected point with the two supply negative rails connected to it. \$\endgroup\$
    – Russell McMahon
    May 9, 2020 at 3:35
  • \$\begingroup\$ Thank you very much. That's what I thought but I'm glad you confirmed. Thanks! \$\endgroup\$ May 9, 2020 at 3:36

This is a proposal for your circuit (maybe you need to fine-tune a bit):


simulate this circuit – Schematic created using CircuitLab


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.