# connecting logic gates

This is a controller I was going to make to operate a 2 wire LED as a side marker / turn signal light on my off road (so, no need to get bent out of shape about FMVSS and DOT requirements) Jeep. The problem is that it is wired from the factory with a single filament bulb and two powered circuits using a floating ground. The obviously won't work, because you can't reverse polarity through an LED like you can with a filament bulb. I have done the same thing before with some standard automotive diodes and relays, but I wanted a more elegant solution and this is more fun (not to mention this way is actually cheaper and takes up way less space). So, yes this is a complex solution to a simple problem, but I like doing stuff like this and learning along the way.

EDIT - I re-drew the circuit using the XOR gate. will it work properly as designed now? REVISION - (edited as recommended)

The idea here is that the marker and turn signal functions work normally when used separately, but when the marker is on the turn signal will cause it to "blink" off.

I added diodes and capacitors in the power lines after reading the cautions on the product data sheets to do so in order to keep the gates and the relay more stable. They may not be necessary, but for a few bucks it's better safe than sorry.

I just wanted to see if the people on here thought it would function properly the way I have it drawn before I go prototyping it. THANKS!

simulate this circuit – Schematic created using CircuitLab

EDIT #2: here is the original seriously flawed schematic for discussion reference purposes -

simulate this circuit

• This seems like a spectacularly complicated way of making a bridge-rectifier out of logic, etc... – brhans Jun 14 '17 at 19:00
• I wouldn't try to power the NAND gate from the output of the OR gate, like you've done. The NAND has input clamping diodes that will pass input voltage to its supply rail when unpowered. Just a big 'no'. Please edit your question with a truth table (TURN&MARKER = 00, 01, 10, 11) showing what you want the circuit to do for all 4 cominbations of input voltage. Then we'll know what problem you're trying to solve. Thanks. – TonyM Jun 14 '17 at 19:03
• That makes it clear so, yes, use a bridge rectifier as the others have said. With all that circuit, I thought there was some hidden complication I'd missed :-) – TonyM Jun 14 '17 at 19:39
• If you really want to do this with digital logic, then the logic gate you're looking for is an XOR (exclusive or). Its output is high when its input are different, and low when they are the same - just like your truth-table shows. – brhans Jun 15 '17 at 3:07
• Thank you! I will re-draw using that gate. What about the rest of the circuit? Do I need to use higher V rated components (over 16V)? Are the capacitors too large or the diodes too small? – LsD Jun 15 '17 at 10:24

It's pretty "brave" to connect (what I think are) 16V (18V abs max) logic chips directly to a 12V automotive supply. Automotive standards call for survival of transients much larger than that. At least you have a diode to prevent negative transients from zapping things.

Please give manufacturer part numbers not distributor numbers.

The NAND will get powered by the protection diodes whenever either input is high.

There is no current limiting- it's not for sure the wimpy little BAV21 diodes will survive charging the 10uF caps, nor is it clear what exactly discharges them.

There should be a series resistor on the SSR LED to limit the current.

I agree with @brhans comment- just stick a W04M in there and be done with it.

simulate this circuit – Schematic created using CircuitLab

• I'm confused again, there are two "filaments here. I am using a 2 wire LED to serve both functions. – LsD Jun 14 '17 at 20:33
• So do I need to just use higher V rated gates? I edited my question and added mfc part#s. I dont know what you mean by "NAND will get powered by the protection diodes whenever either input is high". Would you suggest larger diodes or smaller capacitors (1 miro farad?)? Are you saying I need a resistor in the input line to the relay? – LsD Jun 14 '17 at 20:53
• I may not be opposed to using a bridge rectifier, but I'm not seeing how. I have two possible inputs, and a single output. The inputs and the turn signal power and the marker power. The output is a LED light with only two wires (a positive and a negative). I want the output active when either of the inputs is active, but non active when nether is or both are. I do not have two lamps or filaments. I would still like to know what I did wrong in my original design and I may still build it just for funsies if I can figure out what is wrong and why and how to fix it. – LsD Jun 14 '17 at 21:16
• note that the zener won't stop automotive transients. They can be pretty rough. Need MOVs or other TVS's. Many automotive "TVS" circuits simply disconnect when there's a spike, as it's too difficult/expensive to deal with it. – tyblu Jun 15 '17 at 18:24
• I went ahead and ordered these components and will prototype and test this. Thanks for the help! – LsD Jun 20 '17 at 17:42

If you would prefer a more robust circuit here is one that does not use any fragile CMOS chips and hence does not require much protection. D2/D3/R1/R2/Q1/Q2 are a discrete exclusive-OR gate driving the power MOSFET, much as @transistor's answer. The zener D1 protects the MOSFET gate.

simulate this circuit – Schematic created using CircuitLab

• That's odd, going from recommending a bridge rectifier to all this circuitry - what's the benefit over a bridge rectifier? No disrespect but was about to downvote it. – TonyM Jun 14 '17 at 19:59
• A bit less voltage drop.. it's just a kind of fun exercise and a break from the current project with hundreds and hundreds of components. – Spehro Pefhany Jun 14 '17 at 20:01
• I though it was you couldn't resist, it's a fun one to have a crack at :-) But I'll have to downvote so it's not mistaken as a plausible answer in the long run. – TonyM Jun 14 '17 at 20:06
• @TonyM Gotta do what you gotta do ;-) - I think it's a good illustration of a 'complete' solution rather than a 'outline' that doesn't have protection etc. – Spehro Pefhany Jun 14 '17 at 22:11
• +1 to any feasible suggestions with discretes, in the spirit of AoE :) – tyblu Jun 15 '17 at 18:17

I think we can simplify your schematic a little:

simulate this circuit – Schematic created using CircuitLab

Figure 1. The required XOR (exclusive OR) function is performed by the existing relay / switch logic on the left. Since lamp polarity reverses in operation a rectifier is required when converting to LED.

• Yes, I know it is a complicated solution to simple problem. I am mostly wanting to do it this way to practice and learn (re-learn) logic circuits and for an excuse to build a PCB with SMD components. What I don't understand is why the two above circuits have two "lamps". Tis circuit is for one light on one side of the vehicle to operate as a marker and a turn signal and will be duplicated on both sides of the vehicle. And, yes the LEDs are designed for 12V automotive lighting applications. – LsD Jun 14 '17 at 20:30
• The lamps represent the existing vehicle lamps on that side of the vehicle. – Transistor Jun 14 '17 at 20:55
• That is not what I am trying to do. I am replacing 1 lamp (single filament bulb) with a sigle LED. I thought I explained pertty explicitly in my question, maybe I was unclear. – LsD Jun 14 '17 at 20:59
• Your question is far from clear, I'm afraid. If you had drawn a schematic of the existing system it would have been much clearer. I've updated my answer. Anything more complex would be madness. – Transistor Jun 14 '17 at 22:02
• When I get to work tomorrow I'll be happy to post the schematics of the original circuit. I will also post the circuit I built on the other Jeep. If I knew how my question was unclear I would clear it up. I would seriously also like to know what I did wrong that would kame my original circuit not work. This is a project or experiment for learning and trying new things just as much as it is a solution to a problem. Thank you all for your responses. – LsD Jun 14 '17 at 22:52