Page 1 of 1

How to trigger relay?

Posted: Sun May 21, 2006 11:25 am
by divzr0
Hey guys, I have been working with microcontrollers and basic stamps lately trying to figure out how to trigger a relay. The problem obviously is that the microcontroller can only supply so much current, where as the relay needs ~70 mA.

Now I guess I need a power transistor. I have never worked with any before and I don't even know how to select one, this is where I could use some help. I'm trying to have the micrcontoller control the relay to switch 12V battery.

Can anyone provide a simple explanation or maybe point to an aritcle in NV they read about this? I have many of the issues.

Thanks for any help.

Posted: Sun May 21, 2006 12:00 pm
by Clyde Crashkop
This is part of a quote from Philba that helped me a lot. “Look at logic MOSFETs. The IRL5x0 series can be driven directly from cmos logic. For example, the IRL520 is spec'd to 10A at 100V and costs less than $1. They cost a little more than the IRF series but are very easy to use.â€

Posted: Sun May 21, 2006 4:29 pm
by jimandy
Clyde's suggestion is good. I'm not sure he was suggesting this, but you might use the MOSFET to directly switch the 12V and eliminate the relay altogether, depending upon your application. The latest N&V (May issue) has some good stuff about MOSFETs in the Q&A section.

Posted: Sun May 21, 2006 8:26 pm
by zotdoc
Look up the uln2803 chip. It has 8 inputs and eight outputs which are capable of converting a logic signal to up to 500ma,enough to trigger most relays.

Re: How to trigger relay?

Posted: Sun May 21, 2006 9:28 pm
by philba
divzr0 wrote:Hey guys, I have been working with microcontrollers and basic stamps lately trying to figure out how to trigger a relay. The problem obviously is that the microcontroller can only supply so much current, where as the relay needs ~70 mA.

Now I guess I need a power transistor. I have never worked with any before and I don't even know how to select one, this is where I could use some help. I'm trying to have the micrcontoller control the relay to switch 12V battery.

Can anyone provide a simple explanation or maybe point to an aritcle in NV they read about this? I have many of the issues.

Thanks for any help.
the suggestions for mosfets will work but, for a lot less money, I would use a simple NPN transistor as a low side driver. I usually use 2n3904s but that's because I bought 100 of them a while ago. note that using a mosfet to directly control 12V will work but you don't get isolation. A relay is a cheap(ish) form of isolation.

Image

R1 should be in the 1K-2K range. R2 can be large-ish (10K and up). D1 is just about any silicon diode. Q1 can be just about any NPN transistor (2n2222, 2n3904, and so on). This will work for just about any electromagnetic relay. cost new? about 1/10th the FET. Any marginally stocked junk-box should have the parts....

The theory of how you go about selecting the transistor and R1 are pretty interesting but perhaps for another day...

edit: V+ can be anything upwards of the max rating of the transistor. for 12V, no sweat...

Posted: Thu May 25, 2006 12:20 am
by Enzo
Exactly. My favorite general purpose small transistor is the MPSA06. 80v, 500ma, what's not to love? They cost about 5 cents from someplace like Jameco. (you have to buy 10 at that price though) I buy them by the hundred.

And if the circuit doesn't have enough drive for the transistor, a darlington like MPSA13 will work, and those are under a dime as well.

Posted: Thu May 25, 2006 8:32 am
by philba
All the drive that circuit needs is about 3 mA. I use an Hfe of 30 (which is way low for most situations) so 3 mA Ib means 90 mA Ic (in rough numbers).

On the digital logic side, any microcontroller will be able to deliver that much current and for general logic I suggest people use 74HC stuff since it's capable of plenty of current.

Posted: Wed May 31, 2006 10:55 am
by Tommy volts
Philba,

Does the diode across the relay prevent arcing on the relay contacts and any problems associated with that?

Posted: Wed May 31, 2006 11:45 am
by copperclad
hi
D1 is to deal with the voltage spike from the coil when its field collapses , dana :smile:

Posted: Wed May 31, 2006 5:04 pm
by Robert Reed
Tommy,Div
Snubbing circuits are used across the contacts for arc reduction, but the values are determined by the type of load. These calculations can be a science in itself. For low current resistive loads, you wont need anything. BTW what is your load and what level of current will you be breaking?

Posted: Thu Jun 01, 2006 12:34 pm
by philba
Tommy volts wrote:Philba,

Does the diode across the relay prevent arcing on the relay contacts and any problems associated with that?
while the question has been answered, I want to point out that pretty much nothing you can do at the coil will affect the contacts. I suppose if you powered the coil at the Must Operate voltge, you might get a slow closure and a bit more arc'ing but that's pretty willfully disregarding reasonable practices.