Transistor logic circuits

Hello there! I know this isn’t technically robotics related, but what else are you going to do stuck inside your house?

I am making a ripple carry adder ALU and I am building it with wires, resistors, led’s and transistors. Which means I am going to have to make a lot of XOR gates. I have been doing research and came up with a couple ideas of how to make a XOR gate with only two transistors, but in practice, it always failed. Would any of you have any idea how to make the most transistor efficient XOR gate? Any help would be welcome!



Hey Patrick!

This sounds like an awesome learning project! What kind of transistors do you have on hand?

1 Like

Not directly an answer to your question, but this may be interesting to look through:

1 Like

Transistor 2N3904 NPN

Oh Boy. Let me see if I can still rip up the circuit I created when I did this for my Senior Research Project in High School. Though… I think I converted everything to NAND gates to simplify things…

1 Like

I’m curious about the circuit that you are trying with only two transistors. I’ve read of one XOR design with only two transistors, but there were some certain impedance and driver requirements, and some “tricks” that the author cautioned about.

1 Like

I do believe it is possible and all I really need is a large output when on and a low/off output when off.

I think it would be easier for me simply to make a four transistor XOR gate than to use NAND gates. The reason I want to use two is because it is the least amount you can use (without diod’s) and I wan’t to make the biggest ALU possible with the amount of transistors I have.

It’s been awhile since I have done anything in BJTs but I am familiar with CMOS.

Usually a minimum transistor XOR gate gets that way by driving the output with an input. It’s great for transistor count, but awful for signal integrity. It’s because your input and output have current between them and it’s becoming a network of series resistances. It just gets worse the more stages you have.

You want your basic standard cell logic element to be something that is stand alone.

1 Like

Boolean Algebra is the heart of computer hardware. It one of the the reasons why we use 1’s and 0’s.

With boolean Algebra, entire circuits can be converted to algebraic form and then simplified and manipulated as if an equation.

Boolean algebra is based upon Set Theory, you will want to understand Set Theory a little bit.

This is something very different from just numbers like they teach you in High School, but it is really rewarding.

If you want to go in-depth into Computer Hardware Design, Principles of Computer Hardware by Clements is really good.

Enjoy :slight_smile:

1 Like


I would swap your NPN transistors for MOSFETs instead so that you don’t need to worry about gate current. Given the large quantity you’ll need, I recommend placing an order on LCSC for a bunch of TO-92 N-channel and P-channel fets. They have them for very cheap, usually just a couple cents each.
You will definitely need both N and P transistors so that you can drive high and low side properly.

I wanted to do the same thing years ago but never got around to it. Good luck!


Well, in hindsight, I probably should have done more research. See, I already bought 150 npn transistors. I had looked up how to make an XOR gate and all the different ones I saw were made with npn transistors, so I thought that was all I needed. Thanks for you help though! I think I will probably just revert back to my old design o three transistors. That one worked pretty well.

1 Like

This man is doing stuff like you are thinking about
Ben Eater. Here is an example of him doing just what you asked. Making logic gates from Transistors This is a great lead in to his series on making a computer from logic gates Building an 8 bit breadboard computer


For just playing around, stick with NPN transistors and PNP transistors. FETs are very electrostatic discharge sensitive (ESD), so it is very easy to damage the gate pin with improper handling. Transistors are much more forgiving. Have fun!

1 Like

And, if you’re looking for an end goal bordering on insanity:


Yah, I checked him out a while ago. He is kinda what got me into making one of these… that and redstone in minecraft. I almost made a computer in there.

This looks amazing! Just shows what you can do with a LOT of time and a LOT of money and a LOT of brains… If only this was in my future… I think I will stick with a simple ALU for now thanks!!!

Yup, I plan on sticking with npn transistors for now. Might branch out eventually, but I thought it would be good to start with the simple ones.

It might be cheating a little bit but you can buy chips XORs , Nands, NOR, ETC. They are still made with tranistors. The TTL Cookbook was a good reference back in the stone age. But it is no more stone age than trying to do this with discrete components. :slight_smile:

1 Like