Help me understand XOR gate with diode logic [closed]

I'm generally a pretty smart person, but for some reason I can't get my head wrapped around this one.

A little background - I have performed this function before using two diodes and two SPDT relays. It works fine, but is bulky and wastes some money. I did it with logic gates and one SPST relay. That was super fun and a learning experience. It worked, but didn't last long.

I have seen it written that the same thing can be done with either: A - a rectifier bridge, or; B - a rectifier and a some resistors

If I am using the correct specs for the components, either option would be smaller and cheaper and just as robust as the relay and diode method. And, if I am reading the specs on the components right the relay isn't even needed.

I have no problem spending a few bucks to build something and letting the magic smoke out of some components and finding out it won't work. What I do have a problem with is the fact that I just do not see how this works?

Which of these is correct? Can you please help me understand how this would work? Am I right that the components can be spec'd heavy enough to leave the relay out? Are the resistors necessary, and if so how do you calculate the required values?

If this can really be done with a \$1.28 rectifier rated at 100V, 20A that would save a lot of hassle and space. But, I really just want to understand why and how?!

It's easy to see how you would get power to the LED when either input high, but how does the output circuit get back to ground? What causes it to not get power when both inputs are high? simulate this circuit – Schematic created using CircuitLab

I have spent quite a bit of time researching this and just can't manage to explain it to myself...

(BTW - please ignore the fact that the LED doesn't have a protective resistor, this is just for the purpose of me understanding how this works, not an actual design.

Thank you!

• And after reading my question I think I just explained to myself why you need the resistors. They are the ground path for the output circuit, correct? If that's true, then I don't see how version A would work at all...
– LsD
Aug 3 '17 at 22:07
• And I still don't get why both inputs being high would shut down the output (output low)?
– LsD
Aug 3 '17 at 22:08
• Or maybe both inputs being high would just not allow the output circuit to return to ground? But, why not?
– LsD
Aug 3 '17 at 22:17
• "Which of these is correct?" There is no way to know since you haven't specified what this circuit is supposed to do. You refer to "this" function in the second paragraph, but never defined it! This really should have been obvious. Aug 3 '17 at 22:23
• Input A and B need to be defined in the Off position as 0V open cct or 0V and 0 Ohms to Gnd. This makes a difference. Aug 3 '17 at 22:25

What the circuit does is to light the led when the voltages are different. The xor function that you mention.

If both voltages are 0v no current flows. If both are at 12v no current flows also. But if one is 12v and the other is 0v current will pass through the led. The rectifier is needed if you don't mind which one is up and which down. You could use two led in anti-parallel, one will light in each case.

The fact that you have used a CC source symbol leads to confusion. It only makes sense if voltages can vary.

Edit: it is digital electronics, the symbol should have been a square wave source.

• The led only lights when current passes through it. If both ends of the led are at 12v no difference of potential exists so no current flow. In fact it's the same case that 0v-0v Aug 3 '17 at 22:49
• wow, I feel pretty stupid now. That makes perfect sense...
– LsD
Aug 3 '17 at 22:52
– LsD
Aug 3 '17 at 22:57
• The Led wont pass much current unless the R1,R2 consume 2x~3x power when both inputs at 12V and LED is OFF Aug 3 '17 at 23:26

I have no problem spending a few bucks to build something and letting the magic smoke out of some components and finding out it won't work. What I do have a problem with is the fact that I just do not see how this works?

This will not work the way it is drawn, on both sides of the rectifier the voltage is positive. There is no way for current transfer to happen in this type of situation.

In circuit version B adding the resistors does nothing for the voltage on the terminals.

To understand and draw correct diagrams with rectifiers it helps to draw the two modes that the current can follow: Source: Electronics and Communications

A rectifier could function like a xor function, but you have to keep track of all four situations. Lets say the rectifier has terminals A and B and the output would be the difference between the + and - terminals. So yes you are correct, it does function like a xor gate (except you'll have the diode voltage drop included)

Rectifier:
1) A- 0V B- 0V Output- 0V
2) A- 0V B-12V Output-12V
3) A-12V B- 0V Output-12V
4) A-12V B-12V Output- 0V

• Ok. Thank you. I should have specified that we are talking about DC voltage here. So, I see what you are saying. I just still have the question of what actually causes the voltage at output to be 0V when both inputs are 12V (condition 3)? I'm wanting to actually understand what's going on to make it function that way?
– LsD
Aug 3 '17 at 22:43
• Current can only flow if the voltage is lower somewhere else in the circuit. If there are two nodes in a circuit next to each other at the same voltage, zero current can flow between them Aug 4 '17 at 1:05 simulate this circuit – Schematic created using CircuitLab

Note using 12V here you get the 20mA thru a 3V LED but all R's must be rated for 500mW even LED is only using 60mW. Not very efficient.