Why connect the diode to the relay winding?

flyback diode

In the electrical diagrams you can see that the diode is connected in parallel to the relay coil, the cathode of the diode is connected to the positive terminal.This is done in circuits where the relay coil is connected to a transistor.Why connect a diode to a relay?

The fact is that when the transistor disconnects the relay from the power source, high-voltage pulses (reverse EMF voltage) appear on the relay coil, which can disable the transistor.Let’s see what these pulses look like.I connected the oscilloscope probes to the relay coil and applied a voltage of 3.7 Volts to the coil.I will turn the coil power on and off with a button.As you can see, with a 3.7 Volt power supply, 82 volt pulses appear when the relay winding is disconnected!

 

How do I remove these pulses from the coil? It is necessary to connect the diode parallel to the relay coil, the cathode to the positive terminal.When there are pulses on the coil, they will have a polarity different from the polarity of the power supply.At this time, the diode will open and shunt these pulses.The diode must be high-voltage and high-speed, type FR107.

As you can see, with the diode, the high-voltage pulses disappeared.