Arduino Forum

Using Arduino => General Electronics => Topic started by: jaron on Jul 30, 2019, 10:11 pm

Title: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: jaron on Jul 30, 2019, 10:11 pm
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?

(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318454)

(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318456)

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]
(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318526)

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

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]
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: raschemmel on Jul 30, 2019, 10:14 pm
change R1 to 1k.

Quote
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 (https://electronics.stackexchange.com/questions/169211/using-npn-bjt-with-a-p-channel-mosfet-to-switch-3-3v-to-24v)
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: 6v6gt on Jul 30, 2019, 10:33 pm
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.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 30, 2019, 10:44 pm
There are numerous errors in your schematic.  Try this, instead:

(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318611)
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

Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: jaron on Jul 30, 2019, 11:01 pm
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.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: 6v6gt on Jul 30, 2019, 11:26 pm
The NDP6020P seems  a much better choice.
This one also looks quite good: Si7615ADN (http://www.vishay.com/docs/62667/si7615adn.pdf), but the package is not very breadboard friendly. What is the maximum current you anticipate switching with this device ?

Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: raschemmel on Jul 30, 2019, 11:46 pm
Quote
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 ?
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: jaron on Jul 31, 2019, 12:09 am
@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.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 12:21 am
@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?
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: jaron on Jul 31, 2019, 12:47 am
@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.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: larryd on Jul 31, 2019, 02:11 am
(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318458)

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:

(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318480)




Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 08:09 am
(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318458)

The above is a catastrophe waiting to happen.
In what way is this a "catastrophe waiting to happen"?
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: jaron on Jul 31, 2019, 09:47 am
(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318526)

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

* 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.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: raschemmel on Jul 31, 2019, 04:08 pm
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 ?
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 05:12 pm
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?
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: larryd on Jul 31, 2019, 05:40 pm
"And, "disaster"? Isn't that rather dramatic?"

(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318458)

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.




Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: raschemmel on Jul 31, 2019, 05:59 pm
Quote
And, "disaster"? Isn't that rather dramatic?
You'll have to ask Larry about that. That wasn't me.



Quote
260k for the "avoiding long term battery drain in a NON-PWM application" case.
Quote
And, didn't I explain how I chose 260k?  
Quote
R1 = (Voutput - VBE)/IB = (3.3V-0.7V)/10µA = 260k
R1 = (VIN-VBE)/IB =(3.3V-0.7)/10uA = 260k


Quote
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


Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: larryd on Jul 31, 2019, 06:28 pm
(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318526)


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.





Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 06:38 pm
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.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 06:39 pm
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:

(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318611)
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: larryd on Jul 31, 2019, 07:10 pm
(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318613)


Edit
(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318615)



Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 07:57 pm
(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318613)
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.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 08:04 pm
(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318615)
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"
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: larryd on Jul 31, 2019, 08:08 pm
Quote
"Ground" is an arbitrary concept
No one is saying otherwise.



Quote
But, why would anybody do that -- noobs included?
Why do NOOBs do what they do?


The warning stands as is.

If you are teaching, explain the pitfalls and traps.




Quote
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"
Never said or implied you wrote hfe.

This was to show the OP where to get the data from hence the FYI.


Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: raschemmel on Jul 31, 2019, 08:15 pm
Quote
Back in the day, Ground actually meant, It's connected to the Earth.
Copper grounding rods  (https://www.google.com/search?q=copper+grounding+rod&oq=copper+grounding+&aqs=chrome.1.69i57j0l5.6049j0j8&sourceid=chrome&ie=UTF-8) are still used in some cases (such as ground-loop problems) or poor grounding issues.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 08:30 pm
Never said or implied you wrote hfe.

This was to show the OP where to get the data from hence the FYI.
Sorry.  It was presented in the same context as you scolding me about not save NOOBs from themselves.  Thus, I assumed it was further scolding ;)
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: larryd on Jul 31, 2019, 09:04 pm
Sorry.  It was presented in the same context as you scolding me about not save NOOBs from themselves.  Thus, I assumed it was further scolding ;)
There is no scolding here.


The point was new people here often have difficulties reproducing simple schematics to actual circuits.

Any kind of multiple power supply situations quite often gets NOOBs confused and into problems.

When they do run into problems, they are often asked to take test measurements and confirm GNDs are connected.


As mentioned by you, there are things called "Rule of thumb . . . .", rules of thumb are great.
Well, it is 'my opinion' (yes 'my' opinion) and Rule of thumb, that for interconnected power supplies, use 0V, GND, negative as a return path.
Yes you can connect the positive of a battery to the 0 volt pin of another power supply.
Yes you can connect the positive of a battery to the positive of another power source.
Doing so is not wrong but following my rule of thumb keeps new people on a even footing where they hopefully don't experience problems.

I digress.
Points have been made, we are all trying to help NOOBs learn and avoid making mistakes by teaching them to follow best practices.



Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: raschemmel on Jul 31, 2019, 09:20 pm
I think it is more important to emphasis that a voltage regulator output (like the 3.3V output) should not
be connected to a power source (like the battery). There is no reason why it is still connnected.
Whether or not the GND is connected is almost beside the point because a battery shouldn't be connected to a regulator output. I think it is easier for a NOOB to remember that than it is to determine whether there is a current loop between the battery and the regulator based on whether the Vcc & GND are BOTH connected to the battery.

So why is it connected to the regulator output ?
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 10:08 pm
So why is it connected to the regulator output ?
Because I was unraveling the OPs given circuit -- with the assumption that they asked so I responded.  But, I probably should have asked, up front, why the heck they are doing that -- rather than asking later.
There is no scolding here.
I was being facetious [i.e. tongue-in-cheek]  :)  

