# Why do we put transistors in logic gates? [closed]

I was recently doing some experiments on a breadboard and I decided to try to make a not gate with a single transistor. It worked. Then I tried taking the transistor out of the circuit, connecting what would've been the base and emitter together, and it still functioned. So why do we use transistors in logic gates? I thought it might be to keep the signal strong, rather than it weakening, or to get less resistance, but I don't know. I'm new to all of this, so sorry if this isn't a great question. So why must we include transistors in logic gates inside a computer?

Edit: Here's the transistorless schematic. I built it on a breadboard, and I might've translated it to a schematic diagram wrong, so please tell me if I did. Anyway, the only path for electricity is through the LED when the switch is open, but when it closes, it becomes the path of least resistance, and the electricity basically goes around the LED.

simulate this circuit – Schematic created using CircuitLab

• If you made a not gate with a single transistor and then took out the transistor .. what was left? Nothing? How did it invert the signal? May 10, 2021 at 12:31
• Yes, we must see a schematic. May 10, 2021 at 12:31
• @pjc50: I guess he got a "NOT gate" that works correctly in 50% of the cases and checked only those cases that work ;-)
– Curd
May 10, 2021 at 12:51
• This is not a logic gate at all. A logic gate as a clearly defined signal input and a clearly defined signal output. What you have invented is a "light switch". May 10, 2021 at 13:33
• And a highly inefficient light switch at that. But still, you can take the next step, and electrically control that switch ... replace it with a relay. NOW it's a logic gate, and such gates CAN be used in computers - see the Zuse Z3, which was clocked at about 5 Hz. en.wikipedia.org/wiki/Z3_(computer) May 10, 2021 at 19:05

A transistor is a lot like a voltage-controlled switch.

You have something that's pretty much a NOT gate. One unusual thing about your NOT gate is that it involves a pushbutton—a human-controlled switch. And that's totally fine! But if we wanted to build a computer out of logic gates like that, then we'd need to replace the human-controlled switch with a voltage-controlled switch. That's where transistors come in.

Your circuit could hardly be considered a logic gate. Logic gates have input and output. Your output is the LED, but your input is manual, not electric.

You made a light switch in such a way that pushed means off, which in some sense could be called logic inversion, but it definitely isn't a logic gate.

If you replaced the pushbutton with a transistor in such a way that a high level on the gate/base would make it conducting, then it could be considered a logic inverter. Transistors essentially act like switches in logic circuits (but not in analog amplifiers).

Early digital logic did use diodes for the logic function, along with a transistor or two to restore the voltage levels. Google DTL and see what comes up.

The picture below, from Wikipedia, shows a early 1960's style 2-input NAND gate.

• The transistor is there to make the "N" in "NAND", not only to "restore voltage levels". May 10, 2021 at 12:57
• @JiříMaier - that is an unavoidable consequence of restoring the voltage levels. There isn't a simple way of restoring the levels without using a transistor(or other active devices) and all practical ones invert the signal. May 11, 2021 at 15:45

You can calculate any logic function using solely NAND or NOR gates, both of them require inverting signal. While you could implement AND and OR using diodes, you need a transistor for NOT. That is why transistors are essential for logic circuits.

The part about "making the signal strong" is also true, each gate restores the signal to keep it well shaped (rectangular). Gate called "buffer", which is generally two inverters connected together, is used for reconstructing signal.

But I have no idea what you did to your circuit to make it working without the transistor... (before the question was edited and schematic added)

• In the olden days we used relays or vacuum tubes. There was also fluidics that didn’t really catch on. May 10, 2021 at 13:35
• @Kartman There apparently also were magnetic logic gates too: en.wikipedia.org/wiki/Magnetic_logic May 11, 2021 at 11:27

## Some early computers did essentially that...

Your circuit is a decent start to making computer logic, but it has a problem. The output is an electrical signal, but the input is mechanical. If you want to cascade the output to another level of logic, the input also has to be electrical.

You can move a switch with an electromagnet; this is called a relay. Now you can nest your logic as deep as you need! Some pioneering computers were built from relays:

• Konrad Zuse built a series of relay computers in World War II Germany. The Z2 had a mechanical memory, but the rest of the computer was made of relays. The Z3 performed floating-point calculations. The Z4 was the first all-electric computer.
• The Bletchley Park Bombe, famously designed by Alan Turing, was able to decrypt the Enigma code used by Germany during World War II.
• The Harvard Mark I was built by John Von Neumann, and contributed to the Manhattan Project. Von Neumann built two more models that were also relay-based.
• Bell Telephone created the Model V computer in 1946.
• One of IBM's first calculating devices was the IBM CPC in 1949.

(By the way, there is nothing special about using an LED as your output. Relay computers often used regular light bulbs as output devices. Although some early logic used diodes, it's simply not needed.)

## ...but they were slow...

It takes time to physically flip a switch, even if it is done electromagnetically. So relay computers were slow. They were outpaced by and lost market to computers built from vacuum tubes, which could switch at the speed of light.

## ...and unreliable.

When you flip a switch millions of times, it is bound to eventually break. Relays tended to jam.

Vacuum tubes also had reliability issues: they eventually burn out. However, it's a lot easier to spot a tube that is no longer glowing than finding a stuck relay. That's important when you are trying to track down which of the thousands of relays/tubes is making your computer malfunction.

Eventually, computers moved on to discrete transistors, then integrated circuits, each with better speed and reliability.

• And they consumed a fearsome amount of power... but they did work. May 11, 2021 at 19:43