Electrical – Relay current flow

circuit analysisdiodesrelay

I'm new to electronics.

I found the tutorial about the control of a relay using GPIO in raspberry pi from http://arnholm.org/raspberry-pi-controlling-a-relay/ .
It has the following electric circuit :

enter image description here

I wonder the existence of the diode laid down parallel with relay. I searched about this and got the answer from Why is there a diode connected in parallel to a relay coil?

Since an inductor (the relay coil) cannot change it's current instantly, the flyback diode provides a path for the current when the coil is switched off. Otherwise, a voltage spike will occur causing arcing on switch contacts or possibly destroying switching transistors.

It says eventually when the switch is off, the flow of relay current should go through the flyback diode to prevent destroying the switching transistor because it causes the undesirable spark on it.

But I am worried about if the relay current from REL1 go through D1 diode, the sudden excess of current might make the pi die after the current going up above the diode.

So I thought one of the solution is if we put 2 diodes in the position D1 and draw a line between them, we can release the current safely.

So my question is

What if we put a resistor above the D1 diode? Does the current can be attenuated with dissipation in the resistor? Can this be also a solution?

Best Answer

This so-called arc from breaking the coil current Only occurs with the dry contact . The time could be in the nanosecond range and since V equals V=LdI/dt with dt going to zero V can arc on dry contacts. Because the transistor has some capacitance it cannot shut off that quickly so the diode is only to protect the transistor and there’s very little capacitance that would feedback any significant charge back to the microcontroller so no worries there .

The 100mA transistor current is immediately switched through the diode along the same wires can be handled easily by 100 mA small signal diode. The diode should be placed close to the transistor rather than the coil so that the current path is the same . For EMI pulse attenuation it’s best to have the switched current ground and power signals to the relay coil interface close together to minimize current loop area and antenna-like interference to high impedance nearby signals.

Furthermore 3 mA into the base is more than enough to saturate the transistor. The BC 337 will rise from 50 mV to less than 200 mV which is within 5% of your 5 V supply with only one milliamp of base current @Ic=100mA