0
\$\begingroup\$

I want to have two switches controlling my lights room that works like a XOR gate, does anyone know how to do it? I have a very simple switch for testing and I tried many times and couldn't do it as I don't know too much about electronics.

This is the switch I am using:
enter image description here

I was wondering if there is a way to wire it to another one that looks the same that works like a XOR gate.
I found this diagram online but I don't understand it, here it is though:
enter image description here
Cheers.

\$\endgroup\$
3
\$\begingroup\$

While this won't work well in the case of your room lights it does show a means of lighting an LED using your switches. This could be used to drive an opto-isolator triac, etc., if you really had to use those switches.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. An XOR configuration to control a small LED load using two SPST switches.

How it works:

  • With both switches open both sides of the bridge rectifier are connected BATT+ by R1 and R2. The LED will not light.
  • With both switches low both sides of the bridge rectifier are pulled low. The LED will not light but > 10 mA will flow in each switch for no optical benefit.
  • If either SW1 or SW2 is closed current will flow through the LED.

schematic

simulate this circuit

Figure 2. If SW1 is closed current will flow through R2, D3, LED D1, D4 and SW1.

\$\endgroup\$
7
\$\begingroup\$

You need two SPDT (single pole, double throw) switches. A SPDT switch will have three terminals - your two-terminal switch won't work.

The animated diagram you show is what you want.

EDIT (after OP's comment)

This is the required circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

If both switches are up, or both are down, the lamp will light. If the switches are in opposite positions (one up, the other down) the lamp will be off.

A single SPDT switch and a relay won't work, since your original question required two switches.

\$\endgroup\$
  • \$\begingroup\$ Would it work with a relay and a SPDT? instead of 2 SPDT. And can you show me how to wire it because I don't understand the diagram too well. \$\endgroup\$ – Matthew Dec 9 '17 at 17:40
  • \$\begingroup\$ You could use two SPDT relays controlled by two SPST switches. Or one of each, but the contacts at both ends need to be SPDT. \$\endgroup\$ – Spehro Pefhany Dec 9 '17 at 19:10
  • \$\begingroup\$ This is (one form of) the classic two way switching circuit used routinely by electricians. I'd never thought of it as an XOR gate, but of course it is! \$\endgroup\$ – Ian Bland Dec 10 '17 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.