# How to properly PWM a N channel MOSFET

I want to dim a 5A LED strip, so I am planning to create a PWM circuit, my primary MOSFET is the DMT3006 but since I am driving a fairly high current driving this MOSFET directly with my microcontroller would cause the MOSFET to heat up due to the high Rds on resistance, thus I am adding another MOSFET BSS138. The circuit looks like this:

simulate this circuit – Schematic created using CircuitLab

Would you consider this circuit a good MOSFET PWM circuit? If not how can I improve it.

I would also like to know what are maximum frequencies I can go with the MOSFETs I have chosen, how do I compute them given the switching characteristics values in the datasheet. The BSS138 has the worst turn off delay of 36 ns of the two MOSFETs. So 27.77 MHz but I have to accomodate for an 8 bit duty cycle so 36 * 256 = about 109 kHz. So am I correct that the highest frequency I can PWM is 109 kHz?

• Would you consider this circuit a good mosfet PWM circuit? No, I would use a MOSFET with a low threshold voltage designed to be controlled directly from a 3.3 V output. The turn off delay of your BSS138 is determined by your circuit. That 36 ns is only under the conditions specified in the datasheet. Also R2 (1k ohm) and the input cap of M1 limits the switching to much less than 1 MHz. Also there is no reason to use a higher PWM frequency than say, 1 kHz. Going any higher will mean more switching losses. At 1 kHz switching frequency, the proposed circuit might be "good enough" though Jun 8, 2021 at 17:40
• Why do you want to PWM that high? A few kHz should be sufficient for visual purposes. Even a few hundred Hz under most conditions. Jun 8, 2021 at 17:45
• @SpehroPefhany I actually want 5Khz of frequency, i just want to learn how to determine the maximum frequency the circuit is capable of, for future projects that might need higher requirements Jun 8, 2021 at 17:50
• The chosen PWM frequency should only be higher than the system that is measuring the light from the LED. If a human eye is the measurement device, then a few hundred Hz is easily enough, if a video camera system is the measurement device, then the PWM should be faster than the frame rate of said camera system. Jun 8, 2021 at 17:50
• you mentioned an input cap for M1 It is the input capacitance of the MOSFET. MOSFETs behave like a capacitor (this DMT3006 is around 1 nF) between gate and source. Jun 8, 2021 at 20:06

I suggest using a purpose-built gate driver, which is not much more expensive than trying to "roll your own" and will allow you to modulate the MOSFET at a relatively high frequency.

For example, the Microchip MCP1406/07 can sink or source 6A of gate current (well, read the datasheet for details) and is even available in through-hole if that's what you want. It's about \$1. There are others, if you do a parametric search you can find many products that will be similarly good.

Your MOSFET has around 27nC of gate charge at 10V. That gate driver should be able to switch the MOSFET as quickly as ~10-20ns. You may actually wish to add some gate resistance to slow it down so as to reduce EMI and ground bounce (perhaps around 15 ohms). That causes more dissipation in the MOSFET so it's a trade-off.

The 1K ohm pullup in your circuit will cause the turn-on time to be around 25-30usec so you probably wouldn't want to PWM faster than a few hundred Hz with that driver.

• May i ask how were you able to come up with the 25-30usec number so i can lower the resistor. I tried looking for a 24v version of the one you recommended as i want to use the circuit on a 24v LED strip too but looking for gate drivers is kinda tricky as they come in small packages, I have to make heatsinks for them. Jun 8, 2021 at 18:39
• I just estimated from the gate charge and ~1mA maximum current. Doing a simulation would give a more accurate number, as would doing more detailed calculations (see various application notes). You can get the Microchip gate driver in a DIP-8 package. Jun 8, 2021 at 18:40

A MOSFET should always be driven from a low-output-impedance driver when it's used as a load switch. In your circuit, the output impedance of the pre-driver (1k) and the input capacitance of the MOSFET (1.1nF) form a low-pass filter with a cutoff frequency of 144kHz.

The maximum gate-source threshold voltage of the 3006 is around 3V. So if you drive it directly from your MCU (assuming the MCU's GPIO drive capability is enough), the VDS drop will be less than 0.1V at 5A load current (check the 1st characteristics at p.3). This results in a dissipation of around 0.5W (at full brightness) and thus a temperature increase of around 50°C at worst.

If you keep the gate voltage around 10V, the dissipation will get halved (approximately).

So, it's better to make the drive impedance low and drive voltage high. There are gate drive ICs for that purpose, but if you don't want to buy an IC and if you want to build your own with discrete instead, you can place a totem-pole driver between the output of pre-driver (inverter /w BSS138) and the input of the power MOS:

simulate this circuit – Schematic created using CircuitLab

A more practical way would be using a logic-level gate MOSFET (i.e. one with having lower VGS-threshold) and drive it directly from the MCU.

• can i not directly interface the controller to Q1 and Q2? , Jun 8, 2021 at 18:19
• "This results in a dissipation of around 0.5W (at full brightness) and thus a temperature increase of around 50°C at worst." Maybe worse after accounting for switching losses? Jun 8, 2021 at 18:29
• I ment node2 directly on the base of Q1 and Q2 on your schematics. Also if i move R2 on my circuit to this position is it now driven by low impedance? Jun 8, 2021 at 18:49
• @PhilFrost I didn't take the switching losses into account, hence the statement "full brightness" i.e. 100% PWM. During switching, awerage I²R dissipation may get lower but yeah, total dissipation may exceed 0.5W with the switching losses. Jun 8, 2021 at 19:35
• @DrakeJest you the totem-pole driver is a buffer and will output 3.3V when you applied the input from the MCU directly. In the schematic in your last comment, the gate is connected to 12V so the MOSFET will always be turned on and never be switched off. Jun 8, 2021 at 19:39