How to properly use a relay? - Page 1
Forum section: electronics / beginners

author: Electabuzz
author_rank: Newbie
timestamp: August 02, 2020, 09:51:54 am
content: Hey, really new to the game for electronics, looking for help with a simple circuit with a relay.I need a relay to be operated by a rocker switch. The power going to both the coil and the output of the relay should come from the same 24V DC power source.My relay:https://www.te.com/usa-en/product-6-1419128-6.htmlMy switch:https://docs.rs-online.com/77e1/0900766b815875bb.pdfReading up on relays, it seems I might want a diode in my circuit in parallel with the relay coil? It’s use would be to discharge the coil when turned off, without causing voltage spikes/arcing/damage to the switch. Necessary, yes, no? How do I know the kind of diode I need and the rating that it should have?

author: Vovk_Z
author_rank: Super Contributor
timestamp: August 02, 2020, 10:12:18 am
content: Yes, at low switching speeds you need a diode.

author: Siwastaja
author_rank: Super Contributor
timestamp: August 02, 2020, 01:03:59 pm
content: Sadly but this is one of those more complex matters.As a rule of thumb, despite all Internet advice, you almost never want a diode; it may work, but if you don't analyse it, it's just a cheap-ass solution which either makes things better or worse depending on case.The original issue the diode is trying to solve is that once the switch controlling the relay coil goes open, the energy stored in the coil inductance needs to be released one way or the other. With no other components, a large voltage spike is released quickly, coupling into all nearby stray capacitances and whatnot. The relay opens quickly, but now the voltage spike may damage whatever is driving the coil; usually a transistor, but in your case, a smaller mechanical switch.Now, if you add a diode parallel to the relay coil, when you turn off the current supplying the relay, the stored energy continues circulating in the relay coil through that diode: the coil current slowly decays, until it runs out. No voltage spike generated (the diode limits the voltage the coil can generate to about 0.7V), but now the relay coil is releasing the contacts slowly, so nowthe relay contactsarc! You have just moved the problem elsewhere.The usual "good" solution to the problem is to use a transient voltage suppressor diode, or even a simply parallel resistor, or the diode with resistor in series. This allows you to limit the voltage spike to any arbitrary value of your choice, not necessarily 0.7V like with a simple diode. For example, if you use a transistor rated for 50V to drive the coil, you would want to limit the spike to, say, 25V for some margin. If you use a mechanical switch, you could limit the spike to, say, 100V.Now, this better spike limiter circuit not limiting the spike to 0.7V, but, say, 70V instead, it will be absorbing 100 times more energy (with the same coil current flowing through). The coil is discharged faster, and the relay lets go almost as quickly as it did without any protection components originally. Good for both the thing driving the relay coil, and the relay contacts as well!

author: TimFox
author_rank: Super Contributor
timestamp: August 02, 2020, 08:11:11 pm
content: How long does it take for the current in a normal small DC relay coil to fall below "dropout" current when discharging through an external diode, compared with the mechanical time it takes for the armature to open the contact?Since a bad experience 35 years ago with a small 24 V coil signal relay switching the input to an op amp, with the coil connected through a switch and the appropriate series resistor to the +/- 15 V rails (without diode), where I found that flipping the relay a few times (less than six, if I remember properly) would kill the op amp (dead), but adding an 1N914 across the coil gave years of contented operation, I have always followed the conventional wisdom on DC-coil relays and added the diode.

author: ejeffrey
author_rank: Super Contributor
timestamp: August 02, 2020, 08:28:02 pm
content: It depends on the coil. One easy comparison is that the ratio of operating voltage to diode Vf is roughly the ratio between closing and opening speed. So a 5 V relay coil will open faster with just a diode than an otherwise similar relay with a 24V coil.

author: TimFox
author_rank: Super Contributor
timestamp: August 02, 2020, 08:41:29 pm
content: Another question is proper protection and arc suppression on the contacts. My reading leads me to believe there is no good answer for AC. On DC, one can put a capacitor across the contacts to slow down the voltage increase after the contacts open, but on AC the capacitor conducts current when the contacts are open, which may be unsuitable for the application.