The point was new people here often have difficulties reproducing simple schematics to actual circuits.

Any kind of multiple power supply situations quite often gets NOOBs confused and into problems.
True.

When they do run into problems, they are often asked to take test measurements and confirm GNDs are connected.
The opposite of this case.  The grounds are connected. AND, there's a second common, which, also, is connected.

As mentioned by you, there are things called "Rule of thumb . . . .", rules of thumb are great.
Well, it is 'my opinion' (yes 'my' opinion) and Rule of thumb, that for interconnected power supplies, use 0V, GND, negative as a return path.
Which is silly !  And not of the real world.  It's the common case, but not the general case.  But, I see your position of not confusing the NOOB.  So, maybe the appropriate language is: "For now, lets only talk about Ground as negative, but some day..."


Yes you can connect the positive of a battery to the 0 volt pin of another power supply.
Yes you can connect the positive of a battery to the positive of another power source.
Doing so is not wrong but following my rule of thumb keeps new people on a even footing where they hopefully don't experience problems.
I still wouldn't call that a rule of thumb.  Its a common practice.   But, that's not quite the same thing.

And, again, bottom line.  I was merely showing the OP how the circuit they supplied might manage to do something.

Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: raschemmel on Jul 31, 2019, 10:20 pm
Quote
yes you can connect the positive of a battery to the positive of another power source
If by power source you mean the OUTPUT pin of the ProMini 3.3V regulator then it IS WRONG.

You should NEVER connect the OUTPUT of a voltage regulator to the positive terminal of a battery.

