# Using NPN BJT with a P Channel MOSFET to switch 3.3V to 24V simulate this circuit – Schematic created using CircuitLab

I have some 3.3V I/O on a PC Board.

When an output is switched on, I need to switch the 3.3V output voltage with a +24VDC and provide by a nice screw terminal with a 24V output.

On all of my previous PCB plans I have used an N-Type semiconductor and switched the ground - However due to the use case of this output, that isn't an option here.

I have drawn the above circuit based on things I've read - and, with simulations in CircuitLab, I believe it works.

The problem is, I'm not really sure how it works.

Could someone explain to me, what, why, and how, this is working - and suggest if there is a more desirable way to draw this circuit?

You have two switches here. Q1 and M1.

When your control signal is 0, Q1 is off. This means there is no current flowing through the collector of Q which means there is no current flowing through that entire branch (R3, and D1). This means that the voltage at the gate of M1 is the same voltage as your 24V rail. A PMOS switches when VGS < Vgs(threshold). For the IRF9530, it begins to turn on at -2V. So M1 is off since, Vgs = 0. (Gate is 24V, and Source is 24V).

When your control signal goes to 3.3V, it turns Q1 on, and now you have current flowing through R3 and D1. D1 being a zener, will clamp the voltage at the gate to 5.1V. So now you have your source voltage at 24V, and your gate voltage at 5.1. Vgs = 5.1 - 24 = -18.9V. This is enough to turn M1 on, now you have 24V passing through the mosfet and to your load.

The datasheet for M1 says that the absolute max voltage at the gate is +/-20V, so you are within spec, but awfully close. If you increase your zener, such that Vgs is not so near your lower threshold it will keep you away from being so close to the -20V limit. You need to be between -4V and -20, so maybe if you aim for -10 and -15 instead, it will put you into a safer region.

Some additional notes. The datasheet for the zener, looks to have a Izt of about 50mA. The current through the zener when Q1 switches is 4mA. I can't see what the zener knee current is, but this may not be enough for the zener, or it puts right at the boundary between zener breakdown and reverse bias. So you would need to decrease your resistor.

For 50mA, the resistance would be about 378ohms. This also means that the power dissipation through the resisor will be much greater, so you need at least a 1W resistor. Alternatively, you swap the position of the resistor and zener, so that is less heat generated from the resistor, and increase your zener voltage to compensate.

Or you can rearrange your circuit slightly like this simulate this circuit – Schematic created using CircuitLab

Q1 is arranged as a voltage follower and now you have a constant current source.

$$R = \frac{V_{control}-0.7}{I_{desired}}$$ Since we want 25mA, we plug that into I, and we get R being 104.

The power dissipation through the resistor is now

$$P = I^2R = 65mW$$

Vgs when on, is about -14V.

• I like this circuit better (protects the MOSFET) but you're definitely going to want a resistor in parallel with the Zener diode to pull the gate close to the source voltage smartly when the BJT turns off. May 6, 2015 at 11:06
• @SpehroPefhany ah yes. Is there an optimum value, higher the better ? Anything above 10k ? Doesn't matter ? May 6, 2015 at 11:14
• For a DC switching application where you don't really need to care about gate capacitance & switch-off time, 10k is fine, even 100k. The only recommendation I'd made is a zener with a much lower Izt. May 6, 2015 at 11:27
• @efox29 +1 Something like 4.7K would be what I'd use. You have plenty of turn-on current available. Your 10K is fine for low frequencies. May 6, 2015 at 12:14
• I like the overall topology, but 25 mA in steady on state is excessive. The zener will dissipate 240 mW, and the transistor 285 mW continuously when on. Use a zener that only needs a mA or so and make R1 larger. Put a cap across R1 if you want to speed up turn on. Also, the output should have a reverse diode to ground to protect against turning off inductive loads. May 6, 2015 at 12:50

What about a voltage divider like the attached schematic?
It is only 0.5 mA plus 3 mA at the base of the BC337 transistor.

That way you don't need any zener diode, do you?

(Forget about MPPT on the diagram below, I am trying to control an old non-configurable inverter with the output of a new configurable MPPT.) • Please don't post a new question as an answer to an old question. Sep 8, 2019 at 13:08
• I am answering also. About resistor divider instead a zener. Sorry, I thought that it may help as it is easier to have resistors Sep 8, 2019 at 14:34