author: Zero999
author_rank: Super Contributor
timestamp: August 02, 2020, 10:06:55 pm
content: Quote from: Electabuzz on August 02, 2020, 09:51:54 amYou don't need a diode. The switch is rated to 3A and the relay coil takes just under 20mA, so the switch will be able to absorb the back-EMF created by the coil with no problem.

author: TimFox
author_rank: Super Contributor
timestamp: August 02, 2020, 10:13:32 pm
content: That circuit is essentially the same as the one I described above, except that I had a resistor in series with the switch and the coil. The back-emf still put enough garbage into the +/- 15 V rails to damage the IC on the same rails (but not the toggle switch) until I added the diode across the coil.

author: Zero999
author_rank: Super Contributor
timestamp: August 03, 2020, 04:20:54 pm
content: Quote from: TimFox on August 02, 2020, 10:13:32 pmHow much current did the coil take?Unless it was a huge relay, it seems odd that would kill an IC, by injecting crap into the power supply rail, assuming it was properly decoupled.

author: TimFox
author_rank: Super Contributor
timestamp: August 03, 2020, 04:33:02 pm
content: This was 35 years ago: it was an open-armature, ceramic-insulated, signal relay with a 24 V DC coil. There was the usual collection of decoupling capacitors on the +/-15 V rails. I would guess that the coil current was 10 mA (based on modern relays, which are rarely open-armature), so I probably had 820 ohms in series with the miniature toggle switch. The circuit was a low-current ammeter with lowest full-scale maybe 10-8A (feedback by Victoreen glass-encased resistors on a ceramic rotary switch).I also thought it odd, but after replacing the Intersil 8007 op amp (of fond memory) a few times (luckily, it was in a socket), I added the diode and the rest is history. Since the circuit was floating (inside a floating enclosure), there was serious protection (spark gap and appropriate diodes) between the inverting input and circuit common (connected to the enclosure). The relay was used to short the input, so that the offset voltage and bias current (through another Victoreen resistor) could be nulled separately.The OP was concerned about protecting the switch, but sometimes other things need protection from inductive kicks. Your concern is about relay contact arcing. Of course, there was no concern in my circuit about relay contact arcing in a very high impedance node.

author: tooki
author_rank: Super Contributor
timestamp: August 03, 2020, 05:28:43 pm
content: Quote from: TimFox on August 02, 2020, 08:41:29 pmI thought that AC is farlessdemanding of contacts, since the arc self-extinguishes twice per cycle when it crosses the zero point.

author: TimFox
author_rank: Super Contributor
timestamp: August 03, 2020, 05:45:37 pm
content: Yes, but the circuit requirements are different for AC and DC.

author: bdunham7
author_rank: Super Contributor
timestamp: August 03, 2020, 06:00:25 pm
content: Quote from: Siwastaja on August 02, 2020, 01:03:59 pmThat's going to be highly dependent on the relay design specifics. The relay will not even start to move until the current drops below the hold-in threshold, and on a typical design, as soon as any gap opens up between the coil armature and the contact lever, the magnetic force will drop quite quickly. I'm not saying what you propose, or have seen, doesn't or can't happen, butdelayingthe release of the relay is not the same thing asslowingthe rate of the release. For high-power applications or those where relay life is paramount, I suppose some testing of this is in order.Have you had an application where relay life was shortened by a diode clamp? A lot of automotive applications (the only ones I have much experience with) have the diode built into the relay.

author: TimFox
author_rank: Super Contributor
timestamp: August 03, 2020, 06:50:10 pm
content: Not directly related to the original question, but involving coil diodes.Many DIP reed relays include a diode across the coil, but the DPST versions often have a pinout that can work when the part is inserted backwards (rotated 180 deg), except for the direction of the diode.I was repairing an -hp- 8013B pulse generator that had erratic output levels. The generator has two switched current sources (one positive and one negative) with independent amplitude controls, and a single switch to insert a 50 ohm internal load on both outputs. I bought a replacement DPST reed relay, and found that the original had been installed backwards, giving erratic operation when the coil was energized. There was no sign of previous work to the PCB, so it must have slipped past factory QA, or that the original was supposed to be the version without relay.