(the only exception is an experienced engineer designing a circuit who is careful to NOT provide a RETURN path for the battery to the regulator GND. (I believe this is what Larry was referring to ), but since we are talking to NOOBs and not engineers, I think it is best to simply issue a blanket warning to never connect the output of a regulator to the Positive of a batter.
Just to be clear (for the NOOBS) , there is nothing wrong with putting a battery in series with the ProMini 3.3V by connecting the NEGATIVE of a 1.5V alkaline AA battery to the 3.3V regulator OUTPUT pin and using the POSITIVE of the 1.5V battery as a 4.8V dc OUTPUT using the ProMini GND.

Quote
>> 3.3+1.5

ans =  4.8000
Look at the Supply Voltage specs for TTL Logic ICs (http://ee-classes.usc.edu/ee459/library/datasheets/DM74LS32.pdf)

The supply voltage can be as low as 4.75V so if you need to power TTL 5V logic ICs, you can simply
put a AA battery in series with the 3.3V to shift the voltage to 4.8V.

The current through the series battery loop is limited to the power source with the highest internal
resistance so (for example) :

if a 3.3V regulator can source 800mA and an alkaline battery can source 1A, the maximum
current you could source with the series combination would be 800mA

So, to recap, while it is a no no (in general) to connect the + terminal of a battery to the output of the
3.3V regulator, there is no limit to how many series batteries you can connect to it.

CASE 2:
You have a ProMini which only outputs 3.3V from the regulator but you have an unregulated 9V input
connected the the RAW Input and you need 12V for some device (ie: relay or solenoid or whatever).
You can connect two AA or AAA batteries in series with the 9V to get 12V or you could connect a 6-battery AAA pack in series to shift the 3.3V to 12.3V . (using the ProMini GND as your return)



Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: larryd on Jul 31, 2019, 10:21 pm
"Because I was unraveling the OPs given circuit "
Now that does make a lot of sense. :)
Notice she/he has modified the their schematic in post #1.

"When they do run into problems"
The operative word is "When" ;)

"I still wouldn't call that a rule of thumb.  Its a common practice. "
I said it's 'my' rule of thumb.
And I finished with "best practices".


I think we scared off the OP :(   






Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 10:26 pm
I think it is more important to emphasis that a voltage regulator output (like the 3.3V output) should not
be connected to a power source (like the battery). There is no reason why it is still connnected.
Whether or not the GND is connected is almost beside the point because a battery shouldn't be connected to a regulator output. I think it is easier for a NOOB to remember that than it is to determine whether there is a current loop between the battery and the regulator based on whether the Vcc & GND are BOTH connected to the battery.
I think the defining distinction, here, is the battery is not connected across the Arduino's 3.3V output, merely referenced to it.  There's a big difference.  If it were connected across the 3.3V supply, then I would agree.  But, if what you are saying were true, then it would be impossible to control one powered circuit, with another circuit having a different power source.  
For example, a voltage translator.  Used, for instance, to translate a 3.3V output, into a 5V input.  The two devices would need to have a reference connection between them [typically called a "ground", or a "common"]. They have different power supplies, but are connected together, so one voltage system can influence the other voltage system.  Yes, this reference connection is typically between the negative side of each of the supplies.  But, there are cases where the Negative on one will be connected to the Positive on the other.  Or, where two Positives will be connected together.  In other words, polarity is ambiguous.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 10:29 pm
"Because I was unraveling the OPs given circuit "
Now that does make a lot of sense. :)
Notice she/he has modified the their schematic in post #1.

"When they do run into problems"
The operative word is "When" ;)

"I still wouldn't call that a rule of thumb.  Its a common practice. "
I said it's 'my' rule of thumb.
And I finished with "best practices".


I think we scared off the OP :(  
Please us the Quoting feature -- otherwise it very difficult to sort out the narrative.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: raschemmel on Jul 31, 2019, 10:40 pm
I think that whole referencing/connecting issue would be best be eliminated by using an opto-isolator
to drive the mosfet that switches the battery to the HC-12 module. That way there is complete isolation
between the Pro-Mini and the circuit it is switching on and off.


Quote
I think we scared off the OP   
I've seen threads where the OP had 2 posts and the thread took on a life of it's own by triggering a debate
between 6 senior members that went on for more than 30 posts...

I'm sure you have seen similar cases where the OP gets buried alive under very technical replies and his brain explodes...
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 10:41 pm
[Edit]
(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318526)

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]
Probably wise to put these Updates in a new post, otherwise we're likely to not see them.

