# How to build an interesting XOR circuit with my child's electronics kit

When I got home today, my child was proudly telling me how they had managed to make AND, OR, and NOT logic from his snap circuits electronic kit and was asking me how they could make exclusive or.

Has anyone any suggestions for a simple (and hpefully educational/entertaining) circuit that would do this?

The kit only has simple push switches (i.e. no SPDT switches) and the usual variety of basic electronic components. It does have PNP and NPN transistors but I would prefer something simpler (they haven't used transistors so far). Diodes would be okay as they are easier to understand and more familiar.

One idea I had was something like this:

but it is not ideal as it uses two battery packs and ends up driving the lamp through a potential divider that has to be matched to the current battery voltages. Any better suggestions?

EDIT:

To clarify, they want to make a circuit which has two push buttons, and the lamp will light if either (but not both) switch is pressed.

In particular, there is no requirement that the circuit has digital inputs and a digital output (the way we would normally think about digital logic).

simulate this circuit – Schematic created using CircuitLab

To light the lamp, one of the switches must be closed and the other open. Note that if both switches are closed, a lot of power will be wasted in the resistors but the light will be fully off. Note further that one may have to use a very small bulb and may have to use a higher voltage or reduce the resistors to get much light, but one should ensure that the voltage squared divided by the resistance does not exceed the resistor's power rating (for example, if you used 12 volts and 22 ohms, you would need to use 5-watt resistors). Alternatively you could replace the resistors with light bulbs and shelter them so their light isn't visible.

If you want a transistor circuit, here's half of a circuit I designed for my parents' car some decades back when I was about eight (I don't remember the actual resistor values; the transistors were some sort of TO-3 package and not 3906's; the components given should be suitable for demonstration purposes--the real one used a lamp rather than an LED and resistor). An electrical engineering grown-up friend helped with the design, but I designed the overall concept.

simulate this circuit

The left-side input is wired to one of the turn signal flashers on the car; the right-side input is wired to the brake light. The lamp is the left light of a trailer. The right-side flasher and trailer lamp are wired similarly. Note that positive is on the bottom. Your son's challenge is to figure out what the diodes on the bottom are for (consider the above description of what the circuit was connected to).

• Very nice idea! We tried it this morning but unfortunately the lamp is actually much lower resistance than 100 and won't light at the moment - but the child suggested maybe we could use the amplifier as well to increase the power... Great idea, easy to understand and leads onto to interesting discussions - many thanks for your help! Oct 22, 2013 at 7:20
• @PeterdeRivaz: To get optimal brightness from the lamp, you could replace each of the resistor with a 2-4 lamps in parallel (put a box or something around them so they wouldn't "light up"). It may be interesting to note how adding more lamps in parallel at the top makes those lamps dimmer and the bottom one brighter. I also added a transistor circuit based on a real circuit which I designed (and my dad built) some decades ago for my parent's car. Oct 22, 2013 at 15:19
• @PeterdeRivaz: Thinking about my parent's car... the circuit with just the resistors might actually be practical for the automotive purpose (possibly adding diodes in the same place, and for much the same purpose, as in the lower circuit) if the light bulb were replaced with two back-to-back-wired LEDs or strings thereof. Oct 22, 2013 at 15:22

One of the possible equation for XOR is (A+B).not(A.B)

If only one contact buttons have to be used, it can be implemented by the following schematic, using diode logic.

REMARK: The initial schematic was drawn with a lamps as an output, but as long as the lamps are symmetrical devices, the diodes are actually superfluous. In the same time, this implementation of the XOR will better work with LED indicator, so I redrawn it this way:

simulate this circuit – Schematic created using CircuitLab

If buttons with switching contacts can be used, the things becomes really simple. Following schematic uses a little bit different equation: Q = (A+B).(not A + not B)

simulate this circuit

• Thanks, he doesn't have the SPDT switching contacts, but I think there is a relay. I'll check in the morning, but I am a bit worried that we may only have 2 or 3 diodes/LEDs so the first circuit may also not quite be possible. Is anything simpler possible? Oct 21, 2013 at 21:53
• @PeterdeRivaz - I found better schematic. See it now. Oct 21, 2013 at 22:02
• @PeterdeRivaz - In the first schematic, the lamp can be easy replaced with LED in this case the resistors act as a current limiters. Oct 21, 2013 at 22:05
• What is the component marked BR1? I don't recognise the symbol and the parameters in circuitlab don't seem to give me any clues? Edit: I found it - bridge rectifier - but I don't think I will have one of those in the kit. Oct 21, 2013 at 22:06
• @PeterdeRivaz - it is a bridge rectifier that contains 4 diodes, connected exactly as in the left schematic. These two schematics are equal. Simply drawn differently. The right one is easier for understanding from some people. Oct 21, 2013 at 22:08