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.
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.
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.
Figure 2. If SW1 is closed current will flow through R2, D3, LED D1, D4 and SW1.
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:
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.