Electronics > Beginners

XOR Gate Transistor Properties

(1/1)

ziptol:
Hi,
I was working on making a XOR gate with 2N2222 transistors when I came across something that confused me (Diagram Attached). When I first tested the circuit, R4, R5, and R6 were not included and I found that when I closed SW1 and opened SW2, it worked properly and the LED came on, but when I closed SW2 and opened SW1, the LED didn't come on. After some troubleshooting and guessing, I decided to put in R4, and the LED lit up dimly with SW2 closed and SW1 opened, and after playing around with the values, I found that 15K (R4,5,6) made the LED light up with the same brightness on both conditions. I am wondering why this is. Why do I need the 15K in order to make the circuit function?
Thanks.

hamster_nz:
What's with the wire between R5 & R6?

Do you need pull downs on the open switch? (seems off to leave them floating)

Oh and if both are high, does it not turn all transistors on and short-circuit the power surply?

ziptol:
1. Whoops! The wire between R5 and R6 isn't meant to be there (Fixed).
2. On the breadboard I used wires that I moved between +5V and Ground, the switches were the easiest substitute in easyEDA.
3. I guess it would, but I didn't have any issues with it. There's probably enough internal resistance in the cheap phone charger I use that there's not really a problem with short circuits.

hamster_nz:
The base on Q4 can never get over 0.7V, which is why it doesn't work without the resistors.

Likewise the base of Q3 will never get over maybe a volt if Q4 is turned on.

Maybe add a power LED (and R) so you can see if the supply collapses due to short circuit.

XOR is quite complicated compared to NAND, NOR, AND, OR to implement in transistors.

T3sl4co1l:
You nearly have what's called a Vbe multiplier circuit: in the both-switches-on state, Q3 should be well saturated, and Q4's collector voltage is set by R4-R6, less Q2 Vbe.  Normally, a Vbe multiplier has a voltage divider from collector to base to emitter; here, the B-E resistor is infinite, so the multiplication of Vbe will be small, about 1, which means the collector voltage should be pretty low, nearly saturated.

But... that assumes Q2 doesn't deliver current, but it will (let me guess, both transistors get rather hot?).  As a result, Q4 gets overpowered to some extent, and the actual voltage will be somewhere between 1-3V depending on hFE.  Towards the high side I think, since Q2 has the advantage (a 10k pullup versus 15k from an already-pulled-down-ish node).

So, yeah, not a good logic level, and inefficient.

It would work better if the common emitter output had a series resistor, so the NAND can pull down on it.  Then it has crappy output drive level, but, you could buffer it.  Maybe using an inverter, so you get an XNOR instead, but the same basic operation in any case.  And then since the interior node doesn't need much drive strength, you could use diodes from the switches, instead of transistors, so you're actually using one fewer transistor overall.

Question: an XOR gate is symmetrical; there is no distinction between SW1 and SW2 behavior.  Should the circuit not be symmetrical as well?  That is, would you not also have a resistor between Q1 and Q3 bases?  (Not that you can have perfect symmetry from a series NAND configuration, but that shouldn't matter much in most cases.)

Tim

Navigation

[0] Message Index

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod