Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

1N4148 as a flyback diode on a small 5v relay?

Status
Not open for further replies.
A series resistor between the coil and collector will reduce the turn-off time only to the extent that the relay is not driven with as high an operating current to begin with, without that resistor. I question whether that series resistor will reduce the flyback voltage sufficiently, as the flyback voltage can be well over twice the collector-emitter rating of the transistor, while the series resistor will reduce the flyback voltage by maybe 50% at best.

The flyback voltage will appear almost entirely across the much higher resistance of the open collector-emitter, so the series resistor doesn't aid as a voltage divider for the flyback voltage.

The voltage across the coil at turn-on is no greater than the power supply voltage.
 
Because they didn't know what they were doing.

The diode current at turnoff is the same as the current when on, as Mike said above. This current through the diode has the effect of continuing the relay magnetic field until the current finally drops to zero. The effect is a slow release of the relay.

In some circumstances this can cause arcing of the contacts as they are pulled apart too slowly. For some high-end apps they use a zener across the relay coil, but in series with a diode and the zener is inversed to what is shown above. This provided the fastest relay release possible while still allowing the flyback voltage to be "clipped" by the zener at whatever voltage is needed to ensure the Vce safety fo the switching device.

So zeners are sometimes used, just NOT as shown above. :)

Also in some old high quality (MIL spec) equipment I salvaged relays from they just used a series snubber of cap+resistor on the relay coil. Presumably this is more reliable than a diode+zener or at least the zeners of the time. You only need to clip the peak of the flyback voltage, and relay coils don't have a lot of stored energy generally.

Hi,


Sorry to say but, a couple guys here have this behavior backwards.

A regular diode like 1N4001 or 1N4148 will cause the relay contacts to
open more slowly than with a zener of say 5v or so. This could cause
more arcing and even welding of the contacts together in some cases.

The reasoning behind this is best understood by looking at the volt
seconds in the coil. The relay coil is a coil just like any other, and so it is
just basically an inductor. One way to look at the voltage and current
relationship in an inductor is like this:
v=L*di/dt
and if we rearrange:
v*dt=L*di
and keeping in mind that L is constant, di then depends on the left hand
side or:
di=v*dt/K
Note that di is the 'change' in current, and v is the voltage, and looking
at this last equation we can plainly see that if we increase v we increase
di for any dt or K. What this means is that the larger the voltage the
faster the current changes. What this means to our relay circuit is:
"The higher the voltage, the faster the current decays to zero",
and we know that zero current means lower flux and so the relay
contact opens. This also means that the higher the voltage the
faster the contact opens.

The current is caused by the coil when the when the driver transistor turns off,
and the voltage is dependent solely on the type of diode(s) used
(or resistor if that is used instead). To get an idea how this affects
the relay contact opening time, we can substitute the inductor current
for di and see how this affects the time dt. Starting with:
di=v*dt/K
we get:
iL=v*dt/K
and solving for dt we get:
dt=K*iL/v
From this we can see that regardless of the initial current iL or the size
of the inductor (K), as we INCREASE v we DECREASE dt, and this is why
the relay opens faster for a zener than a single diode.

A quick numerical example:

Say we have a relay that is drawing 100ma, and its coil has inductance of 10mH.
This means that the initial current is 0.1 and K=0.010.
We want to try this first with a diode with drop 0.7v and then with a 7v zener
(this represents a 10 to 1 change in diode voltage).

First with a standard si diode with 0.7v drop:
dt=K*iL/v
dt=0.010*0.1/0.7
so
dt=1.4ms

That's not too bad really, but now with the zener 7v drop:
dt=K*iL/v
dt=0.010*0.1/7
so
dt=0.14ms

Wow, we got ten times less time for a voltage that was ten times higher.
Thus, a higher voltage drop equals a faster contact opening time.
For this reason also a resistor can sometimes be used to get the contacts
to open faster because a resistor of the right value means a higher voltage.
The only problem with a resistor is that if the current is a bit higher than
we first thought, the voltage drop will also be higher than we expect and
that could lead to a voltage that will blow out the driver transistor.

Just to note:
For those who would like to look at this from an energy point of view:
dt=sqrt(2*L*dE)/v
and a couple things to note are:
The total initial energy dE is always the same,
L is a constant (roughly), and
dt is again inversely proportional to v.


Of course there is a limit to the effectiveness of a higher voltage, be it with
a zener or a resistor, because soon the inertia of the armature begins to dominate
the response of the device, and the only way to overcome that is with
a two coil relay where the second coil pulls the armature in the other direction.

