How does the diode protect the transistor in this circuit?

Working my way through the tutorials, and trying to truly understand what all the comonents do in each one. I’m stumped on this one, though. (I’ve attached an image of it, and it’s also on Page 71 of this Guide: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Kits/SFE03-0012-SIK.Guide-300dpi-01.pdf)

Here’s how it looks to me: 5V is provided to the bottom side of the of the relay’s coil, but can’t go anywhere because the transistor is open, preventing the 5V from getting to GND (and because of the diode, which allows voltage to flow only in the opposite direction). When the transistor is switched “on”, the 5V can get to GND, and the coil is activated. So far, so good. And the diode doesn’t seem to enter into the basic functioning of the circuit, right?

But the diode is there to prevent damage to the transistor, from the voltage spike that can come out of the coil when power to it is shut down (that’s what the Sketch comments say). My question is, HOW does it protect the transistor?

When Pin 2 goes LOW, the transistor goes “open”, so any voltage coming from the coil can’t go THROUGH the transistor, because it’s no longer connected to GND. But I guess the voltage going TO the transistor is what might damage it. So how does the diode protect it? IOW, why is the voltage spike coming out of the top of the coil going to go through the diode, and back to the bottom (5V) side of the coil, instead of to the transistor?

Thanks for anyone’s simple explanation.

Flyback diode example circuit.png

When you turn off power to an inductive load, current wants to keep flowing- this produces (with the way it's wired there) a positive spike on what was the low side of the load - this can be many times the applied voltage (this sort of behavior is taken advantage of to make boost converters). The fly back diode lets this brief pulse flow harmlessly to the other side of the coil, instead of potentially damaging the transistor (as it can be higher than the max rated voltage of the transistor).

Read about inductive loads for more info

That almost explains it well enough for my still-ignorant brain. I was going to ask WHY it does what you said, but I did a little more Googling, and found this: https://en.wikipedia.org/wiki/Flyback_diode - which answers the question well enough. Essentially, the circuit consisting of the coil and the diode runs that excess energy around in a circle, dissipating a little each time around, until no more inductive load is created. Of course, this happens in a tiny fraction of a second.

Thanks! Now, hopefully I'll remember a flyback diode anytime I incorporate a solenoid, relay, or any other component that has an inductive load.

I find it easier to understand like this:-

When current flows through a coil it generates a magnetic field. When this current is suddenly turned off there is nothing to support the field and it starts to collapse. As it collapses the magnetic lines of force cut through the coil. That is how electric generators work, magnetic lines of force cutting through a coil. The way physics works is that the polarity of the voltage this collapsing field produces is opposite in polarity to the polarity that generated the field in the first place.

Hence the coil produces a voltage which is opposite or the reverse of the original voltage that produced it. As the field is collapsing it does that a lot faster than the field was originally made to grow and hence the reverse voltage is higher than the voltage used to create the field in the first place.

I hope you find this useful.

haha, yeah, and pressure is applied from the water provider silos that must go normalizing into the atmosphere, but the fuse is blocking the pipe so the server doesn't work : D AHAHAHAHHAHAHAHA

And don't forget that the compressor that puts more pressure on the nozzle. hehehehehe

Grumpy_Mike:
I find it easier to understand like this:-

When current flows through a coil it generates a magnetic field. When this current is suddenly turned off there is nothing to support the field and it starts to collapse. As it collapses the magnetic lines of force cut through the coil. That is how electric generators work, magnetic lines of force cutting through a coil. The way physics works is that the polarity of the voltage this collapsing field produces is opposite in polarity to the polarity that generated the field in the first place.

Hence the coil produces a voltage which is opposite or the reverse of the original voltage that produced it. As the field is collapsing it does that a lot faster than the field was originally made to grow and hence the reverse voltage is higher than the voltage used to create the field in the first place.

I hope you find this useful.

Grumpy Mike,

It’s useful, in that it explains what’s happening with the coil, and why. But you’ve left me with a volttage in the coil that’s higher than, and opposite to, the voltage that created it. That explains why a coil can produce a voltage spike when you cut power to it - because that voltage is all dressed up with nowhere to go!

But my original question was “why does it choose to go through the flyback diode and back to the input side of the coil, instead of to the transistor?” Asked a different way, “How / why does the diode protect the transistor?” If you have a simple explanation for that, I’ll be a happy man! Thanks.

The inductor acts to maintain the current that's flowing, in other words it will push the current out with whatever force is necessary if you try to stop it suddenly. With a diode across the inductor the force that is necessary is 0.7V, which is what happens. The alternative path through the transistor involves exceeding the breakdown voltage of the transistor, which being a lot more than 0.7V, means the current just diverts from the transistor to the diode when the transistor switches off.

The hydraulic analogy is called "water hammer", where you rapidly shut off a water valve on a high speed flow and the momentum of the water hammers the pipe.

Inductors act like current has momentum.

Hi, This might help; http://www.douglaskrantz.com/ElecFlybackDiode.html

Tom.. :)

