A diode is connected in parallel at both ends of the relay coil. The correct term should be called an "inverting" diode. Of course, the function is to protect the driving transistor from being broken down by the back EMF of the inductor.
But in the switching power supply, it is not a simple protection function. In the switching power supply, this diode is also used to improve the efficiency of the power supply, mainly to release the back electromotive force as a secondary power supply, and the secondary has a negative voltage output, which is more effective.
When designing some more high-efficiency switching power supplies, this diode will be replaced by a field effect tube, and a delay control circuit is designed to accurately release the back electromotive force to improve efficiency.
The relay is connected in parallel with a 1N4148 diode, and it is the negative pole of D connected to Vcc. This circuit is well known that Vcc is the positive pole of the working power supply. The single-phase conduction characteristic of D is here to give full play to its function. Its scientific name in this circuit is a freewheeling diode.
Freewheeling diodes are often used together with energy storage elements to prevent sudden changes in voltage and current (ie, the relay is released when the transistor is off) to provide a reverse current path for the relay inductance.
The inductance can provide continuous current to the load through it, so as to avoid sudden changes in the load current and smooth the current. In the switching power supply, you can see a freewheeling circuit composed of diodes and resistors connected in series. This circuit is connected in parallel with the primary side of the transformer. When the switch tube is turned off, the freewheeling circuit can release the energy stored in the transformer coil to prevent the induced voltage from being too high and breaking down the switch tube. Generally, a fast recovery diode or a Schottky diode is sufficient. It is used to consume the reverse potential generated by the coil in the form of current. It can be seen that the "freewheeling diode" is not a substantial element, it is just a function in the circuit. The effect is called "freewheeling".
Some relay manufacturers install the diode inside the relay when they leave the factory, such as Omron, which is often used in PLC control circuits. It is very convenient. Note that it is marked with No. 11 on the two terminals of the coil. You must not connect it wrongly when wiring. , Otherwise the freewheeling diode will burn out.