1
\$\begingroup\$

I am currently working on creating a switch to control 24 V for BLDC. I am using esp32 to turn on and off the switch (3.3V logic). I intend to use P-channel mosfet, because I want to connect 24 V on high esp32 signal and to keep motor on Gnd when no signal is present. I tried simulating small circuit using Pmos in LTspice, but got no luck controlling the signal, load always seems to be around 24 V. As I understand, P-mos should work same as N-mos, only difference is the votlage level, which turns on or off the mosfet, in my case, high voltage should close the switch and I should get 0 V, low signal should open it and givving me 24 V on a load. What am I doing wrong?

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ A voltage does not just have a magnitude: It has a sign, too. Is your signal source relative to GND or relative to +24 V? \$\endgroup\$
    – greybeard
    Jul 10, 2023 at 12:10
  • \$\begingroup\$ It is relative to GND. \$\endgroup\$
    – Dominykas
    Jul 10, 2023 at 12:17
  • \$\begingroup\$ As Justme stated in their answer the PMOS is upside down. Even if it was connected correctly the PMOS will always be on because normally it requires its Vgs to be negative (i.e. source voltage should be greater than gate voltage, w.r.t. GND). In your case, even if the incoming pulse is 3.3V the PMOS will still be on because the Vgs will always be negative (24V-3.3V vs 24V-0V). \$\endgroup\$ Jul 10, 2023 at 12:23
  • \$\begingroup\$ so maybe you could help me and provide a solution how to control it with 3.3 V signal? Or should I just use nmosfet? Because I have been using them and it does not requires anything more just besides control signal. \$\endgroup\$
    – Dominykas
    Jul 10, 2023 at 12:25

4 Answers 4

2
\$\begingroup\$

The problem with trying to use a P-MOSFET is that the gate-source voltage, when orientated properly becomes a voltage from the gate to the positive rail, where your ESP produces a voltage relative to GND. There are ways around this, one common thing to do is to use a N-Channel mosfet with a pullup resistor to produce your signal.

enter image description here

You can play with the above schematic. In the above schematic, the left voltage is 3.3 V, and is switched to the N-FET to act as the ESP, and the right is 24V, being switched to the 1 Ohm load standing in for your load. In this way, you can convert a 3.3V, from the ESP, referenced to GND, to a -24V singal, referenced from the source of the P-FET (ie the positive rail).

Finally, this circuit does lack the default behaviour you want, where it's on unless a signal is applied. You can use a pullup on your 3v3 signal, such that it's usually high, and the N-FET is usually closed.

You actually dont need to use two FETs though, as you can get the behaviour out of a single FET, using a N-channel.

enter image description here
You can play with this here This circuit is on untill the switch is closed, which represents your ESP driving a low. You might want to add some protection, as if your 24V has a transient, your ESP is exposed to this.

\$\endgroup\$
2
\$\begingroup\$

You are not using the FET correctly.

First of all it's upside down.

The P-fet source needs to be to 24V and drain to load.

And then the gate supply needs to be referenced to source, i.e. 24V on gate is 0V Vgs and 0V on gate is -24V Vgs.

If the FET tolerates 24V that is.

\$\endgroup\$
4
  • \$\begingroup\$ could you explain, what does it mean to reference to source? Providing a +3.3V signal on Gate is not enough to open and close pmosfet? \$\endgroup\$
    – Dominykas
    Jul 10, 2023 at 12:23
  • \$\begingroup\$ If you wire the Pmos correctly with its Source pin at +24V and its gate at 0V or +3.3V then the gate-source voltage is 24V or 20.7V so it is always turned on. The gate of the Pmos needs to be driven to +24V to turn it off and driven to +14V or less to turn it on by another transistor that is driven from the 0V and +3.3V. \$\endgroup\$
    – Audioguru
    Jul 10, 2023 at 12:42
  • \$\begingroup\$ I see. Thank you for explanation. But maybe you could also explain why +14V or less ? \$\endgroup\$
    – Dominykas
    Jul 10, 2023 at 12:46
  • \$\begingroup\$ @Dominykas no if you set 3.3V on the gate, you are actually turning the P-Fet more off. Because FET looks voltage between Gate and Source pins, and for P-Fet, Gate pin voltage must be less than Source pin. \$\endgroup\$
    – Justme
    Jul 10, 2023 at 12:50
1
\$\begingroup\$

You need to add a small n-channel FET (2N7000, etc.) to drive your power device. The uC drives the small nFET, which is an inverting driver and level-translator. When the uC output goes high, the nFET drain goes low, pulling the pFET gate to GND, turning it on.

Schematic later if you need one.

\$\endgroup\$
0
\$\begingroup\$

The most sensible thing to do seems to be to use a BLDC controller with an enable input.

The part to use as a low side load switch (switch at GND, load to \$V_{load}\$) is an N-MOSFET; even with a BLDC motor, an external diode protecting against overvoltage is advisable.
If you insist connect 24 V on high esp32 signal, you need an inverter. That can be a level shifting one so you don't need a logic level power N-MOSFET.

If the load/motor needs to be tied to GND, you need a high side load switch.
There are integrated ones. If you roll your own using a power MOSFET, you need a level shifter from the esp32's output to ±\$V_{GS}\$ relative to load voltage high side.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ BLDC controller would be an overkill, because all I need is to provide power to motor, it has some sort of speed controller inside. \$\endgroup\$
    – Dominykas
    Jul 10, 2023 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.