Have I made this XNOR gate right?

I tried to make a circuit implementing the XNOR logic by using the identity XNOR (A,B) = OR ( NOR(A,B) , AND(A,B) ). The circuit works in breadboard (1st pic), it produces the 1001 truth table associated with XNOR gate. Is the drawing of the circuit alright?

Transistors 1, 2 and 3 make the AND gate (three transistors on the top middle in the breadboard), transistors 4 and 5 make the NOR gate (two transistors on the top right in the breadboard) and transistors 6, 7 and 8 make the OR gate (three transistors on the bottom left in the breadboard).

I needed 8 transistors and 7 resistors to make this circuit. Are there better ways of making XNOR gate using BJTs that requires less components?

• remove transistor 6 and its collector resistor ... place the LED between transistor 7 collector and its collector resistor May 16, 2023 at 16:55
• Paralleling BEs isn't the best idea, worse with Q4&Q2 even with Q5 off, with Q5 on it should be worse. Use separate base resistors, compare 4 k to 2 k. Do you use a simulator and/or voltmeter to get an idea about the voltages at interesting nodes? May 16, 2023 at 17:03
• Possibly remove transistors 1 & 8 and their base resistors, and connect transistor 2's collector where transistor 8's collector was. May 16, 2023 at 17:05
• @user253751 you are correct. I made a mistake in my lsst drawing. I corrected myself, drew a new circuit diagram and replaced the old drawing with this new onr. Please take a look. I believe it is alright now. May 16, 2023 at 17:29
• Update everyone. I removed the drawing of the circuit as it had mistakes. I rectified the mistakes hopefully and replaced the previous drawing with the corrected one. May 16, 2023 at 17:31

If your circuit works then it works. However, it's a bad idea to share the same resistor with the base of multiple transistors, because they could use different voltages to turn on (due to manufacturing variations, or different voltages at the collector/emitter) and when the bases are directly connected it forces them to be the same. Each one should have its own resistor.

Also, transistors 1 and 8 are forming two NOT gates in sequence, and could be eliminated.

I suppose if you want to calculate OR ( NOR(A,B) , AND(A,B) ) you won't be able to do it with less transistors.

You can cheat a little. If you remove the last transistor 6, you can have an XOR gate, and reverse when the LED is on, by wiring it from 5V to the output, instead of from the output to ground.

But watch this magic: (click to simulate)

This is an XNOR with only 4 transistors - and 2 of them are NOT gates that are only needed because of the type of input you are using. If you use different inputs, 2 is enough:

I'm not sure where I found this circuit. You can play with it in the simulator. If one of the inputs is low and one is high, one of the transistors discharges the output to 0V; if they are both the same voltage then neither one turns on.

• Upvoted for spotting the redundant inverters. May 17, 2023 at 3:59