Electrical – 2N7000 driver circuit Raspberry Pi

mosfetraspberry pi

I am using a 2N7000 N Channel FET as a switch similar to the circuit below. The load is a 12V LED lamp and is connected to 12V not the shown 5V below.
Most of the time the circuit works perfectly turning the lamp on and off as desired. Occasionally the FET becomes damaged and the LED is lit st low brightness all the time reading about 6V at the Drain. When the GPIO turns on the FET will still light at full brightness and when the GPIO turns off or is even disconnected the LED is lit partially. Replacing the FET fixes the problem. The Lamp unit is a 22.5mm Techna lamp. http://www.techna.co.uk/components/com_jshopping/files/data/LEDtec_LED_Indicators_and_Bulbs_Datasheet.pdf

Any suggestions appreciated. I am not sure whats damaging the FET or what could be done to prevent damage.

enter image description here

Best Answer

If your load is located 20 meters from 2N7000 switch (as the comment says), the problem is in wire inductance.

A 20-m wire has self-inductance of about 50 mH. When the N-FET turns OFF, there will be spikes of voltage with kV-level amplitude, which will kill the FET. You need to use a clamping diode, as it is normally used when controlling coils of electromechanical relays.