# Can you use a single Bipolar Transistor as an AND gate?

I have recently began electronics as a hobby, and I am curious about the use of Bipolar Transistors in AND gates.

Simply put, if I was to use the collector and base as inputs, and run small (~1 volt) currents through them, could the single transistor function as an AND gate, even if the base and collector voltage were approximately equal?

• Using the base and collector as inputs won't work as desired because you have just a base-emitter diode when the collector is off; simulation: i.imgur.com/n0W3ujO.png Also beware of measuring currents in volts :-)
– Fizz
Jan 20, 2015 at 9:45

I think that might be possible if you use emitter and collector of an NPN-transitor as inputs and connect the base to the +Vcc through a load resistance. This creates a wired AND-gate. If you make the E low, it will also draw the C input low bit that's not necessarily a problem except that it prohibits gates to be connected to multiple inputs. It also inconveniences testing, but other than that, it seems possible to me.

• This would work as it's basically en.wikipedia.org/wiki/Diode_logic#AND_logic_gate Simulation: i.imgur.com/pq4fuU3.png (with some source resitor values included).
– Fizz
Jan 20, 2015 at 9:28
• +1 This is a classic DTL AND gate - but a bad misuse of a transistor :-) Jan 21, 2015 at 2:00
• @Russel: That's true but as fas as i know most countries don't have any legislation regarding transistor abuse :-) Jan 21, 2015 at 2:23
• @Russell McMahon: Minor quibble: it's not DTL (diode-transistor logic), because that would mean adding adding another transistor after to amplify/restore the output signal. But that's not done here. Using the two junctions in the (sole) transistor as diodes is something even more primitive, called diode-resistor logic (DRL). DRL (with actual diodes) was used to complement DTL back when transistors were really expensive.
– Fizz
Jan 21, 2015 at 3:25
• @RespawnedFluff Yes. Braino on my part - my brain saw it as DRL but my fingers insisted on typing DTL. | "" ... when transistors were really expensive. ..." -> I have a few of those - memory says OC640 but maybe not. PRE OC70 71 72 :-). Jan 21, 2015 at 6:45

Ignoring some of the obvious mistakes in your question (like confusing the units of current) and trying to take this seriously, the answer is no.

You need to first define what it even means to be an AND gate in your context. What is a logic-0 in your case, or a logic-1? Concrete implementations of logic gates exist in the real world where actual voltages (currents) must be described if you are to ascribe any semantic meaning to a "1" or "0".

Traditionally these logic levels are defined as voltages ("5V logic" means, with some caveats, 5V = "1", and 0V = "0")

Logic AND looks like:

A | B | Y
0 | 0 | 0
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1


If you take the collector (A) and base (B) as inputs you will need the emitter (Y), the output, to behave as described in the table and that is not the behavior of a Bipolar Junction Transistor (BJT). The name explains why. BJT means "a transistor created by two shared junctions". These junctions behave like diodes and therefore have a very non-linear forward voltage curve. This has the effect of locking the base and emitter into a relationship that allows at most only a very small voltage difference between them. So your output is not conditioned on your second input and therefore it cannot serve (alone) as a 2-input gate.

## Some notes...

I don't understand this (even tho I did 2 years of EE in college). I think the key thing I don't understand is why the relationship you mentioned between the base and the emitter (very small voltage difference between them) has the consequence of having the emitter "not conditioned on your second input". Are you saying that if the base is on, the emitter is on too, whether or not the collector has current?

This statement, again, doesn't really make any sense. What does "base being on" mean to you? "on" describes current flow in a two-port network -- that means, between two points. You're only describing one point, the emitter or the base.

If you apply a small positive voltage to the base (~0.7V for many parts; let's call this voltage "Vbe"), relative to the emitter, there will be current flow between the base and emitter. If you apply less than ~0.7V to Vbe, there will be almost no current flow between base and emitter. If you apply more than ~0.7V to Vbe, the part will burn up and no longer function as a transistor.

Notice something here? Absolutely no relationship to any current or voltage the depends on the collector. The base to emitter relationship is that of a diode -- a two terminal device.

This is reflected in the simplified model of the BJT when forward-biased:

• I apologize for my uncomprehending and amateur nature. Are you saying that it will not function because the output only allows so much current to pass as the base applies? In that case perhaps a Thyristor, which is always either on or off, would instead function. (Note: I did specify 1 as ~1V and 0 can then be assumed as 0v.) Jan 20, 2015 at 13:55
• You're right that you cannot make an entire computer of diode-resistor logic, which is what Ambiorix's answer basically amounts to. But you can make substantial portions of one, as was the case for D-17B.
– Fizz
Jan 20, 2015 at 18:29
• It's interesting that [the lack of] cascadablity, which hampered DRL, is one of the major difficulties in all-photonic logic gates; 2010 ref/commentary.
– Fizz
Feb 1, 2015 at 16:19
• I don't understand this (even tho I did 2 years of EE in college). I think the key thing I don't understand is why the relationship you mentioned between the base and the emitter (very small voltage difference between them) has the consequence of having the emitter "not conditioned on your second input". Are you saying that if the base is on, the emitter is on too, whether or not the collector has current?
– B T
Mar 9, 2017 at 22:04
• @Fizz -- The question is about construction via BJT exclusivity, not Diode + Resistor. Of course you can "make an AND gate out of a single BJT" if you also add 3 NFET and 3 PFET and don't connect the BJT :-P Mar 10, 2017 at 5:30

Yes, you could if you use the two intrinsic diodes of a NPN transistor for a Diode Resistor Logic AND gate:

simulate this circuit – Schematic created using CircuitLab

...but I think it's not a good idea (e.g. because BE and CE diodes have different characteristics).

• Oh, just found out that Ambiorix suggested the same idea... but at least I've added a schematic.
– Curd
Mar 10, 2017 at 8:27
• "Just" = two years ago, but schematic is key just like you say. Mar 10, 2017 at 8:52
• @winny: "just" refers to "found out" not to "Ambiorix suggested" ;-)
– Curd
Mar 10, 2017 at 9:40

My main experience with transistors was in my teens way before the internet came to our homes, but I didn't see why this couldn't be done, so I gave it a go. I bought cheap NPN transistors, resistors and LEDs from ebay (so can't give you exact specs) and wired them to my Raspberry Pi.

Wiring a 330 ohm resistor to 3.3V taking it through a white LED and through the NPN to ground gives me a simple switch. I wired the base to ground through 200 ohms and to the inputs at 1k ohm. It worked. If only one input is high then there is 3.3 * 200 / (1000 + 200) = .55V at base and nothing happens, if two are high then there is 1.1V and the transistor switches.

See http://www.megaprocessor.com/stepping-stones.html for how transistors work.