I'm building an open source hardware board for "home automation" / digital switching of DC loads that is mostly focused on boats / marine applications.

To give some context, here are some of my system criteria / design limitations:

  • 12v to 24v nominal operation (really 12v to 30v) to support most standard DC battery systems
  • High side switching, as most marine systems have loads switched on the positive side with a common ground (similar to automotive)
  • Control of loads up to 15A with PWM support for things like LED lighting. Other possible loads are DC motors, horns, solenoids, other electronics
  • microcontroller is an esp32
  • PWM pins are operating at 3.3v @ 1000hz

Here is the schematic I'm working from:

Yarrboard MOSFET Schematic

So far things are coming along well, but I'm running into the limits of my knowledge when implementing the MOSFET driver circuit. It works fine at both 12v/24v for controlling things in simple on/off mode, and appears to work fine when controlling things like a dc motor pump. However, when I try to control something like a DC light switch it seems like the PWM control isn't working properly. There is no appreciable change in brightness until it gets down to about 10% duty. I got the oscilloscope out and checked a few points in the circuit, and it seems the output at a few different places is not the nice square wave I would expect, but more triangular. The picture below is from pin 1 of J5 (the high side of the output connector) with a short 12v led strip connected.

Some things I've tried:

  • different values for R3/R4. If they get too low, they heat up and dissipate too much power when the mosfet is on, especially at 24v
  • using an NPN transistor for Q1 and 1k resistor for R2. no real difference
  • tried to find a mosfet gate driver, but wasn't able to find a suitable part, probably due to my inexperience with these.

Oscilloscope output

My current rough guess is that it has something to do with gate charge and the switching speed of the main MOSFET. I'm a little bit over my head for deciding the exact values of the resistor divider and MOSFET, so any pointers in the right direction would be greatly appreciated.

I'm hoping I can solve this by changing component values or switching to a different MOSFET, but am also fine with completely changing the mosfet driver circuit if it allows me to accomplish my goals.


I tested the "totem pole gate driver" circuit from @Bravale below and it worked perfectly. I'm now getting a clean PWM signal at the gate, and it works at both 12v and 24v. Here is the final circuit and a shot of the scope.

Yarrboard Mosfet Driver Final Schematic

oscilloscope showing working gate driver

  • \$\begingroup\$ Does this help? electronics.stackexchange.com/a/31598/311631 \$\endgroup\$ Oct 28, 2023 at 18:00
  • 1
    \$\begingroup\$ i would use an nchannel fet to reduce rds on, along with a photovoltaic driver like the vom1271 that makes it really easy to control from a micro. \$\endgroup\$
    – dandavis
    Oct 28, 2023 at 19:09
  • \$\begingroup\$ @dandavis okay, so change Q17 to an n-channel like IRFZ44, added the VOM1271 and schematic looks like this? schematic with vom1271 \$\endgroup\$
    – hoeken
    Oct 28, 2023 at 20:27
  • \$\begingroup\$ yes, but the vom needs a resistor for it's LED as well, 220 or 330 \$\endgroup\$
    – dandavis
    Oct 29, 2023 at 4:26

2 Answers 2


The main issue in the circuit is the high value resitors of the gate. These impedances will make very slow the gate voltage change for PWM. I have simulated with a similar gate charge MOSFET and timing, see signal in green.

In case you reduce the resistors, the circuit will work, but you will waste more power to increase current (about 40 mA in example, blue wave).

To improve both high speed and low current, use an amplifier or a gate driver IC, see example in red, with better speed than above circuits. enter image description here

  • \$\begingroup\$ Thanks, that is very helpful. I tried circuit #2 on an earlier prototype, but the SMT resistors were getting hot, and it wastes too much power for something that runs off battery. The totem circuit looks very interesting. My current plan is to try a gate driver like TC4432 + n-channel mosfet. If that fails, the totem pole driver here and the VOM1241 suggested above are next on my list. \$\endgroup\$
    – hoeken
    Oct 29, 2023 at 19:23

EDITED Light intensity is not changing according to PWM frequency because there is a current sensing device re-regulating the current at a fixed level. This current sensing circuit is in conflict with the PWM control. Only when the PWM cycle is at 10% current is so low that the current sens circuit can't keep up and the brightness of the LED starts to dim. IMO, you should remove the current sensing circuit. It's not necessary if you have PWM control. Of course the PWM control should be programmed to keep current at max current allowed for the LED. Current sensing is only needed when there is no other way to control the LED current.

The other problem I see, is that the 15V zener diode (D18), its anode should be connected to GND, and its cathode between R3 and R4. As it is, it has no effect and I guess that the gate voltage is still at 24V or slightly less, but not 15V. And it will damage the Mosfet.

R4 is not necessary. It only impedes the signal at the gate, preventing it to go to zero volt when it has to turn off (in case of a N-Mosfet)

R3 should be between 10K and 50K. 100K may be too high for fast switching. The higher the impedance, the slower the switching. But too low impedance at 24V would consume too much current through the zener. 10K will provide 2.4mA and it's more than enough. 22K would be a good value.

I don't understand why there is a 24V connection to the Drain and to the Source pins of the Mosfet at the same time through the fuse. This is either a schematic mistake or a design mistake. As it is the Mosfet should have no effect at all. 24V shuold be connected only to the Drain pin (in case of N-Mosfet)

Whether you use a P chanel or N chanel Mosfet, the problem, according to the oscilloscope snapshot is that the gate is never at correct voltage. So it never turns off or turn s on completely. P chanel Mosfet gates should be at the same voltage or slightly above the voltage of the source to turn off and lower than a treshold to turn on, but better much lower than this treshold, or at zero V. N chanel gates should be between 5 and 15V to turn on and 0V to turn off. Anything in between is bad.

  • \$\begingroup\$ I will get an oscilloscope picture of the gate, this one I uploaded is on the output. The LED strip is wired to #1 and #2 on J5, a screw terminal. GNDD and GNDPWR are two ground planes, connected with an 0805 0 ohm resistor. I could try connecting them with a wire and see if that helps things. \$\endgroup\$
    – hoeken
    Oct 28, 2023 at 23:48
  • \$\begingroup\$ I understand a little bit more your circuit now. So I edited the answer. Please read above. \$\endgroup\$
    – Fredled
    Oct 29, 2023 at 19:24

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.