Author Topic: Switching 12V relay via 5V, is there a better way?  (Read 7590 times)

0 Members and 1 Guest are viewing this topic.

Offline ratioTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Switching 12V relay via 5V, is there a better way?
« on: February 18, 2017, 04:58:54 pm »
Right now, I'm using an Omron G3VM-351B MOS FET relay to switch 12V at 120-150 mA to control an automotive style 5 pin relay, from a 5V ATMEGA I/O pin. It's working fine, but what other ways could I have done it? Transistor, FET, something I don't know about yet? Can anyone give me just a few part numbers to look up, maybe ordered from 'the-way-I'd-do-it' to 'this-will-technically-work-but-it-has-issues'.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19546
  • Country: gb
  • 0999
Re: Switching 12V relay via 5V, is there a better way?
« Reply #1 on: February 18, 2017, 06:52:31 pm »
Right now, I'm using an Omron G3VM-351B MOS FET relay to switch 12V at 120-150 mA to control an automotive style 5 pin relay, from a 5V ATMEGA I/O pin. It's working fine, but what other ways could I have done it? Transistor, FET, something I don't know about yet? Can anyone give me just a few part numbers to look up, maybe ordered from 'the-way-I'd-do-it' to 'this-will-technically-work-but-it-has-issues'.


http://zappbots.altervista.org/forum/viewtopic.php?t=16
 

Offline fki82

  • Contributor
  • Posts: 34
  • Country: de
Re: Switching 12V relay via 5V, is there a better way?
« Reply #2 on: February 18, 2017, 07:44:27 pm »
ULN2003A would be a way to do the above circuit for several channels with only one part.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5889
  • Country: de
Re: Switching 12V relay via 5V, is there a better way?
« Reply #3 on: February 18, 2017, 10:16:16 pm »
Not knowing whether the relay is connected to plus or ground, you can draw all the schematics you like.
I expect a bit more information from the OP before "doing the CAD thing".

 

Offline Codebird

  • Regular Contributor
  • *
  • Posts: 161
  • Country: gb
Re: Switching 12V relay via 5V, is there a better way?
« Reply #4 on: February 18, 2017, 10:49:54 pm »
There is a better way, but only marginally better. You can replace that BJT with a small FET. That means you can eliminate the base resistor. Component count reduced by one, and you save a few miliamps of current too. Personally I use the BS170, but that's only because I happened to buy a big bag of them years ago and still haven't run out - there are a lot of generic N-channel MOSFETs that could do it.

But that's it. At that point you're using one component and current in microamps, so it's hard to see improvement.

I suppose you might be able to manage without the diode, but you'd need to run a lot of simulations first to be quite sure that doing so would be safe.
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12300
  • Country: au
Re: Switching 12V relay via 5V, is there a better way?
« Reply #5 on: February 19, 2017, 12:00:06 am »
I suppose you might be able to manage without the diode ....

Don't.

Keep the diode.

Without it, you're playing a statistical game of "dodge the bullet".
 

Offline ratioTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Re: Switching 12V relay via 5V, is there a better way?
« Reply #6 on: February 19, 2017, 12:24:47 am »
OP here. The schematic isn't mine, it came from a website (suggested by @Hero999, that I am in the middle of checking out--thanks!). As for more details, at this time I'm working specifically on controlling an automotive-style relay, powered via a 5AH SLA battery. The relay needs to switch 12 volts to a model rocket igniter, something less than 50A for a few milliseconds worst case, 10-20A common case. I think that a purely silicon solution to that would be significantly more $$$ than a relay, which has the added benefit of being easily replaceable from an automotive parts store. I will be enforcing an on time of 500mS, and I can push the off time to as long as 5 minuets before I'd start to worry about complaints, so I don't think I'm in much danger of over-using the relay. There are several manual disconnect points in the high-current path, so even welded contacts shouldn't be significantly hazardous. Loop resistance should prevent even a dead short at the business end from becoming dangerous before appropriate action can be taken. On the control side, I'm using the Omron part as shown in https://components.omron.com/components/web/pdflib.nsf/0/9CF10857780906DE85257201007DD5A0/$file/G3VM_351B_E_1210.pdf, second page, connection C. I'm testing with straight 5V from the breadboard PS, with the resistor sized for 5mA. Under those conditions, the MOS FET is fully on I believe. I had an issue when I limited the current to 1mA, I think the device wasn't fully on, and allowed the resistance to creep up until the relay dropped out. This was exacerbated by the resistance of the relay itself going up as it warmed up!
« Last Edit: February 19, 2017, 12:36:29 am by ratio »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19546
  • Country: gb
  • 0999
