# IRF540N application as a switch trouble

#### jim0000

Joined Oct 28, 2020
23
I am fairly new to using MOSFET's in circuits and I am a little stuck. I want to use the IRF540N as a switch, which will receive a voltage to the gate, and 18-30 volts at the drain. I would like for the source to essentially follow the voltage of the drain as long as there is voltage being applied to the gate. I am having trouble getting it to work that way, I tried testing it with a power supply as seen in the picture but I keep getting unexpected behavior. Am I testing it wrong? Should I add resistors or anything else to achieve the desired results from the IRF540N?

datasheet: https://media.digikey.com/pdf/Data Sheets/Fairchild PDFs/IRF540N.pdf

Attempts:

#### Ian0

Joined Aug 7, 2020
1,645
You have source connected to ground, how are you expecting the source to be at any other potential than ground?

#### Dodgydave

Joined Jun 22, 2012
9,920
A Source follower works on the same principle as an Emitter follower, the output voltages are about 2V less than the Gate, with high current, so you need to feed the Gate with a higher voltage.

#### AnalogKid

Joined Aug 1, 2013
9,078
Please give us a more details description of what you are trying to achieve.

ak

#### ScottWang

Joined Aug 23, 2012
6,996
I would like for the source to essentially follow the voltage of the drain as long as there is voltage being applied to the gate.
It looks like you need a PMOSFET, and you also need a stage of npn bjt to put in front of P MOSFET, and in this situation, the Load should be put on the Drain.

So when the 5V strobes on the base of npn bjt, and then the c of bjt will be pull down the gate of P MOSFET to Ground, and the voltage of Drain will be close to the Source, and the Drain will provides a positive voltage to the Load.

Note:
I didn't describe the resistors in the circuit, but they will needed in the circuits normally.

#### shortbus

Joined Sep 30, 2009
8,444
Could it possibly be because your only putting slightly over the threshold voltage on the gate? To turn that mosfet on it needs ~10V not the 5V your using. At 5V the mosfet is barely turned on/conducting.

#### jim0000

Joined Oct 28, 2020
23
You have source connected to ground, how are you expecting the source to be at any other potential than ground?
I was reading that to use it as a switch its easiest to just connect source to ground, should it not be grounded then? The source goes connects to another component in my circuit

#### jim0000

Joined Oct 28, 2020
23
You have source connected to ground, how are you expecting the source to be at any other potential than ground?
I read that its easiest to have the source grounded when using it as a switch, in my circuit it is connected to another component (which ideally would see the voltage being applied at the drain) should I test it with the source ungrounded?

#### jim0000

Joined Oct 28, 2020
23
A Source follower works on the same principle as an Emitter follower, the output voltages are about 2V less than the Gate, with high current, so you need to feed the Gate with a higher voltage.
So it should follow the gate? I am confused by what you mean maybe, I was looking on the data sheet and I couldn't see if there was breakdown voltage value at the gate although I am sure there is one

#### Dodgydave

Joined Jun 22, 2012
9,920
Yes if you want 20V out of the Source, then you need to feed the Gate with 22V .

Or use a Pfet as Drain switch.

#### jim0000

Joined Oct 28, 2020
23
Please give us a more details description of what you are trying to achieve.

ak
Initially there would be zero volts at the gate, and 18-30V at the drain which would be an 'off' state since it is an enhancement mode mosfet. Once voltage above threshold is applied at the gate I would like for the source terminal to have essentially the same voltage as the voltage that is being applied to the drain since the source terminal will be connected to another component. So I just want to use it as a switch basically, when the 'switch' is open I don't want any voltage at the source terminal, when the 'switch' is closed I want the source terminal to follow the drain voltage.

#### jim0000

Joined Oct 28, 2020
23
It looks like you need a PMOSFET, and you also need a stage of npn bjt to put in front of PMOSFET, and in this situation, the Load should be put on the Drain.

So when the 5V strobes on the base of npn bjt, and then the c of bjt will be pull down the gate of PMOSFET to Ground, and the voltage of Drain will be close to the Source, and the Drain will provides a positive voltage to the Load.

Note:
I didn't describe the resistors in the circuit, but they will needed in the circuits normally.
When you say 'in front of the PMOS' do you mean attached only to the PMOS gate? Like the image? What would the emitter be attached to if anything?

#### jim0000

Joined Oct 28, 2020
23
Could it possibly be because your only putting slightly over the threshold voltage on the gate? To turn that mosfet on it needs ~10V not the 5V your using. At 5V the mosfet is barely turned on/conducting.
That is what I thought as well. I attempted 10V, and even slightly over 10V at the gate and it seemed to just follow the gate voltage

#### Ian0

Joined Aug 7, 2020
1,645
Initially there would be zero volts at the gate, and 18-30V at the drain which would be an 'off' state since it is an enhancement mode mosfet. Once voltage above threshold is applied at the gate I would like for the source terminal to have essentially the same voltage as the voltage that is being applied to the drain since the source terminal will be connected to another component. So I just want to use it as a switch basically, when the 'switch' is open I don't want any voltage at the source terminal, when the 'switch' is closed I want the source terminal to follow the drain voltage.
It's the other way around.
When the MOSFET is switched on, the DRAIN voltage goes to the SOURCE voltage, not the other way round.
What do you want to switch? Whatever it is goes between the DRAIN and the power supply.

#### jim0000

Joined Oct 28, 2020
23
Yes if you want 20V out of the Source, then you need to feed the Gate with 22V .

Or use a Pfet as Drain switch.
Interesting, I was thinking the NMOS behaved differently I guess. I thought that since there is an oxide layer at the gate, that the source voltage would follow the drain voltage rather than the gate voltage. Would I not even need to apply 20V to the drain then? If that's the case then I may not be able to use it as it is bcuz I am unable to apply higher than 12V to the gate.

#### jim0000

Joined Oct 28, 2020
23
It's the other way around.
When the MOSFET is switched on, the DRAIN voltage goes to the SOURCE voltage, not the other way round.
What do you want to switch? Whatever it is goes between the DRAIN and the power supply.
Thats what I am meaning, I want the voltage to go from drain to source. What do you mean by 'between drain and the power supply'?

#### Ian0

Joined Aug 7, 2020
1,645
Thats what I am meaning, I want the voltage to go from drain to source. What do you mean by 'between drain and the power supply'?
As in your "attempt 2" drawing assuming that the 1k resistor is the thing you want to switch.

#### jim0000

Joined Oct 28, 2020
23
As in your "attempt 2" drawing assuming that the 1k resistor is the thing you want to switch.
I thought the load should be on the source terminal for NMOS?

#### BobTPH

Joined Jun 5, 2013
3,014
Stop thinking of it as a switch between the positive supply and the load. An N-channel MOSFET is used as a switch between the load and ground. If you need a switch between the positive supply and the load you need a P- channel MOSFET.

The same is true for NPN and PNP bipolar transistors.

Bob

#### Audioguru again

Joined Oct 21, 2019
2,878
Here is how the IRF540 Mosfet works as a follower: