Circuit:
Animation of the relay operation without using a flyback diode:
The energy stored in the magnetic field discharges in an arc in the control contact when the control circuit is opened. Depending on the strength of the arc, this leads to increased wear of the contact surfaces or even to welding ("sticking") of the contacts. If a transistor is used in the control circuit to switch the relay instead of the switch, the high negative self-induction voltage which is generated at the coil when it is switched off, usually leads to the destruction of the transistor within a few switching operations. To prevent this, a free-wheeling diode can be used for DC voltage or a suitable varistor for AC voltage.
Animation of the relay operation with a flyback diode:
The self-induction voltage opposes any change in current. If the contact in the control circuit is opened, the free-wheeling diode allows the current to continue flowing, preventing the buildup of larger self-induction voltages. The current continues to flow until the energy of the magnetic field is dissipated in the diode and coil resistor.