this is my first post. I've been working on creating logic gates from 2N2222 transistors. I've build a basic switch, NOT Gate, OR, NOR, AND, NAND, and XOR (from a combination of the others). However, when I extend this to the XNOR, I get weird results.
I started by building the circuit from NAND, OR, and AND, following this: http://hyperphysics.phy-astr.gsu.edu/hbase/Electronic/xor.html#c1. I then just wanted to add a NOT on the XOR output. I figured this was the best way to build up my knowledge from smaller parts.
When I run this with 3.3V, the circuit (blue or red LED lights up) follows the XNOR truth table. However, when I switch to 5V, I get weird behaviour:
- when both inputs are OFF, the LED is on, but not too bright (call this bright)
- when I turn one input ON, the LED dims; to be less than what I see in (1) (call this less bright)
- when I turn on the other input, it is the same as (2) (call this less bright)
- when I turn on both outputs, the LED is the brightest (call this brightest)
One of the first things I tried to debug this was connecting the output to a simple transistor switch that powers an LED. This works just fine. When XOR is ON, the transistor switch is on, and LED is on. When the XOR output is OFF, the LED is off. I then changed from the simple transistor switch to the inverter (NOT) gate and that's when I had issues.
I chose 10K for each base resistor, and 1K for the resistor either at Vcc or at Gnd. I chose 470ohms for the LED output (the LED is 3.0V to 3.2V and needs 20mA). I've tried changing the resistors at Vcc and Gnd to 4.7K to closely match the 5K that the link above showed. Again, this doesn't fix the issue.
I have attached a picture to show the circuit. It isn't too clean, but I hope it helps. This shows the 3.3v setting, and this is when the circuit behaves as I would expect.
Edit: I hand drew the schematic. I’ll look into a schematic tool or the embedded editor next.