Switching 12V relay via 5V, is there a better way? - Page 1
Forum section: electronics / beginners

author: ratio
author_rank: Regular Contributor
timestamp: February 18, 2017, 04:58:54 pm
content: 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'.

author: Zero999
author_rank: Super Contributor
timestamp: February 18, 2017, 06:52:31 pm
content: Quote from: ratio on February 18, 2017, 04:58:54 pmhttp://zappbots.altervista.org/forum/viewtopic.php?t=16

author: fki82
author_rank: Contributor
timestamp: February 18, 2017, 07:44:27 pm
content: ULN2003A would be a way to do the above circuit for several channels with only one part.

author: Benta
author_rank: Super Contributor
timestamp: February 18, 2017, 10:16:16 pm
content: 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".

author: Codebird
author_rank: Regular Contributor
timestamp: February 18, 2017, 10:49:54 pm
content: 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.

author: Brumby
author_rank: Unknown
timestamp: February 19, 2017, 12:00:06 am
content: Quote from: Codebird on February 18, 2017, 10:49:54 pmDon't.Keep the diode.Without it, you're playing a statistical game of "dodge the bullet".

author: ratio
author_rank: Regular Contributor
timestamp: February 19, 2017, 12:24:47 am
content: 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 inhttps://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!

author: Zero999
author_rank: Super Contributor
timestamp: February 19, 2017, 12:49:36 am
content: 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 IFof 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.

author: ratio
author_rank: Regular Contributor
timestamp: February 19, 2017, 01:12:31 am
content: 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...

author: Codebird
author_rank: Regular Contributor
timestamp: February 19, 2017, 01:31:44 am
content: 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.

author: ratio
author_rank: Regular Contributor
timestamp: February 19, 2017, 02:34:23 am
content: 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?

author: Gregg
author_rank: Super Contributor
timestamp: February 19, 2017, 04:22:45 am
content: 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=630711214512These 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.

author: Zero999
author_rank: Super Contributor
timestamp: February 20, 2017, 09:48:08 am
content: Quote from: Gregg on February 19, 2017, 04:22:45 amThat 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.

author: ratio
author_rank: Regular Contributor
timestamp: February 20, 2017, 03:29:43 pm
content: Quote from: Hero999 on February 20, 2017, 09:48:08 amIt 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.

author: Zero999
author_rank: Super Contributor
timestamp: February 20, 2017, 03:52:05 pm
content: 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

author: ratio
author_rank: Regular Contributor
timestamp: February 20, 2017, 04:05:34 pm
content: Quote from: Hero999 on February 20, 2017, 03:52:05 pmHow 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.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.

author: Zero999
author_rank: Super Contributor
timestamp: February 20, 2017, 08:49:34 pm
content: 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

author: ratio
author_rank: Regular Contributor
timestamp: February 20, 2017, 10:12:35 pm
content: Quote from: Hero999 on February 20, 2017, 08:49:34 pmIt'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.Quote from: Hero999 on February 20, 2017, 08:49:34 pmThanks for this, I'll remember it. I think I'll be ok switching the low side, this part will be protected by a polyfuse.

author: Farley
author_rank: Regular Contributor
timestamp: February 21, 2017, 12:35:45 am
content: 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