Resistor values for P-Channel MOSFET + NPN Transistor Switch

Goal: Possibility to programmatically switch 3.3V peripherals (sensors, RF module) on an 3.3V Arduino on and off.
Question: What are the correct values for R1 and R2?

I’ve tried to figure out the values for R1 and R2 for a while now but couldn’t find an example nor an understandable explanation on how to calculate their values. I’d really appreciate if someone could point me to a possible solution.

Thanks!

[Edit]

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

  • In the original schematics the emitter of the transistor was connected to VCC instead of GND.
  • This revision uses an NDP6020P logic level MOSFET 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.

The circuit is part of a battery powered IOT application where a minimal power consumption and voltage drop are crucial. After some research I came to the above solution to switch all unused components off while an Atmega328P is in deep sleep.
The LED is just 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.
[End Edit]

FQP47P06-1009447.pdf (779 KB)

PN2222-D.pdf (122 KB)

change R1 to 1k.

I've tried to figure out the values for R1 and R2 for a while now but couldn't find an example nor an understandable explanation on how to calculate their values. I'd really appreciate if someone could point me to a possible solution.

Whatever you are trying to do it is not going to work with that circuit. List the reason for each of the components in your circuit:

1 - 2n2222 (purpose) 2 - P-channel mosfet (purpose) 3.- led (purpose) 4- module (post vendor link and correct name for module) (purpose should be self explanatory) 5- battery (purpose self explanatory)

here's an example of how to use an npn transistor to switch a p-channel mosfet

The FQP47P06 is not even a logic level mosfet and is certainly not suitable for 3.3 volts. The RDS(on) is quoted only for -10 volts in the data sheet.

There are numerous errors in your schematic. Try this, instead:

|500x282 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.

|500x282

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:

|500x336

2019-07-30_18-05-39.jpg|1051x708

larryd:

The above is a catastrophe waiting to happen.

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

|500x356

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?”

|500x282

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?

You'll have to ask Larry about that. That wasn't me.

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

|500x356

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:

|500x270

Schematic2.png|1357x734