# Resistor values for P-Channel MOSFET + NPN Transistor Switch

NOTE: Updated schematic to indicate ground attachment to supply [previously, "ground" was ambiguous].

And, that FQP47P06, has a "Gate Threshold Voltage" that will not be, consistently, low enough for it to work in this application. I mean, since, technically, the VGS(th) can be as low as -2V, and because, in this case, you're only driving a measly LED at around 6mA, if this is a one-off, you might be able to cherry-pick a winner, but I wouldn't hold yer breath ;)

But, on to the rest of your question: How to figure out the resistors values. I see you connected to D4, which is NOT a PWM enabled output, so that makes this trivial:

Since a MOSFET is [statically speaking] a Voltage Driven device, you can get away with a wide range of values for R2. So, lets pick a value that will not contribute much to power supply demand [in case the Pro Mini is also being powered by a battery], like 33k.

The PN2222 is a Current Driven device. Thus, it's a matter of the ratio of input current, to output current. A bipolar transistor has a parameter called hFE, which is a number that indicates the maximum expected current gain. The hFE for a PN2222 is around 35 for the small current will be dealing with, here.

Rule of thumb, to turn a BiPolar transistor on, in a way that insures it's "really on" [i.e. is in the "saturation region"], use a current gain of "10", and since the gain, on this transistor, goes all the way up to 35, there's enough "head room" to achieve this.

Thus, a 33k resistor on the collector, will allow a current of around 0.1mA, when the transistor is all the way on, so to satisfy the stipulation of a current gain of 10, use the following math:

IB = IC/10 = 100µA/10 = 10µA R1 = (Voutput - VBE)/IB = (3.3V-0.7V)/10µA = 260k

BUT, if conserving energy for a battery is not an issue, then a little more drive current might be wise -- especially if that MOSFET has a lot of Gate Capacitance to deal with [a whole other subject, that is more apropos for such things as PWM]. So, lets choose, for R2, a value of 3.3k, so we have 1mA of pull up current [e.g. turn-off current]. Combining the two formulas:

R1 = (Voutput - VBE) * 10/IC = (3.3V-0.7V)*10/1mA = 26k

Thanks @all, you are quick! Would a NDP6020P work for my application? The data sheets are difficult for me to interpret.

@ReverseEMF thanks, your schematic looks so much cleaner. I can't spot the differences right away and need some time to analyze it.

The NDP6020P seems a much better choice. This one also looks quite good: Si7615ADN, but the package is not very breadboard friendly. What is the maximum current you anticipate switching with this device ?

your schematic looks so much cleaner. I can't spot the differences right away and need some time to analyze it.

What are you talking about ?

The difference is like night and day.

They couldn't be more different if you tried.

Start by looking at where the emitter of the NPN is connected.

Is there a difference between Vcc and GND ?

@raschemmel post #1. The circuit is part of an IOT application where the power consumption is crucial. After some research I came to the above solution to switch all unused components off while the Atmega328P is in deep sleep (1 + 2). The LED was meant as an example of a consumer, in reality this would be at least an HC-12 433 MHz HF module and one or more sensors which together will probably use 1 A max (3). I'm not a pro and every constructive input is welcome.

@ReverseEMF thanks for the addition. It'll take me some time to process your information as I'm obviously not a pro.

@6v6gt thanks, I've ordered some NDP6020P.

jaron: @raschemmel post #1. The circuit is part of an IOT application where the power consumption is crucial. After some research I came to the above solution to switch all unused components off while the Atmega328P is in deep sleep (1 + 2). The LED was meant as an example of a consumer, in reality this would be at least an HC-12 433 MHz HF module and one or more sensors which together will probably use 1 A max (3).

WhooHoo! 1 Amp (max 3)! Much different than the 6, or so, mA implied by your LED and 220Ω resistor!!

OK, that means a more hefty MOSFET, and possible concerns regarding switching time. Though a NDP6020P is plenty hefty -- in fact, might be overkill. Like, we might be waltzing into the concerns about that Gate Capacitance, I mentioned before. And, low power consumption concerns to boot! OK, a little more complicated of a design, perhaps [or, still simple -- depends on the need for speed]. Also, just checking...what's with the P-Channel MOSFET, anyway? Why did you feel that was necessary? I mean, couldn't we just use an N-channel MOSFET and dispense with the PN2222?

@ReverseEMF it would be 1 A max. I've chosen the above solution because I assumed that it uses the least power and has the least voltage drop which is important as I use a single LiFe battery. But of course I could be wrong.

The above is a catastrophe waiting to happen.

NOOBs are often told to connect grounds so circuits can have common reference point for current flow.

At a minimum, the schematic should come with a warning.

Better still, use one of the circuits below:

larryd:

The above is a catastrophe waiting to happen.

In what way is this a “catastrophe waiting to happen”?

This is revision 1 of the schematic that I've modified according to the inputs given so far:

• The emitter of the transistor is now connected to GND instead of VCC.
• An NDP6020P logic level MOSFET is used instead of an FQP47P06.
• There is now a 10kΩ pull-down resistor at the Arduino pin D4.
• R1 is now 260kΩ and R2 33kΩ, which must be verified.

