[ 10M is way way too much for a power FET gate resistor. Go with 100k or less ]
You're just seeing the large capacitance between gate and source, typically in the nanofarad range,
larger for higher power and higher voltage FETs. The symbol for a FET explicitly draws the capacitor
if you look at it (typically most of the capacitance is to the source, a small fraction to the drain).
When the switch opens the load resistor pulls the FET drain/channel/source down from 6V to 0V
pretty much instantly, so the probe point also drops 6V instantly due to the capacitance. The fact
the probe point drops from 6V to 3.6V while the button is pressed is due to the loading by the
'scope probe forming a voltage divider with the 10M resistor.
Your other MOSFETs probably have too much gate leakage current for the effect to show (this might
mean they've been subject to degradation through static electricity, although they might just have
higher leakage current as per datasheet). The gate leakage is in parallel with the 10M resistor.
Those parts are mentioned on his image. Anyways, with an order of magnitude higher capacitance of at least 10,000pF combined with 10MΩ gives a time constant of 100ms (quite slow). Switching to a 2.2K resister lowers this to 0.022ms or 22µs.
Perry, i am measuring between Gnd ( the battery negative terminal) and the gate of the mosfet. (using a very basic oscilloscope) +thanks for the Karma.
Sorry MarkT for confusion on which mosfet it was, i have attached the datasheet(hopefully attached now). Ive used both Part NO. (IPP80P03P4L-04) and the Marking on the FET itself (4PO3L04) in my post above.
Both solutions of using 100k pullup (instead of 10M) and schottky diodes have solved the negative voltage spike, thanks, but i still dont understand how the voltage is negative without some inductance somewhere?
It does appear this mosfet has a far larger gate source capacitance, but i still cant see why the voltage spike would be negative?
I can send someone (in the UK) one of the mosfets to try themselves? if they want.
I think i understand this a bit better now, thanks dlloyd and everyone else.
The circuit which i destroyed the microcontroller is shown below (simplified a bit) and i think the negative charge in the gate of the mosfet (- Vcc voltage) was discharged throught digital pin 9 in my case (to ground or Vcc im not sure). Do you think this was the cause of the failure? (i may have just wired it up wrong... twice)
To improve this circuit, taking your recommendations into account, ive drawn a circuit in Figure 2. Putting in a 2.2K pull up resistor and a schottky diode between gate and ground.
However, the negative voltage can still go through digital pin 9 to Vcc if the microcontroller is pulling-up at the time the switch is open? When the microcontroller is pulling to Vcc there is little resistance and the charge would go through the microcontroller rather than the 2.2k resistor? Would this cause damage to the uC?
In your figure 2, I would recommend a 220 ohm series resistor to limit the gate current and help protect D9.
I see you're using this as a high side driver to control a relay coil ... note that it's much more common to use a low side driver using an N-channel MOSFET like this:
Im using a 2N222 NPN transistor to switch the base of the P channel mosfet, this will hopefully eliminate the chance of negative voltage charge getting to the uC. (as the NPN transistor shouldnt allow the charge to go flow to the base)
Ive tried this on the breadboard and all works fine, Thanks for the info on Mosfet gate charge, i think this has solved my problem,