# Please explain the purpose of the marked resistors and diode in this transistor relay driver circuit

Please explain what the circled components are for.

What is the difference between the $$\V_{cc}\$$ and $$\V_{in}\$$, can they be the same?

• This looks like a diagram that would come with an accompanying article titled "how a relay driver works" that would explain all your questions. Have you done a search and found no pages that help? If so, you may need to explain your confusion better. – TimWescott Apr 8 '20 at 16:28
• Do you know what the relay actually does? – NAND Apr 9 '20 at 15:07

Before answering, we should know what the function of that circuit is.

The function of the above circuit is when $$\V_{in}\$$ is high, the relay will work closing the switch so the circuit of the output load will work.

But in case $$\V_{in}\$$ is low,the switch will open and the value of $$\I_C\$$ will suddenly change to be $$\0\$$, making the inductor produce high current and the current find no path except the transistor causing damage for the transistor.

So we treat that problem using a diode and the diode will work only when $$\I_C=0\$$.

So in the schematic below we can consider the transistor as a switch, so when the $$\V_{in}\$$ is high the switch will be closed and when $$\V_{in}\$$ is low, the switch will be open and the inductor(relay) will produce high current making very large voltage drop across the switch(transistor) damaging it.

For $$\R_s\$$ and $$\R\$$, they are used as current limiting resistors, and their values depend on the components used in the circuit and the gain needed to produce $$\I_C\$$.

For $$\V_{in}\$$ and $$\V_{CC}\$$, them difference between the is that $$\V_{in}\$$ is square wave and $$\V_{CC}\$$ is constant dc voltage source.

Vcc is the supply voltage and Vin the input voltage. Vin could be at Vcc (constant voltage), or a pulse/pulse train.

Vce is the collector-emitter voltage.

Ib is the base bias current

β is the current gain of the transistor.

Rb is the base bias resistor. At the required Vin, it is chosen such that Ib and consequently Ic are high enough to drive the relay (Ic=Ib*β). In this condition Vce would be at it's lowest possible value and the voltage across the relay coil close to Vcc.

R is a pull down resistor between base and emitter to avoid noise pickup and erratic turn-on of the transistor when there is no base bias current.

The diode across the relay coil is called a 'freewheeling' or 'flyback' diode. Its purpose is to enable dissipation of the energy of the reverse voltage spike induced by the relay coil, at transistor turn-off, within itself.

Vcc can be the same as Vin if Rs is sized correctly to allow the proper current to flow. That is why Rs is there.

R is optional in many cases and drains small injected charge from the collector P junction into the base junction which can cause the BJT to spuriously turn on when it should be off if it is really sensitive.

The diode is to prevent a damaging voltage spike when you interrupt current through the relay's coil inductance to turn it off. It works by providing an easy path for current to continue circulating through the inductor after you open the switch so it can die out.

When you interrupt current through an inductance, the magnetic field collapses and the inductor turns into a source. The energy stored in it is used to push the currents at the same level as was just flowing due to $$\V=L*\frac{di}{dt}\$$. If the path is difficult, the energy is used to generate a huge voltage spike to push that level of current through. If it is easy, only a lower voltage is needed.

Like stopping a train with inertia behind it. You can either let coast and slow down gently over a longer period of time, or place a brick wall in front of it to stop it quickly. That will stop it hard and fast, but might knock the wall over at the same time.