A side note here is this: a 1N4001 diode for example is more durable for
these applications than a 1N4148 diode is simply because of its physical
ruggedness. In applications that dont have to be fast, it is often wise to
choose something rugged like that which will last a long time.
 
Last edited:
Why did you quote me and then say "people have this backwards"? Are you saying I was wrong? Seems that your post agrees with me as did Ericgibbs nice simulation of the zener circuit I suggested (on page1).

I was well aware of the much faster release times using a zener+diode, and I thought that was very clear in my post. My comment was re the circuit blueroom asked about, which showed JUST ONE diode, the zener, and it was BACKWARDS.
 
I see a couple responses to my post that have said that a series resistor will slow down the closing of the contact. ...Also, that a relay coil responds not to voltage but to current, etc. Of course, these things are true, also.

I made no comment in that post on a series resistor's effect on the speed of closing of the contact. I stated the full voltage appears across the coil at the beginning since i=0 without explaining what advantage or disadvantage that may have. I did not go into a long explanation but suppose I should clarify.

Let us say a coil resistance is 50 ohms and you put a 25 ohm resistance in series. Let us say the relay is spec'ed to hold at 2/3 the stated coil voltage. Without any design margins and ignoring other voltage drops such as Vce, let us say the coil is a 5V coil and so about 3.3V should hold it in, and since the voltage divider gives 3.3V steady state across the coil, then what you get is this. You save about 1/3 in power dissipation in the coil which may be important over wide temperature range. Obviously this may be advantageous to the power supply as well. This example is for illustration and one should not operate so close to the drop-out magnetization of the relay as fluctuation in power supply and other factors could cause problems. I don't think (correct me if I'm wrong) it lessens the actual force between the closed contacts since as long as the armature is fully seated, the force is entirely due to the spring tension in the leaf-spring mechanism on which the contacts are usually mounted -- maybe this depends on relay construction. Perhaps in some cases it may reduce bounce upon closing -- but I'm not making that claim either.

But the particular point about the beginning voltage being the full voltage not having any effect, is what I mainly wanted to comment upon. My point is that it is not to the disadvantage that running the coil on 2/3 coil Voltage would have been. That is, contrast running a 5V coil on a 3.3V rail (ignoring safety margins again), versus running a 5V coil on a 5V rail with a series resistor -- That's where you may see what my point is. During the di/dt, while magnetism is building up and the armature is reacting to the magnetism, the di/dt is greater than if we used a 3.3V rail and no series resistor. I guess on forums like this it can be irritating when someone claims you must not know how an inductor works. Okay... I should have explained it better: I wasn't claiming advantage of the series resistor on closing but only on there being no great disadvantage.

Also, the speed at which a contact closes is not important compared to the speed of opening. Usually, contacts do not significantly arc before they make contact -- they're much more likely arc upon breaking contact.

After making my comments again about the advantage of running a cooler coil, more to the original thread is that if you use a driver that has a built-in clamp diode, how do you take advantage of it? You could leave out the resistor and wire the cathode common point to 5V, right (assuming 5v coils)? I propose, in addressing the arcing break upon slow contact action due to back emf being shorted through the clamping diode, that you can do two things: 1. wire the cathode common to a higher voltage if it is available in your system, like maybe 12V or 24V; 2. put resistors in series with the driver outputs.

So the series resistor has two categories of advantage: 1. speeding up the break; 2. reducing the steady-state coil power requirement while not reducing its holding magnetism to a critical amount (if resistance value is properly chosen).

Oh, and someone also astutely stated another advantage that I only implied. Under the condition of turning off the relay, since the magnetization starts out less, this also means that there is going to be less of a field that must collapse for the relay contacts to open -- again to the advantage of a series resistor speeding the contact break.
 
As Roff noted, a series resistor will slow the relay turn on. If you want to limit the operating current but still get fast turn-on, you can put a capacitor in parallel with the resistor between the relay coil and the transistor collector. Pick a capacitor large enough to supply full current through the relay coil during its operate time after the transistor turns on. Then as the capacitor charges, the current will slowly reduce to whatever the resistor and relay coil resistance allows.

When the transistor turns off, the capacitor will discharge through the resistor, ready for the next relay turn-on.

I ask you and Roff where I said in my post that I wanted to get fast turn-on? If you are concerned that the resistor significantly slows the contact closing, I think it needs to be contrasted against the advantage of speeding contact opening.

First, I don't like throwing capacitors around in my designs unless I can well justify and some good recommendations have been made on RC snubbers, etc. But what if I put a cap across my series resistor? I'm not sure I see an advantage. First, I don't care about increasing the turn on speed and am not sure it will anyway as I wonder if a reasonable size cap will change the speed significantly. And how can it speed it up without also defeating what the resistor does to the collapsing field's circulation current? Doesn't it defeat the series resistors ability to dissipate the magnetizing current?

Makes me start to think about putting another diode in series with your speed-up cap so that it only speeds up closing but not opening. But again, I'm not sure it fixes something that's broke (what's broke?). I thought the series resistor was an elegantly simple addition to a relay driver that improves relay reliability and reduces power requirements.

Apparently it is a hard sell because I've seen no comments like "hmmmmm, that may be a good thing to do, alright!" And admittedly, relay drivers are usually the last thing we would spend much time thinking about in a complex design. But like someone said about the old paper tape punch -- if you let solenoids hang too long.. things can break. So if you've had to pay more attention to it in the past, you may start trying to make your designs a little better even in areas that would otherwise not seem to need improvement.

I used to slap 1n4148s across coils and never think about it until I had a design where the relays got real hot. Then I put resistors in series -- much better. Then I realized if the resistor was in the loop of collapse current, instead of outside the loop (ie put the diode on the collector so the circulation current goes through the resistor as well) then the relay arcs less upon opening/breaking. Pretty good improvement by just adding a 1 cent resistor on each relay.

Another thing I've done is to PWM the relay driver and use a larger voltage rail -- say 7V with a 5V coil. Then if you DO want to insure fast closure, hit the relay with 7V for 50mS (duty cycle = 100%), and then feather it down to 50% duty cycle (or whatever it needs to be). With the PWM approach, it is only software so it costs nothing in terms of recurring material cost. The contact opens faster because the magnetization holding current is not as high as it would be otherwise. But you probably want the diode across the coil so that the current stays flowing through the circulation loop while the PWM output is off. So now you have fast closure, lower power dissipation, but not as fast a contact break speed as you may want.

And if you really really want to open that contact fast, have another driver that reverses polarity on the coil and actually drive it backward! Have you ever noticed relays put a + sign on one of the coil pins? That is because some relays employ a permanent magnet on the armature. Reverse polarity on one of those puppies and you can actually actively drive the armature the other way instead of relying entirely on spring force to open the contact.

If we really have a problem, there are fancy ways to make it the best it can be, but the series resistor is so simple, it is now my de facto standard.
 
You can't place a diode in series with the cap because once it charges up, the diode will prevent its discharge for the next cycle.

A relay is designed for a certain current and voltage so that it will operate reliably under all conditions. If it would reliably operate with a lower current, then the manufacturer would have designed it that way. It's not to a manufacturer's advantage to overdesign a relay, since that increases it's cost. If you limit the startup current with a resistor you reduce the margin and it may not close reliably all the time, say for example, at a high temperature where the coil resistance is higher. That's why it's good practice to hit the relay with full voltage and current to turn it on. After that you can reduce the current to the holding value if you want to save power.
 
Last edited:
It's a hard sell because a series resistor has no effect on the collapsing field. It would have to be in parallel with the coil for that. The transistor still has to absorb the inductive voltage spike (although the spike has less energy since the coil current is less than rated). That's why a diode or resistor-capacitor is typically placed across a diode coil to absorb the inductive energy.
Wrong. Sorry, you are not visualizing what I explained (schematic would have been good). The resistor is in series with the coil. The diode is in parallel with the coil-resistor-in-series. See? The circulation current must go through the resistor on collapse and also the drive current goes through the resistor.
You can't place a diode in series with the cap because once it charges up, the diode will prevent its discharge for the next cycle.
Remember, I am not in favor of a capacitor and point out it doesn't help. I further point out you could be chasing your tail with more components like more diodes.

How do you put a diode on the collector to absorb the collapsing energy? You could use a zener to ground, but a 1N4148 will only help if it's placed across the relay coil. To see this, just trace where the current flow when the transistor turns off (the inductive current will keep trying to flow in the same direction).
See above. Anode on collector. Cathode on 5V. Collector also to coil through resistor but resistor could be on either coil lead. In fact, it might be better to use a SIP resistor with a common pin to 5V and individual resistor pins to each coil+, from a components count standpoint if you have multiple relays.

A relay is designed for a certain current and voltage so that it will operate reliably under all conditions. If it would reliably operate with a lower current, then the manufacturer would have designed it that way. It's not to a manufacturer's advantage to overdesign a relay, since that increases it's cost. If you limit the startup current with a resistor you reduce the margin and it may not close reliably all the time, say for example, at a high temperature where the coil resistance is higher. That's why it's good practice to hit the relay with full voltage and current to turn it on. After that you can reduce the current to the holding value if you want to save power.
It is a fairly universal characteristic of relays that they don't need as much power to stay closed as to close them in the first place.

See: http://pewa.panasonic.com/pcsd/product/pwr/pdf_cat/le.pdf

The amount of voltage to close is about 2/3 rated coil voltage and contacts don't drop out until much less than that. But there are many other things to consider: tolerance on power supply, temperature (diagram is only for one temperature), coil resistance tolerance is specified as +-10%.

I think your RC snubber is fine. A zener across the transistor is fine. All we need to do is keep the transistor Vce from breakingdown. Seems like I often have several relays and use a ULN2xxx to drive them. Back on the subject of that I hate to let the clamp diodes in there go to waste but I do not like how contacts arc when a simple parallel back-diode is applied .... thus this discussion.
 
Why did you quote me and then say "people have this backwards"? Are you saying I was wrong? Seems that your post agrees with me as did Ericgibbs nice simulation of the zener circuit I suggested (on page1).

I was well aware of the much faster release times using a zener+diode, and I thought that was very clear in my post. My comment was re the circuit blueroom asked about, which showed JUST ONE diode, the zener, and it was BACKWARDS.

Hi MrRB,

I think that was because i originally interpreted your first statement to
seem to contradict that a zener would be better. This was because if
you go back to your original post, it read like this:

Originally Posted by blueroomelectronics:
"Thanks Eric, wonder why a 5.1 Zener is used as a flyback?"

Originally Posted by Mr RB:
"Because they didn't know what they were doing."

It sounds at first that you are saying that a zener is not a good idea
and that they didnt know what they were doing because they used
a zener. Now that i read the bulk of your post over again and skip that
statement i see that you appear to agree that the zener is better.
Sorry about that...but if you didnt say, "they didnt know what they were
doing", i wouldnt have gotten misled like that :)

Apparently we all agree now that a zener is better, or a well chosen
resistor at least so that the voltage across the coil during discharge
is higher and that decreases the discharge time.
 
Last edited:
Yes.

"They didnt know what they were doing" referred to the fact they just used a zener, not the REQUIRED zener+diode, and they had the zener reverse connected too.

Thanks for clearing that up. :)
 
The 1N4148 has a 200ma version. Would this be enough for use as a flyback diode on a 5v 80ma relay? What is the general rule of thumb reguarding flyback diode ratings?

The analysis is really simple: If there is 80 ma flowing in the relay, the flyback current cannot be higher than that.
 
The analysis is really simple: If there is 80 ma flowing in the relay, the flyback current cannot be higher than that.

Sure it can. It only flows for 10s of msec each time the coil is switched off.
 
Sure it can. It only flows for 10s of msec each time the coil is switched off.
How can the diode current be greater than the relay coil current? All the diode does is continue to conduct the coil current when the switch shuts off. The coil inductance can generate a voltage spike but it can't generate a current spike.
 
Doesn't the current stay the same, the voltage can be very high and the power pulsed can be incredible, but the current itself can't be boosted?
 
Th voltage can't be high when the diode is forward biased. When it's reverse biased, it's equal to the supply voltage because the relay is energized.
 
No mneary, Dick said the current in reverse during switch off can't be higher than the current forward when it was on, which I don't think it can regardless of there being a protection diode or not, the voltage can go up to get that current to flow, but the current can't be higher than the forward current, unless I missed something. MikeMi said the current could go higher, which I don't think it can, the power can be much higher instantaneously but that's because of the voltage not current.

Unless I missed something?
 
Sure it can. It only flows for 10s of msec each time the coil is switched off.

To quote a recent president, "Let me be clear". What I was trying to say (but it came out wrong), is "Sure the 1n4148 can be used as a snubber for a relay that had 80mA flowing in it. A 4148 could even be used as a snubber for a relay that has more than 200mA flowing through it, because the current pulse only flows for a few 10s of msec.

The Repetitive peak forward current rating of even a lowly 1N4148 is 450 mA.
 
I think my note was too brief. I think we're saying the same thing.

When the solenoid is energized, the diode is reverse biased. The (reverse) voltage across the diode is equal to the supply voltage.

When the solenoid is de-energized, the diode is forward biased. The diode's (forward) current is equal to the current in the coil (Kirchoff).
 
Hi again,


Yes that's right. The peak current in the diode is equal (or very close) to the current
in the coil at the moment just before turn off.
There are diodes like that 1N4148 that have the same part number but different
ratings though. The surface mount part usually has a lower rating for example
so i'd be very careful about using a diode made more for small signal apps then
a diode like 1N4001 or in that family. A 1N4001 (or similar) will take a beating
for years and still live, plus it has thicker leads that hold up better mechanically.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top