author: David Hess
author_rank: Super Contributor
timestamp: August 03, 2020, 09:00:41 pm
content: The diode needs a current rating better than the current through the coil and a voltage rating greater than the supply voltage, which in practice are trivial requirements. For small signal relays, it is common to use a switching diode like a 1N4148. Larger relays might use a 1N4001 series diode.As a practical matter, the slowing of turn-off is almost never a consideration but Siwastaja pointed out alternative networks which allow the flyback voltage to be higher discharging the magnetic field more quickly.Quote from: TimFox on August 02, 2020, 08:41:29 pmThere is no good answer for AC because the network causes leakage which may be undesirable where safety is required. This comes up on SSRs and thyristor switches as well where it just has to be lived with.The snubber somewhat depends on how much energy the typically inductive load returns but the typically worst case is pretty consistent for a given voltage and current. Look at old application notes for the requirements and calculations.

author: TimFox
author_rank: Super Contributor
timestamp: August 03, 2020, 09:51:26 pm
content: When portable voltmeters changed from Simpson 260s to DMMs, many were confused because the switch or relay controlling the outlet or whatever had a capacitor across the contacts, which then showed almost full voltage into a 10 megohm load. Some DMMs now have a low-Z mode for that reason. 0.1 uF from 120 V, 60 Hz gives almost 120 V into a 10 megohm load.

author: Zero999
author_rank: Super Contributor
timestamp: August 03, 2020, 10:14:27 pm
content: How about a capacitive snubber, rather than a diode? A capacitor, say 1µF and a 1k resistor in series, in parallel with either the relay or switch will help.

author: TimFox
author_rank: Super Contributor
timestamp: August 03, 2020, 10:28:42 pm
content: For a DC relay, I prefer the diode across the coil. Series R-C can be used to snub an AC coil or DC contacts. AC contacts are the messy case.

author: bdunham7
author_rank: Super Contributor
timestamp: August 03, 2020, 11:00:31 pm
content: Quote from: TimFox on August 03, 2020, 10:28:42 pmFor severe spikes from inductive loads, gas discharge tubes do the trick. High discharge voltage, but no leakage when off.

author: Siwastaja
author_rank: Super Contributor
timestamp: August 04, 2020, 06:28:15 am
content: Quote from: bdunham7 on August 03, 2020, 06:00:25 pmReally, do some homework; this is areallywidely discussed and well known matter!The laziness of "just putting the diode there because it has always worked for me" then requiring evidence for suggesting otherwise while you can find a lot of literature from this is just, well, lazy. Do note I said it's a complex matter where the diode may or may not work, not that it never works. It is a very typical solution; and also a typical design failure. I'm not going to write a book about it for you in a forum post, I already provided far more than the minimum amount of information so you can research for more details including when this does matter and when this does not matter.Even for a beginner, it's good to know that issues may arise with the diode. Knowledge of something being more complex than it first appears, even if ignoring that issue for time being, prevents surprises like working decades with such circuits, then hear from a younger engineer about the problem for the first time, being unable to believe it exists.A lot of automotive relays use simple parallel resistor, you can usually order them without coil suppressors, a diode, or a resistor. A simple resistor is fine when the extra power dissipation is not a problem, and it's a cheap single-component solution.And yes, I have personally seen burned contacts where diodes have been used to suppress the coil. I can'tprovethey would have last longer with better coil snubbing, but I don't have to, it's a phenomenon which has been widely discussed and researched.Quote from: David Hess on August 03, 2020, 09:00:41 pmIt's "almost never" a consideration because of laziness, trusting the luck factor, and doing what everybody "just does". Unsurprisingly, engineers have deadlines to meet as well and as a result, products do fail. Relay contact arcing and either increased contact resistance, or welding permanently-on, are quite common failure modes. The reasons are, substandard relay quality, choosing an improper relay for the load, failure to snub the contacts, or failure to snub the coil. Likely, in some % of the cases, the reason is the last one with the lazy choice of using a diode.Yet, once you accept that other solutions than the diode exist (i.e., letting go of the confirmation bias), you start seeing those solutions being actually used.Quick Google result of a typical appnote discussing this showing actual circuit measurement results:https://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=13C3264_AppNote&DocType=CS&DocLang=EN