• In a real application the LED would be for example replaced by an HF module and a temperature sensor. ** The design of the circuit is debatable but low power consumption and minimal voltage drop are crucial.

R1 is excessively high for a simple 5V logic driven 2n2222 . In that configuration you typically see values between 1k and 5k. The only reason to use 260k is to limit the base current and thus the collector current. I can't see any reason to do that. How did choose 260k ?

raschemmel: R1 is excessively high for a simple 5V logic driven 2n2222 . In that configuration you typically see values between 1k and 5k. The only reason to use 260k is to limit the base current and thus the collector current. I can't see any reason to do that. How did choose 260k ?

260k for the "avoiding long term battery drain in a NON-PWM application" case. 26k for the "not using a battery, or PWM", case And, didn't I explain how I chose 260k? And, "catastrophe"? Isn't that rather dramatic?

“And, "disaster"? Isn't that rather dramatic?”

I don’t think so.

As stated, NOOBs are hammered with connecting the Arduino GND to the external power supply GND.

Your circuit’s ProMini is being powered via +V power supply.

You are connecting the ProMini Vcc (3.3v) to the external load battery supply +3.3v for the circuit return path.

No effort was made to warn the OP to not connect Arduino GND and external power supply GND.

We can all offer weird and wonderful ways of biasing and referencing circuits. However, we should have the foresight to tell new people what might happen if GNDs are then connected.

EDIT Now the OP, in post 12/1, is redesigning the circuit so the battery is powering the ProMini.

And, "disaster"? Isn't that rather dramatic?

260k for the "avoiding long term battery drain in a NON-PWM application" case.

And, didn't I explain how I chose 260k?

R1 = (Voutput - VBE)/IB = (3.3V-0.7V)/10µA = 260k

R1 = (VIN-VBE)/IB =(3.3V-0.7)/10uA = 260k

R1 = (Voutput - VBE) * 10/IC = (3.3V-0.7V)10/1mA = **26k*

I think you mean IB here, NOT IC

and 260k NOT 26k

Like this: R1 = (VIN-VBE)/IB =(3.3V-0.7)/10uA = 260k

Suggest you (OP) make R1 = 1k and R2 = 10k.

If and only if you (OP) need to save on current draw, tune the resistors upwardly.

Edit You do not need R4.

raschemmel: I think you mean IB here, NOT IC

and 260k NOT 26k

Like this: R1 = (VIN-VBE)/IB =(3.3V-0.7)/10uA = 260k

I think you missed the ß of 10. That's what converts IC to IB.

larryd: As stated, NOOBs are hammered with connecting the Arduino GND to the external power supply GND.

Your circuit’s ProMini is being powered via +V power supply.

You are connecting the ProMini Vcc (3.3v) to the external load battery supply +3.3v for the circuit return path.

No effort was made to warn the OP to not connect Arduino GND and external power supply GND.

We can all offer weird and wonderful ways of biasing and referencing circuits. However, we should have the foresight to tell new people what might happen if GNDs are then connected.

Good point. Changing it to:

Edit

larryd:

There is no Ground on a battery. "Ground" is an arbitrary concept. Yes, there are cases where the Ground Point is defined, such as on the Arduino [which defines it as the Negative Side of the Voltage Source], but the positive side of a battery can, also, be chosen as "Ground" [have you never heard of a positive ground car?]. Thus, the Circuit Designer as full freedom to place "Ground" wherever he/she chooses. For instance, there are OpAmps, such as the LM324, that are designed to function with a single rail supply, in which case, the inverting input is tied to the negative side of the supply--a side that assumes an identity as "Ground". But, such OpAmps, usually, can function just fine with a dual rail supply. In which case the moniker "Ground" is assigned to the point halfway between the Positive, and Negative supply points.

In my schematic there is the pre-defined Arduino "Ground" [which may, or may not, be connected to the actual physical ground]. And, the MOSFET Drain circuit, has it's own "Common" that is connected to the Arduino's 3V pin, and to the Positive side of the battery -- neither of which is ground [i.e. the ground defined by the Arduino].

And, therein lies the source of the confusion: conflating the concept of "*Ground", with the concept of "Common". I agree there should be only one "Ground", in the sense that a *true Ground is actually connected to the physical ground [i.e. the Earth], and there's only one "Earth". But, there can be more than one common, which is the case in this schematic of mine [the one that has raised so much alarm], and connecting two unrelated commons to ground, will likely lead to a short. But, why would anybody do that -- noobs included? It's not part of the schematic -- the schematic clearly shows how things are to be connected.

And, so often, the term "Ground" is used, when it's really a "Common" -- like in the case of the Arduino [where is an Arduino connected to the Earth?!?] It's like how we still say, "The phone is ringing", when, really, its a cellphone playing "We are the champions!". Back in the day, Ground actually meant, It's connected to the Earth.

larryd:

Whence did I use "hfe"? Or, more to the point -- if you saw hfe, then apologies. Must have been a typo, since I fully meant "hFE"