Re: Switching 12V relay via 5V, is there a better way?
« Reply #7 on: February 19, 2017, 12:49:36 am »
There's no need to use a small solid state relay (what you have there) to control an automotive relay. It didn't work very well because the solid state relay you used isn't quite rated to a high enough current and the LED forward current was too low. The datasheet recommends an IF of 10mA and it might not trigger at all below 3mA.


The circuit I suggested previously will work. I didn't draw it but found it using Google. If you want to use a MOSFET and eliminate the base resistor, then fine but don't omit the back-EMF diode which is required to protect the transistor from the high voltage pulse generated when the relay is turned off.
 
The following users thanked this post: ratio

Offline ratioTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Re: Switching 12V relay via 5V, is there a better way?
« Reply #8 on: February 19, 2017, 01:12:31 am »
Thanks, I'll check that out closer.
I knew that the SSR was a little overboard for what I wanted to do, but I also know what'll happen if I wait until I find Just The Right Solution... ;)
 

Offline Codebird

  • Regular Contributor
  • *
  • Posts: 161
  • Country: gb
Re: Switching 12V relay via 5V, is there a better way?
« Reply #9 on: February 19, 2017, 01:31:44 am »
You might be able to eliminate the relay entirely. If it's just a rocket igniter, you can do it using a power MOSFET. There are even some that can be driven off 5V logic directly.
 

Offline ratioTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Re: Switching 12V relay via 5V, is there a better way?
« Reply #10 on: February 19, 2017, 02:34:23 am »
I think I need to stay with the relay, as I'm using the NC terminal to sense the resistance of the ignitor to prove we're ready to fire. Maybe I could do it with two devices, one fed through an inverting buffer? What kind of timing issues could I expect with that setup? The sense circuit would have to be off before the power circuit fired, or I'd put 12V into an analog input pin, & probably through the current source for the sense circuit as well. Two identical FETs, one fed through an inverting buffer, one fed through two inverting buffers, one to match the first device, the second for a touch more delay? Or am I making it more complicated than it needs to be?
 

Offline Gregg

  • Super Contributor
  • ***
  • Posts: 1128
  • Country: us
Re: Switching 12V relay via 5V, is there a better way?
« Reply #11 on: February 19, 2017, 04:22:45 am »
I would suggest using one of the readily available optocoupled relay boards readily available on eBay from Hong Kong (buying form Hong Kong is much faster than mainland China).  Search eBay for “Optocouple relay H/L 12v. The H / L signifies high or low trigger.
Here is an example: www.ebay.com/itm/361368219371?_trksid=p2055119.m1438.l2649&var=630711214512
These come in 10 amp and 30 amp rated relays which means about half that in the real world.  Buy the 12 volt model and change out the SMD resistor in the control circuit to one compatible with your 5V source.  The high / low trigger ones can easily break out the relay coil circuit from the input to the optocoupler (two LEDs back to back so either polarity will operate the relay).  With the trigger totally isolated from the coil, you won’t have any inductive spike problems feeding back to the controller and the current draw on the 5V signal is only that of a single LED.  Plus they are dirt cheap and if you want greater reliability you can put two in parallel for redundancy.  They are on a nice little board that is easy to mount.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19546
  • Country: gb
  • 0999
Re: Switching 12V relay via 5V, is there a better way?
« Reply #12 on: February 20, 2017, 09:48:08 am »
I would suggest using one of the readily available optocoupled relay boards readily available on eBay from Hong Kong (buying form Hong Kong is much faster than mainland China).  Search eBay for “Optocouple relay H/L 12v. The H / L signifies high or low trigger.
Here is an example: www.ebay.com/itm/361368219371?_trksid=p2055119.m1438.l2649&var=630711214512
These come in 10 amp and 30 amp rated relays which means about half that in the real world.  Buy the 12 volt model and change out the SMD resistor in the control circuit to one compatible with your 5V source.  The high / low trigger ones can easily break out the relay coil circuit from the input to the optocoupler (two LEDs back to back so either polarity will operate the relay).  With the trigger totally isolated from the coil, you won’t have any inductive spike problems feeding back to the controller and the current draw on the 5V signal is only that of a single LED.  Plus they are dirt cheap and if you want greater reliability you can put two in parallel for redundancy.  They are on a nice little board that is easy to mount.
That seems like a sensible solution but you need to ensure it really can handle the current at DC, not just AC.