author: Zero999
author_rank: Super Contributor
timestamp: August 04, 2020, 09:39:07 am
content: Yes it's true a diode shortens relay contact life. How much, depends on what it's switching and the relay. If it is always a really bad idea, then you wouldn't be able to buy a relay with a built-in diode, as in the example linked below:https://www.digikey.com/product-detail/en/te-connectivity-potter-brumfield-relays/1432790-1/PB682-ND/807759https://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=1432790-1&DocType=Customer+Drawing&DocLang=EnglishNote that the release time is 13ms, is only a little longer than the operate time of 10ms. Hardly a big deal.Another alternative to a flyback diode or RC network, is a zener diode connected across the switch.

author: Unixon
author_rank: Frequent Contributor
timestamp: August 04, 2020, 10:33:09 am
content: Quote from: Electabuzz on August 02, 2020, 09:51:54 amThen you don't have to worry about mostly anything. At this low operating current even a diode or a TVS is not really necessary, but you may fit them in just for confidence.If a relay would be operated by a complex and sensitive circuit like say MCU-based, then you wold have to worry about many things.Coil release voltage spike suppression: a diode + a resistor + a zener diode in reverse to first diode + TVS on the power rail.Arc noise suppression coupled into coil circuit: LC filter on the power rail before relay power bus + same on control lines.However it is better to prevent arcing than suppressing the noise it may produce, suppressing already coupled noise makes circuits ugly.General interference avoidance: separating current paths, providing stable power for control logic (e.g. powering it through a Schottky diode or ideal diode circuit and a big capacitor so that no current spikes on an upper level power bus would affect normal operation).

author: redgear
author_rank: Frequent Contributor
timestamp: August 04, 2020, 12:46:40 pm
content: I use a relay to drive a inductive load consuming 7.5A on or off. I have a diode - S1M. Should I be worried about shortening the life of the relay?What else do I replace it with? A TVS?Thanks

author: TimFox
author_rank: Super Contributor
timestamp: August 04, 2020, 02:57:59 pm
content: I don't consider my recommendation to use a diode across a DC relay coil to be lazy.There are two questions: protecting the driving circuit (from back emf) and protecting the relay contacts (against arcing).Driver: if driven by a transistor, this is obvious since the voltage kickback is dangerous to the source. In the case of a toggle switch, which is not likely to be damaged, the diode does not hurt and (as I learned the hard way) there may be other surprising damage on the driving side.Contacts: relying on detailed timing of the mechanical action does not seem to be a reliable way to prevent arc damage. Over time, with changes in spring temper and friction, this will change. When contact arcing is a potential problem, it should be attacked with arc suppression circuitry at the contacts or load (especially inductive loads). Since I claim no expertise in this problem, I turned to the literature and application notes when switching power. One example:https://www.ia.omron.com/support/faq/answer/36/faq02804/. The reason I said that there is no good answer is that there is no best circuit for all applications.

author: Electabuzz
author_rank: Newbie
timestamp: August 04, 2020, 08:04:34 pm
content: Thanks for all the replies! I left out that my 24V circuit isDC. But most of you already figured that.Reading through all of your replies I'm getting a bit confused by the different proposed solutions and discussion that arised around themFrom what I gather, I'm hearing two options to consider: a parallel resistor or a TVS-diode.Quote from: SiwastajaThe TVS-diode seems the made for purpose option: "used to protect electronics from voltage spikes induced on connected wires". However, as a complete newbie, it seems quite a complicated solution with different types, behaviour and combination of parameters to figure out.Quote from: Siwastaja on August 04, 2020, 06:28:15 amIf just a parallel resistor is reliable enough for automotive applications - and a simple and cheap solution - that seems a logical way to go! What do I base the value of the resistor on though, the resistence of the coil?Quote from: redgear on August 04, 2020, 12:46:40 pmPS: Hi, although your question is kinda related to mine, I'd figure it's offtopic/specific enough to warrant it's own topic

