Let's do a proper "snubber". (Not "shunt" as I called it last time).
I'm re-measuring with the gate voltage on the yellow channel and the drain voltage on the blue channel of the scope. Notice that the blue channel has a 5V per division scale and the yellow one 1V per division.
Second lets add a 100nF capacitor from drain to VCC like I did in the previous post.
|"snubber" cap to VCC|
That is with a "snubber" cap to VCC, which arguably is not really a snubber at all.
Finally, lets really add the snubber over the Drain and Source of the mosfet, which means Drain to ground as the Source is directly connected to ground.
|snubber cap across drain-source|
There is still some high frequency noise (~20Mhz) but it has a very low amplitude.
Let's go back to the initial situation, is it really a problem? I guess with the mosfet I'm using (IRF540), not really. It has a Drain Source breakdown voltage of 100V, and the largest peak I notice is 40V. On the other hand that might just go past the breakdown voltage of the LEDs on the LED strip and that is not a good thing either.
A curious thing is that in the non-snubbed circuit the drain voltage goes all the way up to almost 12V and in the snubbed circuit it only goes up to 5V. It looks like the LED strip in combination with the snubber acts as some kind of impedance divider.
If I change the snubber from 100nF to 1uF (10x larger) the peak voltage on the Drain drops to 4V. Changing it to 50nF raises the peak voltage to 6V.
Something to ponder about...