MarkT: ... With a diode across the inductor the force that is necessary is 0.7V, which is what happens. The alternative path through the transistor involves exceeding the breakdown voltage of the transistor, which being a lot more than 0.7V, means the current just diverts from the transistor to the diode when the transistor switches off.

That's it! So simple - the diode requires less "force" (voltage) to open up to the flow of electrons than does the trannsistor. Is it safe to assume that different diodes have different voltage requirements, or are they all about the same 0.7? And now I know another important term to help me pick the right transistor / diode combination: the breakdown voltage of the transistor.

Thanks so much!

TomGeorge:
Hi,
This might help;
http://www.douglaskrantz.com/ElecFlybackDiode.html

Tom… :slight_smile:

Tom, that’s a fantastic explanation! Every little bit, in nice little words that I can understand. I looked at several of this guy’s other articles, hoping to find something like that to explain transistors, capacitors, and all those other little “ors” that go into so many circuits, but didn’t find any. I’ll search for more from him, though - his explanation was perfect for me.

Is it safe to assume that different diodes have different voltage requirements, or are they all about the same 0.7?

Well 0.7 is the highest forward voltage and it applies to diodes made of silicon. These are by far and away the most common form of diode. It is always the same for a silicon diode. We used to make diodes out of Germanium and that gave a forward voltage of about 0.25V but these days they are rare.

These days a Schottky diode can have an even lower voltage of between 0.15 to 0.45V depending on the current and construction. https://en.wikipedia.org/wiki/Schottky_diode So these are sometimes used for a quicker quenching of the back EMF.

Not to be confused with the similar sounding Shockley diode which is not to be used for flyback applications.

Thanks, Grumpy Mike - and everyone else who chimed in on this one. All in all, a very satisfying Q & A for me!

are you sure that an inductor generates voltage while is applied voltage to it? If you'r trying to understand the logic of the circuit maybe the unclear function of a component could confuse you.....

the electricity doesn't CHOOSE where to pass ... ! It follows precise lows of physics!

is not water to put a nozzle on it or to divert the flow in another pipe : D

BorislavLukanov: is not water to put a nozzle on it or to divert the flow in another pipe : D

Well in this case it actually is because you do not have a linear circuit but a circuit with a threshold where no current will flow until that threshold is reached. If component 1 has a threshold of 1V and component 2 has a threshold of 2V and they are wired in parallel, no current will ever flow through component 2 because component 1 clamps the applied voltage to its own threshold.

are you sure that an inductor generates voltage while is applied voltage to it?

No one in this thread ever suggested such a thing. However when a voltage is removed an other voltage of opposite polarity is generated.

BorislavLukanov: the electricity doesn't CHOOSE where to pass ... ! It follows precise lows of physics!

One could argue that no one ever chooses anything - that everything is pre-determined, and we're just playing out a script. And yet, we still use the word "choose", because it simplifies the discussion. That's what I chose to do in this case - simplify the discussion. But then, I think you knew that.

You may get distracted by shit : D and also is a little bit stupid to comment, but I'm not an expert or sure so I would ask if the positive side of an inductor with accumulated magnetic field on it and no external voltage applied could interact with the ground to make possible the circuit to be closed even if the switches are?

Grumpy_Mike: These days a Schottky diode can have an even lower voltage of between 0.15 to 0.45V depending on the current and construction. https://en.wikipedia.org/wiki/Schottky_diode So these are sometimes used for a quicker quenching of the back EMF.

If I understand this right you claim Schottky diodes are used because they cause the field in the coil to collapse faster. But I believe the converse is true - since the forward voltage drop is lower the current decreases slower and so it takes longer for the field collapses (the current stops flowing). This is an advantage when you are PWMing the coil. Another advantage of Schottky vs. "normal" diode is shorter reverse recovery time - but I think it applies only when you want to turn on the inductive load again.