Electronic – XOR Gate design problem

digital-logicnpntransistors

I just recently started trying out on electronics engineering, and have built a OR gate, NOT gate and a AND gate using NPN transistors. When building the XOR gate, this is my design:

enter image description here

However, SW2 will not activate the LED due to the current at the base of Q4 (activated by SW2) activates Q5 to bypass the LED. Thus, the Q3 & Q4's AND gate does not work. Is there any way I can get the between Q4 and Q5 to not flow unless both Q3 and Q4 have been activated?

Thanks in advance! I'm such a newbie.

P.S. The simulation lets the current flow from the positive side to the negative side.

Best Answer

Conceptually, I can see why you implemented the circuit this way:

  1. If either of SW1 or SW2 is closed - either Q1 or Q2 will conduct and the current will flow to the LED
  2. However, if both SW1 and SW2 are closed - both Q3 and Q4 will conduct which will cause Q5 to conduct. When Q5 is conducting, there is not enough voltage on LED to turn it on

Good thinking, really.

However, BJTs have high current gain (\$\beta\approx100\$). It means that even a low current to the base of Q5 will be amplified and the LED won't turn on. But how comes there is a current to the base of Q5 when SW1 is open? Isn't Q3 behaves as an open circuit when SW1 is open? The answer is NO - BJT transistors have very interesting behavior when operated with floating base. They are not, in general, behave like an open circuit.

What can you do? Well, in real applications you wouldn't design and use such a circuit. However, given that you are educating yourself (and me too), I'd suggest you try to apply the following changes:

  1. Why did you choose 9V power supply? Each BJT has a maximum rating for \$V_{CE}\$ - check the model file that you're using and change your power supply accordingly. How this may help? Well, reducing \$V_{CE}\$ of Q3 may cause it to behave more like an open circuit when SW1 is open.
  2. Try to add pull-down resistors between bases of Q3 and Q4 and the ground (these resistors must be pretty large). This approach will prevent the base of Q3 from being floating when SW1 is open (respectively for Q4 and SW2).
  3. If none of the above worked, I suggest you'll try to find a way of "stealing" the current from the led which is not that sensitive to small unwanted currents as a single transistor. You may try to replace Q5 with Q3 and Q4 directly (collector of Q3 is connected in place of Q5's collector, emitter of Q4 is connected to ground).

Please let me know about the results.