Using P channel mosfet with arduino

Hello!
I am trying to make a buck converter using an arduino. I need to use a P channel mosfet as a high side switch. I have made a circuit like this

When I use the external power supply, whose ground is connected to arduino ground, the mosfet just stays on. If I use the 5v from arduino as the power supply, it works correctly. I have tested the mosfet just with the 12v power supply, and it is not damaged. But It doesn't like something about my choice of wiring it.
Can someone please show me how can a P channel mosfet be used as a high side switch with arduino? Thanks!

One approach (although R4 should connect to the I/O pin, not the base). Google "arduino pmos high side switch" for others.

FYI

2 Likes

Your circuit diagram is correct except for M1.
You only have to connect everything just as in your updated circuit diagram. Double check or fully rebuild your circuit. Did you confuse C/E pins of Q1 or S/D of M1?

Thats what it always showed on internet about p channel mosfet high side switching, so I connected it like that. But its interesting that one buck converter tutorial showed the mosfet other way around, and it just seemed like an error to me. Should I try to use it the other way around, source to the load, and drain to 12v?

Yes. Simple check: with confused S/D the MOSFET is always ON! See the diode in the complete symbol.

A buck converter is a tricky circuit that should not be used for ordinary applications.

Oh nevermind! The mosfet was right orientation. I somehow mixed up the emmiter and collector of the npn transistor! It seems to be working now! Such a stupid mistake. I have one question, for example I want to use 92V with the mosfet. That means I cant connect ground to the mosfet, as the voltage would be 0-92=-92v and the mosfet would die. (Its Vgs max is 20V). What do I do in this situation?

Both transistors must withstand that voltage. Such transistors exist, you only have to find them :slight_smile:

I would have thought that R2 (what I would call a drain resistor) would be between the gate and Ground or at least the low side of the MOSFET. With R2 in your circuit and the high impedance of the transistor and MOSFET, causing very low current through R2 will have the gate at 12 V or close.

I could be wrong, given a flawed understanding of transistors and such, if so ignore my suggestion. But if correct R2 = 1k seems light for a drain resistor.

The 100Ω base resistor is overloading the output pin, increase it to 1000Ω.

This Gate discharge resistor always sits between Gate and Source. Source is the positive supply with a P-channel MOSFET so here it's a pull-up resistor.

Right, 43-50mA is too much output current. 100 Ohm were okay for a Gate resistor with temporary current, but not for a BJT with permanent base current. A logic level MOSFET also could be used for Q1, for a lower power design together with a higher R2.

Oh boy, you are right! A Z-diode between Gate and Source or a voltage divider between Source and driver Collector can be used to keep the Gate voltage in range.

What frequency is that buck converter being driven at ?
A standard high side switch with a power mosfet is suitable only for quite low frequencies (a few kHz) because the gate pullup resistor is in an RC network with the mosfet gate capacitance. You can try to make the pull up stronger to attempt to overcome that but, at high voltages, that means a lot of current.
The mosfet gate should really be driven by a push pull or similar circuit.

I dont know the frequency Ill run it at yet. Ill have to test it and figure out what works for me. Right now I am trying to understand how to adjust the timers to get faster pwm, which is quite hard as I am new to all this.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.