# What is the best between a transistor and a pmos and which resistances

I need to create a switch to power on or off a moisture sensor. PIN 10 is HIGH or LOW to trigger either the transistor or the PMOS

My sensor consume about 0.6mA Moisture sensor information

My circuit work with 3.3V

I found the two exemples below

Keeping in mind my circuit work with 3.3V, powered by the 3.3V pin of my micro-controller

Now my question; I have pain to make a choose between the NPN and PNP transistor and the P NOSFET example. What would be the best as far as I know, the transistor work with Ampere and PMOS with voltage.

First, if I opt for the two transistors, how can I calculate the resistance values for a 3.3V circuit. The output of the PIO I/O has 3.3V, of course.

Lastely, if I choose the P MOSFET proposition, How can I calculate the value of R1 if I have a circuit of 3.3V.

Keep in mind that my sensor must have 3.3V at the VCC sensor pin.

I heard that PMOSFET is not suitable because it's work with higher voltage, but I know there is PMOFSET for 5 and 3.3V. What is your opinion?

What would be the best choose and best values for the resistances?

Many Thank a lot for you clarification, Cheers

• I have pain de make a choose between the NPN and PNP transistor and the P NOSFET example No you don't, in the second circuit you can replace the PNP with a PMOS, just make R2 much lower in value than R3 and it will work. Heck you can even replace Q3 with an NMOS and it would be a CMOS solution. The fact that you only found these circuits does not mean there are no other (better) solutions. Commented Oct 3, 2017 at 13:18
• I heard that PMOSFET is not suitable Auch! Do watch out with those I heard that... and I read that... unless you understand the complete reasoning WHY that is so. So next time when you read that, ask yourself WHY. If you don't care/want to know, that's fine but then stick to ready-made solutions that 100% fit your situation. If it does not fit, ditch it, look for another solution. Commented Oct 3, 2017 at 13:23
• Hello, thank a lot for your reply. I understand than R2 must have a lower value then R3, but what should be the value of R3? 10Ohm or 100kOhm. And what about R1. Is there a formule to know the values of the restiances? Commented Oct 3, 2017 at 13:47
• Sure there's formulas for everything but in order to use a formula you need to make decisions about all the parameters that go into the formula. So having a formula is not going to make your life that much easier. Just make R2 1k ohm and R3 100 k ohm. There are one million other value/combinations you could use and that would work just as well. I just suck these values out of my thumb (and using some experience), it is not rocket science. Commented Oct 3, 2017 at 13:58

I have pain to make a choose between the NPN and PNP transistor and the P NOSFET example. What would be the best as far as I know, the transistor work with Ampere and PMOS with voltage.

The FET is better if you want to minimize drive current, but requires more drive voltage than a bipolar transistor. You have 3.3V available, so choose a FET which is specified for 2.5V Gate drive.

How can I calculate the value of R1 if I have a circuit of 3.3V.

The resistor is only provided to ensure that the FET remains off if the MCU output is floating (ie. set to input mode, which usually occurs on power up and reset). You don't need to calculate it, just use a value which is low enough to eliminate any leakage or noise on the Gate. 100k will probably be fine.

if I opt for the two transistors, how can I calculate the resistance values for a 3.3V circuit. The output of the PIO I/O has 3.3V, of course.

R1 and R2 are are chosen to provide sufficient Base current to keep the transistors saturated at maximum load current. Divide the peak load current by the saturation Ic/Ib ratio of Q2 to get its Base current, eg. 0.6mA / 30 = 20uA. Then calculate R2 using Ohm's Law and taking into account the Base-Emitter voltage loss, eg. (3.3V-0.6V) / 20uA = 135kΩ. Now do the same for Q3 and R1, eg. 20uA / 30 = 0.7uA, (3.3V-0.6V) / 0.7uA = 3.9MΩ.

These are the maximum acceptable values. Lower resistances will provide stronger drive and are OK so long as they don't exceed the I/O port and transistor current ratings, and you don't mind the extra current draw.

R3 bypasses any noise or leakage that might cause Q2 to turn on unintentionally. It's value is not critical, but needs to be ~10 times higher than R2 to not steal too much Base current.

This two transistor circuit is only required if the load current is very high, the voltage being switched is higher than the control voltage, or you need a non-inverting output. Since you are switching low current and the supply and control voltages are both 3.3V, You could just use a single PNP transistor with Base resistor (Q2, R2), and set the MCU output low to turn it on.

• BJT requiring more current to drive is not true for all scenarios. For high frequency signals most BJT's perform better than MOSFET's especially with PMOS since the input capacitances would require you to have higher drive currents. Ofcourse this is only in the order of Khz, you've got no choice after that but to use MOSFET's with gate drivers. Commented Sep 2, 2021 at 8:45
• @TheAnimatrix Sure, there are some scenarios where a bipolar transistor might need less drive power, but this isn't one of them. The problem with using bipolar as a switch is having to supply 5~10 times more Base current than 'necessary' to ensure good saturation, and this current flows all the time even if the load doesn't need it. Commented Sep 2, 2021 at 21:04