N channel pwm frequency

Thread Starter


Joined Oct 25, 2010
Hi all,

I've a variable rate 12v hydraulic solenoid I need to drive, its around 25w according to me and my trusty multi meter.

I have a circuit setup to drive it with a pwm signal from a pic io pin.

Normal thing I think, 100 ohms from the pin to gate, 100k gate to ground, solenoid coil on the high side.

It worked fine, I was happy! The MOSFET is a irlz (forget the number will look it up in a bit) rated well over the 2A needed.

Its now failed closed. First thought is I forgot to put in a flyback diode, I assume this led to the death of my MOSFET?

If I put a flyback diode in it got me wondering, what frequency should I use? Its running at 1khz now but I guess I need to take account of the diode turn off time?

What frequency would the pros use in this situation?

Thanks Geoff


Joined Jun 22, 2012
I would use a 10K resistor from gate to source, and use a UF4001/7 recovery diode across the coil, the frequency will be determined by the mosfet you choose, like the IRF540 which has a gate turn on/off of 35nS,
mostly pwm are between 1 to 30Khz, .
Last edited:


Joined Mar 10, 2018
Most designs I have seen published use a generic power rectifier type diode.

I prefer a fast rectifier diode as that will determine how big a transient will occur.

I looked at this behavior 40+ years ago with a scope, but not a fast probe, so
must admit my observations questionable. I seem to remember using a 1N400x
type of diode did not provide acceptable margin. Clearly its a L and C and parasitic
ESR related problem.

So not very analytical but I would use a fast diode, something around 100 nS or better.

You could always sim this if you have adequate modeling of the solenoid and strays....

Or setup a test, clamp the Vgs and Vgd and Vds with zeners to protect MOSFET, and
using a low C fast probe see what occurs...

Regards, Dana.

Thread Starter


Joined Oct 25, 2010
Thanks guys,

Sounds like I'm in roughly the right area frequency wise then? Was a stab in the dark!

I'll try that and see what happens.

Cheers Geoff


Joined Aug 21, 2008
The amplitude of the flyback pulse on the drain of the MOSFET will be higher the faster current in the solenoid is allowed to reverse.

Two main factors affect this:

The speed the MOSFET turns off, which is mainly determined by the output impedance of the drier (in your case the output resistance of the I/O pin in series with the 100 ohm resistor) and the input capacitance of teh MOSFET which is not specified at the moment, and

The electrical characteristics of the solenoid which I think includes the inductance of the winding, the distributed capacitance of the winding to itself and resistance of the magnetic bits of the solenoid.

All this stuff if difficult to calculate accurately, and maybe not at all if information is missing, to checking the amplitude of the drain pulse with an oscilloscope or monitoring the peak drain voltage with a diode-capacitor peak detector and DVM will allow you to check the peak voltage directly in the case of a continuous series of pulses.
If the voltage you measure is approaching the maximum Drain-to-Gate voltage (VDS) you will need to do something to limit the voltage, like a snubber circuit https://en.wikipedia.org/wiki/Snubber or a diode across the coil with or without a Zener or resistor in series. You may want a resistor or Zener to be in series with the resistor so that you can have more than a diode drop across the solenoid as its magnetic field collapses so that the solenoid will move more quickly than it otherwise would.

The slower the turn-off of the MOSFET the higher its dissipation and turning it on and off at a high frequency will cause more dissipation and therefore a greater temperature rise than turning it on and off at a lower frequency. You can usually get an idea of whether the frequency is too high by measuring the temperature of the device and consulting the datasheet to find out how the case temperature relates to die temperature and the maximum recommended die temperature.

Besides lowering the frequency to lower dissipation you can also lower the impedance of your gate drive by using an appropriate gate driver IC for your circuit and MOSFET. This would also help assure that you get a high enough turn-on gate voltage to minimize the on-time losses.