author: Zero999
author_rank: Super Contributor
timestamp: August 04, 2020, 10:18:47 pm
content: Quote from: redgear on August 04, 2020, 12:46:40 pmWhat voltage? DC/AC? Note that relay is not rated for mains voltages!How inductive?Stupid question: why not use a larger switch, which can directly switch the load?

author: bdunham7
author_rank: Super Contributor
timestamp: August 05, 2020, 04:50:04 am
content: Quote from: Siwastaja on August 04, 2020, 06:28:15 am"Google it" doesn't cut it in an internet debate. I could claim just the opposite and tell you the same. Anyway, I did spend 15 seconds doing that and the only relevant thing I found was the same TE paper you linked to. Perhaps 'widely' is a reach? And that, quite frankly, falls a bit short of convincing me that what you describe is any more than a corner case or a poor relay design. The real issue is that they didn't mention or show the timing of the actual contact break.QuoteI'm not lazy nor unwilling to learn. And I really was just asking you a question. However, I have seen many examples where someone, sometimes a bright young'un, discovers some phenomenon in a corner case then endlessly analyzes and overapplies it to inappropriate situations, imagining that they have discovered some universal truth that will save the world.So, having finally fixed an old Tek scope that has been haunting me for months, I had some spare time and I thought an experiment was in order. I grabbed a 24VDC 600R (approx) coil control relay, a large-ish power transformer and some resistors and a diode and set up a quick and dirty test rig. I ran the coil from a bench power supply in series with a snap switch and a 10R resistor to measure the current. On the contact side, I put a 0R33 resistor, the primary of the transformer as a load inductor and a 500mA CC bench supply. I connected a diode and a 1K8 resistor to one side of the coil so I could selectively snub the coil with either or neither using a jumper. Then I connected a scope across the 10R and 0R33 resistors. I did this quickly and sloppily with whatever I had and I left peak detect on by accident, so all you get is some pictures and you have to ignore the hash due to common-mode noise and peak detect.First up we have the coil alone, no snubbing.Then we have the coil snubbed by the 1K8 resistor.Finally, snubbed by the diode.As you can see, the inductive load I set up generates a significant spike (of completely unknown scale...this experiment could certainly be done better) but while the contact open event is delayed with each step of snubbing, the event itself looks identical--which, IMO is exactly as it should be in a properly designed relay. This is what I was referring to earlier. The idea that the increase in current right before the opening is caused by reversal of the armature seems far fetched. It seems obvious to me, unless you have information otherwise, that this is due to the increase in reluctance due to the armature separating from the pole, at which point there is an exponential loss in pull in force as it is accelerated away from the pole. The flexible contacts have a little give and they open shortly afterwards. In fact, if the slope of that curve is related to the speed of the armature, it might actually be a little faster in the last example with the diode. The actual results were a bit noisier and more random than this, so I'm not making that argument just yet.Now this is just one example. However, it fits with my notion of how a relay should work. There are probably many more nuances, and perhaps the second small surge in the TE paper represents some mechanical vibration of the armature or whatever, but a relay that doesn't release crisply isn't designed well. If the relay needs to be non-snubbed or snubbed a particular way to release cleanly, then that should be stated. It shouldn't be revolutionary inside information or a 'trap for young players' or whatever so-called trade secrets are. This particular relay, rated at 24VDC, had a pull-in voltage of about 18 volts and a hold-in voltage of 6.6 volts. I forgot to test it using a very slow drop to see what the release event would look like in the most extreme possible case--low voltage drop-out. I'd bet money it was as clean as the rest.

