How to Suppress Inductive Spikes, or Why a Diode Is Connected in Parallel with a Relay.
In circuits where a relay coil is driven by a transistor, a diode is always connected in parallel with the coil.

Let's figure out what role the diode plays. Below is a circuit showing that if a certain voltage is applied to the gate of a field-effect transistor, the transistor becomes equivalent to a wire, meaning its resistance tends to zero.
Let's build the circuit shown below and see how the output signal depends on the input.

In all the oscillograms in this article, channel one is the control voltage at the transistor's gate, and channel two is the voltage at the drain of the field-effect transistor.

The oscillogram shows that the shape of the output signal fully follows the shape of the input. Let's replace the resistor with an inductance and see how the output signal changes. My inductance is a small motor for drilling circuit boards.


The oscillogram shows "needles", the very inductive spikes whose amplitude reaches several hundred volts, while the motor is supplied with 5 V. It's also worth noting that the spikes appear on the falling edges of the pulses, i.e. at the moment the transistor turns off. The cause of the spikes is as follows: when current flows through an inductance, whether a motor or a relay coil, magnetic field energy accumulates in it. When the transistor starts to turn off, and therefore the current through the coil decreases, the coil tries to keep the current flowing through it at the same level. It can resist the decrease in current only by using the accumulated magnetic field energy. So all the magnetic field energy is converted into electrical energy, which is what causes what we call an inductive spike. The transistor was chosen with a large voltage margin, a maximum drain-source voltage of 200 V, but it's still surprising that it didn't burn out.
Now let's connect a 1n4007 rectifier diode, which has enough voltage margin, in parallel with the motor and see what changes.
Note that the diode is connected opposite to the direction of current through the coil; otherwise, if you connect it in the direction of the current, nothing will limit the current through it when the transistor opens, and the diode will burn out. In general, there's one good rule worth remembering: always connect a resistor in series with a semiconductor element, otherwise it will simply burn out or its service life will be significantly reduced.

The oscillogram shows that the spike amplitude has decreased by about 7 times, but the spikes are still there. It becomes clear that rectifier diodes aren't suitable for this purpose, and it's better to use a fast diode; an FR157 quickly turned up in my stash.
The parameter to pay attention to when choosing a fast diode is called the maximum reverse recovery time; for the FR157 it is 500nS, and the spikes appear once every 1mS, so by the time the next spike appears the diode will have recovered and will be ready to take it.

The oscillogram shows that the spikes have disappeared and the motor has started to spin. Before the diode was connected, it didn't spin and made a sound that changed depending on the generator frequency. From 1 to 15 Khz the sound the motor made was audible, which almost corresponds to the audio frequency range.
Now we know why a diode is connected in parallel with a relay's control coil and how to suppress inductive spikes.

Let's figure out what role the diode plays. Below is a circuit showing that if a certain voltage is applied to the gate of a field-effect transistor, the transistor becomes equivalent to a wire, meaning its resistance tends to zero.
Let's build the circuit shown below and see how the output signal depends on the input.

In all the oscillograms in this article, channel one is the control voltage at the transistor's gate, and channel two is the voltage at the drain of the field-effect transistor.

The oscillogram shows that the shape of the output signal fully follows the shape of the input. Let's replace the resistor with an inductance and see how the output signal changes. My inductance is a small motor for drilling circuit boards.


The oscillogram shows "needles", the very inductive spikes whose amplitude reaches several hundred volts, while the motor is supplied with 5 V. It's also worth noting that the spikes appear on the falling edges of the pulses, i.e. at the moment the transistor turns off. The cause of the spikes is as follows: when current flows through an inductance, whether a motor or a relay coil, magnetic field energy accumulates in it. When the transistor starts to turn off, and therefore the current through the coil decreases, the coil tries to keep the current flowing through it at the same level. It can resist the decrease in current only by using the accumulated magnetic field energy. So all the magnetic field energy is converted into electrical energy, which is what causes what we call an inductive spike. The transistor was chosen with a large voltage margin, a maximum drain-source voltage of 200 V, but it's still surprising that it didn't burn out.
Now let's connect a 1n4007 rectifier diode, which has enough voltage margin, in parallel with the motor and see what changes.
Note that the diode is connected opposite to the direction of current through the coil; otherwise, if you connect it in the direction of the current, nothing will limit the current through it when the transistor opens, and the diode will burn out. In general, there's one good rule worth remembering: always connect a resistor in series with a semiconductor element, otherwise it will simply burn out or its service life will be significantly reduced.
The oscillogram shows that the spike amplitude has decreased by about 7 times, but the spikes are still there. It becomes clear that rectifier diodes aren't suitable for this purpose, and it's better to use a fast diode; an FR157 quickly turned up in my stash.
The parameter to pay attention to when choosing a fast diode is called the maximum reverse recovery time; for the FR157 it is 500nS, and the spikes appear once every 1mS, so by the time the next spike appears the diode will have recovered and will be ready to take it.

The oscillogram shows that the spikes have disappeared and the motor has started to spin. Before the diode was connected, it didn't spin and made a sound that changed depending on the generator frequency. From 1 to 15 Khz the sound the motor made was audible, which almost corresponds to the audio frequency range.
Now we know why a diode is connected in parallel with a relay's control coil and how to suppress inductive spikes.



