Designing a relay circuit utilizing optocouplers, need input for first time. - Page 1
Forum section: electronics / projects

author: ReeseRiverson
author_rank: Newbie
timestamp: June 04, 2018, 02:55:10 am
content: I'm still a beginner when it comes to electronics engineering aspect, but I figured designing a relay circuit would be a good start. Especially when I was having some difficulty finding exactly what I need so I felt building the circuit myself is the optimal route to go.Basically the short form of what I need is simple... There are two inputs to control the relay. Input A needs to activate it. Though Input B will deactivate it.My intended use for this circuit is in my 2016 Honda CR-V automobile, as I'm working on a project for it that involves bypassing the factory audio amplifier completely with a nice aftermarket amp as I wish to upgrade the speakers. I've already confirmed this isn't an issue as I've got the schematics and wiring diagrams I needed from tech.honda to figure things out. Along with a used factory amp I bought so I can disassemble it instead of tearing the one in my vehicle apart.So the connections of importance in this relay circuit are called SWD +B and AMP MUTE. I plan to use the connectors off the amp's PCB to make my own wiring harness / enclosure for the circuits and wiring I need to complete this task.From my understanding off the technical sheets from Honda and how Metra's own aftermarket headunit replacement harness have things, as well as pulling some datasheets of the amplifier's ICs is the system when it's powered up (whether music is playing or not.) will feed the signal via SWD +B (Pin B13) to turn the factory amplifier on. Then any time AMP MUTE (Pin B24) has a signal fed, it keeps the amplifier in mute state to prevent popping from pre-amp power on/off states.So the idea is to utilize these two lines to operate a relay driver that would control a relay that will power on/off the 12VDC remote line to the new amplifier(s).I'm keeping my factory navigation headunit, and I want to be delicate as possible in handling the connections for those lines. Thus I began researching optocouplers because they would provide the isolation I want for this task.So the current design calls for SWD +B -> optocoupler -> transistor -> relay.Which I was then thinking that I could use a solid state relay that's normally closed between the transistor and ground. Thus anytime AMP MUTE sends a signal, it will cut off the relay.The schematics of two possible routes I was thinking are attached to this thread.Is this a practical way to get the job done, or am I going about this all wrong? (newbie mistake?)Would it also be wise to go ahead and use a solid state relay for the remote power connection as well instead of a mechanical relay? I doubt I'd need much current support for the aftermarket amp's remote in, but I'd probably would try to make it capable of handling 3 to 5 amps of current. The mechanical relay I chose is rated for 10, but I'd likely fuse it there.Also here are some pictures of the factory amp while I'm at it.

author: Zero999
author_rank: Super Contributor
timestamp: June 04, 2018, 08:39:24 pm
content: There's no point in having both opto-couplers and a relay. The purpose of an opto-coupler is to provide galvanic isolation, which is already provided by the relay. The opto-couplers could be replaced with plain transistors, which would be cheaper too.There's a mistake in the connection to the 4N28, on the first schematic: the cathode should be connected, not the NC pin, which means Not Connected.

author: ReeseRiverson
author_rank: Newbie
timestamp: June 04, 2018, 09:09:26 pm
content: Quote from: Hero999 on June 04, 2018, 08:39:24 pmMy original idea was to keep both input signals isolated too, but I did just realize that I probably could use a solid state relay in place of the mechanical relay as well. Which I think would be more optimal for speed.So if I used a solid state relay, how can I configure the transistors to operate the relay as I intend? This isn't something I was able to figure out, other than a combination of an AND and XOR gate.Ah, you're right! I didn't catch that when I re-did the schematic at the time. I'll get that corrected, thank you for pointing that out.

author: Zero999
author_rank: Super Contributor
timestamp: June 05, 2018, 09:59:21 pm
content: Quote from: ReeseRiverson on June 04, 2018, 09:09:26 pmTransistors can be connected in series or parallel to make AND and OR functions respectively.If the base of the driver transistor is connected to +V, via a suitable resistor, it can be shorted by another transistor, serving the inverting function.The same can be done with opto-couplers. For example, rather than using the expensive photo-MOSFET coupler in series with Q1's emitter, another 4N28 can be added in series with its base.Put together a truth table, showing what output you desire, for different input comminations and work from there.

author: CopperCone
author_rank: Super Contributor
timestamp: June 05, 2018, 10:02:38 pm
content: you get double isolation using coupler and relay. some standards want double isolation. and you can use a separate supply for the relay to keep your signals cleaner.

author: wraper
author_rank: Unknown
timestamp: June 05, 2018, 10:06:45 pm
content: Quote from: CopperCone on June 05, 2018, 10:02:38 pmThere is no additional isolation in this circuit and everything is still connected to the common ground. Just a waste of optocouplers. Not to say that even relay contacts are not isolated from the rest of the circuit as well.

author: Zero999
author_rank: Super Contributor
timestamp: June 05, 2018, 10:29:03 pm
content: Quote from: wraper on June 05, 2018, 10:06:45 pmYes, no doubt it could be done with a MOSFET and some 4000 series or transistor logic gates.

author: wraper
author_rank: Unknown
timestamp: June 05, 2018, 11:03:40 pm
content: BTW how optocouplers are supposed to work with 22k resistors in series with emitter? 0.5mA current is certainly not fine. Say, 4N28 has >10% CTR, driving 2N3904 with >50uA current is too optimistic. And for G3VM-21BR it's barely enough to activate if you get a sensitive specimen but it's completely within spec to not activate below 3mA.