author: redgear
author_rank: Frequent Contributor
timestamp: August 05, 2020, 10:55:55 am
content: Quote from: Zero999 on August 04, 2020, 10:18:47 pm5v relay driving a load connected to the mains.QuoteCrest factor - 1.86, Power factor - 0.6Can't use a switch, has to be controlled from a microcontroller.

author: Zero999
author_rank: Super Contributor
timestamp: August 05, 2020, 11:10:28 am
content: Quote from: redgear on August 05, 2020, 10:55:55 amSorry, I was wrong about that relay being unsuitable for mains. It's fine for 10A 250V.https://www.te.com/commerce/DocumentDelivery/DDEController?Action=showdoc&DocId=Data+Sheet%7FOJ_OJE_series_relay_data_sheet_E%7F0318%7Fpdf%7FEnglish%7FENG_DS_OJ_OJE_series_relay_data_sheet_E_0318.pdf%7F6-1419128-6What load is it? Crest factor normally applies to things such as power supplies, which are capacitive, but you said inductive.

author: redgear
author_rank: Frequent Contributor
timestamp: August 05, 2020, 11:16:33 am
content: Quote from: Zero999 on August 05, 2020, 11:10:28 amIt is a electronic ballast and I haven't selected a relay yet. There will be three ballasts that will driven by a single relay. Each ballasts powers a lamp that consumes 0.33A(nom). I am not sure about the value of inrush current, the lamps datasheet does not specify it.Here are the two relays I am look at right now:T9GV1L14-05RZ03-1A4Will be great if you can help me choose.

author: Zero999
author_rank: Super Contributor
timestamp: August 06, 2020, 10:41:06 pm
content: Quote from: redgear on August 05, 2020, 11:16:33 amPresumably you thought it would be inductive because it's a ballast. Yes, in the only magnetic ballasts were inductive, but the modern electronic ones aren't. Either of those relays will do, although the first one is a little overkill.

author: redgear
author_rank: Frequent Contributor
timestamp: August 07, 2020, 05:14:17 am
content: Quote from: Zero999 on August 06, 2020, 10:41:06 pmThank You!

author: Electabuzz
author_rank: Newbie
timestamp: August 09, 2020, 08:29:05 pm
content: After searching more about it, I ran into this Panasonic-datasheet:https://www.panasonic-electric-works.com/pew/eu/downloads/ds_61202_en_cb_pd2014.pdfOn the last page it reads:QuoteThe solution to use seems pretty generic advice, where the simple resistor seems a fine solution. Cheap and simple. For this Panasonic relay the worst case scenario would be a resistor dissipating 0.2W of heat, so that's negligible.Just have to figure out the proper resistance value for use with my relay. Probably very similar.

author: Electabuzz
author_rank: Newbie
timestamp: August 09, 2020, 08:38:53 pm
content: Also, if I understand correctly: the lower the resistance value, the better the circuit is protected from spikes (but obviously results in more heat dissipation)

author: bdunham7
author_rank: Super Contributor
timestamp: August 09, 2020, 09:25:47 pm
content: Quote from: Electabuzz on August 09, 2020, 08:38:53 pmIf the relay does have compromised release characteristics with a slower current decay, then damping the surge with a low resistance is going to be just as bad as using a diode or lower voltage zener, as the case may be. Stopping the current quickly demands a spike, no matter how you do it.

author: Zero999
author_rank: Super Contributor
timestamp: August 10, 2020, 09:47:13 am
content: Quote from: bdunham7 on August 09, 2020, 09:25:47 pmA zener or resistor is better than a diode. Consider a 12V relay, with a diode with a voltage drop of 0.6V, vs a zener diode with a voltage drop of 15V. Do the sums and you'll find the current decays considerably faster with the zener, than the diode.

author: Ground_Loop
author_rank: Frequent Contributor
timestamp: August 10, 2020, 01:00:05 pm
content: No need to over think this. Just use a diode. It’s a proven and intuitive solution.