# LEDs keep dying in 12v circuit with powerful electromagnet

I have a circuit like this:

12V/2A DC input. A small blue LED with a 2.2k resistor in series. A powerful electromagnet with ~40ohm resistance in parallel. It is possible the electromagnet has more components on the inside. When I turn the switch on the LED shines for a second or so and then turns off/dies. I don't see how that's possible with a series resistance this high.

What should I do to have the LED light up at the same time as the magnet is attractive without dying?

• If the 40ohm represents your solenoid, you may want to add a protection diode on it, to stop it from producing a voltage spike when the switch opens Commented Jan 6, 2021 at 15:49
• You need a flyback diode. The energy stored in the coil is creating a big spike of reverse voltage that kills your LED when the switch opens. (LEDs can not usually withstand much reverse voltage.) Commented Jan 6, 2021 at 15:50
• Note that this also happens with small-size switching electromagnets (more commonly known as relays). The heavier industrial ones tend to have a flyback/catch/freewheel diode in-built nowadays, but always check this.
– Mast
Commented Jan 7, 2021 at 12:45
• Your description is ambiguous. Do you mean that the LED shines briefly every time the switch is closed, or do you mean that the LED is apparently damaged? Commented Jan 7, 2021 at 17:19
• Would using an ugly electromagnet help? Commented Jan 7, 2021 at 22:03

Do you have a catch diode across the electro magnet to clamp the high voltage pulse that it will create when you remove power? If not, this is your issue. The high voltage pulse will be at least 2x the supply voltage, and can be much higher, reverse biased across the LED. LEDs are not designed to stand off such a voltage, and thus it fails.

simulate this circuit – Schematic created using CircuitLab

Based on some of the other comments and answers, just wanted to clarify that catch diode, flyback diode, and free wheeling diode are all interchangeable terms for the same thing in this case.

• No, I do not. I am very limited with the components on hand and only managed to find a diode 1N4004P 440V 1A. Will this suffice? Commented Jan 6, 2021 at 16:01
• @AntsAus yes, that should work just fine. Commented Jan 6, 2021 at 16:32
• I have the same problem with my motor , except i used flyback diode (MBR3045CT) ,but my LED is keep dying .. this is my post ( my circuit is like this except i replaced BYV29 by MBR3045CT) electronics.stackexchange.com/questions/595332/… Commented Nov 25, 2021 at 18:33

You need a flyback diode. The energy stored in the coil is creating a big spike of reverse voltage that kills your LED when the switch opens. (LEDs can not usually withstand much reverse voltage.)

simulate this circuit – Schematic created using CircuitLab

The high-voltage spike happens because the coil resists changes in current: It doesn't want the current to stop when you open the switch. The flyback diode provides a path for the coil current to continue flowing when the switch is opened, and it will not allow the voltage to rise any higher than the diode's characteristic forward voltage drop.

Note that the current will only flow for a very brief time after the switch is opened—just long enough to dissipate the energy that was stored in the coil.