MOSFET pwm circuit question
If the only change you made was exchange Q1 for a mosfet (Irfz34n).

There are two issues you are facing.

One reason your switching element is burning up is slow turn on/off times. With a 22k gate resistor your fet is spending a long time transitioning from Rds_on to being turned off. Same is true for turning on. During these transitions because the FET is current limited by Vgs there is an appreciable power dissipated (Vds*Id).  Approximating the gate as 1 nF, 1 RC time constant is 22 uS. Your first step is to lower R1 to say 100 ohms.

The second issue is with having separate supplies, D1 clamps the inductive kick-back across the motor, however it does not clamp kick-back from the lead inductance in your hookup wiring. One solution is to add an RC snubber at the drain terminal, such as,







simulate this circuit &ndash; Schematic created using CircuitLab