Also, because you're using a MOSFET that is designed to switch a lot of current, it's likely to have a large input capacitance.  As such, your Bipolar transistor will need to supply enough current to charge and discharge that capacitance, otherwise the MOSFET will turn ON and OFF more slowly than it's capable of doing.  For this case it's not an issue, but when you start switching higher currents, this might become important.
As for how to determine the values -- there's math, but I'm more of a back-of-the-envelop designer.  I use simplistic math to get into the ballpark, then I breadboard it up and watch for smoke.  There are others, here, who's math and methods are far more sophisticated.
But, there is always the ole rule-of-thumb that says: Over drive everything to make sure it works! -- like LarryD's 1K and 10k.  But, because you're dealing with a battery, more sophistication is probably in order.  So, hopefully someone else will help you with that. ;)
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: larryd on Jul 31, 2019, 10:41 pm
"Over drive everything to make sure it works! "
And Larryd said to tune the values upward if power draw was an issue. ;)

One 'final' note, the way you have the circuit drawn the gate to source sees either 3.3 volts or a resistor terminated gate potential.

If there was a length of wire connecting the gate to the collector (when the load is at a distance) noise might cause problems.

It is best to have the gate going from 0v to 3.3v, as achieved with common ground return.

I once again offer the OP:

(https://forum.arduino.cc/index.php?action=dlattach;topic=629098.0;attach=318480)

Condolences to the OP.


Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: ReverseEMF on Jul 31, 2019, 10:45 pm
I think that whole referencing/connecting issue would be best be eliminated by using an opto-isolator
to drive the mosfet that switches the battery to the HC-12 module. That way there is complete isolation
between the Pro-Mini and the circuit it is switching on and off.
Sure, in some cases, but to offer that as a panacea, ignores the specific case.  And, the specific case is yet to be determined -- merely because, it hasn't been offered yet.  Probably because the OP is still in an experimentation phase. ;)
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: raschemmel on Jul 31, 2019, 10:47 pm
I'll take the schematic in Reply#35 over the one in #34 any day because it does not have the battery
across the promini 3.3V.

@OP
HELLO !
ANYBODY HOME ?
Are you still there ?
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: larryd on Jul 31, 2019, 10:51 pm
@ReverseEMF

Removing images from a post makes subsequent responses hard to follow.




Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: raschemmel on Jul 31, 2019, 10:54 pm
Quote
Removing images from a post makes subsequent responses hard to follow.
The exception being when you say something and then wake up in the middle of the night and realize
somebody might interpret it in a negative way and go back and change it or remove the post entirely
hoping nobody saw it because they were out on the town and didn't have access to the net.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: CrossRoads on Jul 31, 2019, 11:49 pm
Why isn't R2 replaced with R3 and the LED? Would make things simpler. No need for the P-Mosfet.
Or replace the NPN with an N-Mosfet, one that turns on full with >2.5V gate voltage.
I saw one mentioned in the forum pretty recently.
Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: larryd on Aug 01, 2019, 12:19 am
Would be best to use a a N channel MOSFET, 2.5v turn ON are not too available.

I do not like 3.3v logic.


Only argument to use a P channel is if you need 0v across the load when MOSFET is turned off 'and' need a GND reference on the load.

P channel small lower power SMDs
AO3401
FDN340P
Si2301DS

N
IRLML2502
Si2302DS







Title: Re: Resistor values for P-Channel MOSFET + NPN Transistor Switch
Post by: jaron on Aug 03, 2019, 09:10 am
I'm still here and thanks to @ll for the information so far. This is obviously not my full time job and it'll take some time for me to extract the information from the hissing.
I've received an NDP6020P MOSFET and the bit of testing I've done so far wasn't successful. I will post more as soon as I've got some usable results and maybe more questions.