Still seems crazy that they're using an opto-coupler to drive the relay, when a single transistor would do the job.
 

Offline ratioTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Re: Switching 12V relay via 5V, is there a better way?
« Reply #13 on: February 20, 2017, 03:29:43 pm »
Still seems crazy that they're using an opto-coupler to drive the relay, when a single transistor would do the job.

It is crazy, hence the question. I ended up with the opto-coupler when I was looking for an SSR to switch the 12V directly. The parts I looked at to switch the 12V directly cost a lot more (especially with a form C contact), so I thought about a big relay and a little SSR.

I looked at the Arduino modules, but I figured I could do the same myself and learn even more, so I went back to the opto-isolator and a relay. The Darlington array mentioned earlier will work for on switching a few lights (450mA ea, so parallel a pair), leaving one free for a 150mA sounder. A 2N7000 should switch the relay just fine I think. Sound more reasonable?

Don't be afraid to say "That's stoopid!!". I don't know what's a bad idea or not yet, so I won't be offended. In fact, the faster I learn it the better I like it.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19546
  • Country: gb
  • 0999
Re: Switching 12V relay via 5V, is there a better way?
« Reply #14 on: February 20, 2017, 03:52:05 pm »
The 2N7000 might not be able to pass the full 150mA with a gate-source voltage of 5V.

How about using the ULN2803A, which has eight channels?
http://www.ti.com/lit/ds/symlink/uln2803a.pdf
 

Offline ratioTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Re: Switching 12V relay via 5V, is there a better way?
« Reply #15 on: February 20, 2017, 04:05:34 pm »
The 2N7000 might not be able to pass the full 150mA with a gate-source voltage of 5V.

How about using the ULN2803A, which has eight channels?
http://www.ti.com/lit/ds/symlink/uln2803a.pdf

How does that compare to the ULN2003? (http://www.ti.com/lit/ds/symlink/uln2003a.pdf) One addn'l channel and only SOIC? I'm still reading, but that's the only thing I've noticed so far.

[edit]Hmmm. TI doesn't offer a through-hole version, but Toshiba does. (https://cdn-shop.adafruit.com/datasheets/ULN2803A.pdf) Looks like it might be an older part, nearing obsolescence? That probably doesn't matter much to me, this isn't a production device that I'm gonna be making for the next decade or so. eBay's got lots of them.
« Last Edit: February 20, 2017, 05:08:31 pm by ratio »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19546
  • Country: gb
  • 0999
Re: Switching 12V relay via 5V, is there a better way?
« Reply #16 on: February 20, 2017, 08:49:34 pm »
Oh I didn't realise TI no longer make the through  hole version.

There's also the MIC2981 & MIC2982 which are switch the positive, rather than negative rail, which can be handy sometimes.
http://www.mouser.com/ds/2/268/mic2981-778755.pdf
 

Offline ratioTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Re: Switching 12V relay via 5V, is there a better way?
« Reply #17 on: February 20, 2017, 10:12:35 pm »
Oh I didn't realise TI no longer make the through  hole version.

It's strange, they didn't list it as obsolete, yet showed PDIP in the package information. In any case, I've got a little handful coming from China. We'll see how they work.

There's also the MIC2981 & MIC2982 which are switch the positive, rather than negative rail, which can be handy sometimes.
http://www.mouser.com/ds/2/268/mic2981-778755.pdf

Thanks for this, I'll remember it. I think I'll be ok switching the low side, this part will be protected by a polyfuse.

 

Offline Farley

  • Regular Contributor
  • *
  • Posts: 88
  • Country: us
Re: Switching 12V relay via 5V, is there a better way?
« Reply #18 on: February 21, 2017, 12:35:45 am »
ST apparently still makes the PDIP version of the ULN2803A. Mouser shows over 13k in stock.
http://www.mouser.com/ProductDetail/STMicroelectronics/ULN2803A/?qs=sGAEpiMZZMvAvBNgSS9LqpP7ived4CP2
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf