Single-transistor OR gate

Thread Starter

drkblog

Joined Oct 4, 2012
109
A very simple question, I guess. I was looking for a simple OR gate using a transistor. Specifically I need a 8-bit OR gate which in turn will drive a transistor. So I thought it would be better just building the gate with the transistor itself. I looked around in the web for various versions of transistor-made-gates. But I couldn't find any OR gate using a single transistor.

I was thinking of a circuit like this one:

I think this will do. But I wander why I couldn't find something like this published. Is there something wrong with this?
 

WBahn

Joined Mar 31, 2012
30,075
A very simple question, I guess. I was looking for a simple OR gate using a transistor. Specifically I need a 8-bit OR gate which in turn will drive a transistor. So I thought it would be better just building the gate with the transistor itself. I looked around in the web for various versions of transistor-made-gates. But I couldn't find any OR gate using a single transistor.

I was thinking of a circuit like this one:

I think this will do. But I wander why I couldn't find something like this published. Is there something wrong with this?
Depending on the specifics of the application, it may work just fine for what you need it for. But probably not -- for general purposes it is a very poor design for a number of reasons.
 

WBahn

Joined Mar 31, 2012
30,075
Consider the following:

What is the output if there is no load at all and exactly one of the four inputs is HI (which I'm assuming is 5V)?

What is the output if there is no load at all and all four on teh inputs are HI?

Now let's say that you use five of these 4-input OR gates to make a single 16-bit OR gate by using four of them to each OR 4 of the inputs and then using the 5th to OR the outputs of the other four. What will the output of the second OR gate be, even if it has no load, if only one of the sixteen inputs is HI?

How much current does the source driving one of the inputs have to provide? Does it depend on how many of the other inputs are HI?
 

crutschow

Joined Mar 14, 2008
34,464
To continue with WBahn's comments, the circuit loses two diode drops (one diode and one base-emitter) from input to output. Thus you couldn't cascade the signal through more than a few gates before the signal would be two low to give reliable operation.
 

WBahn

Joined Mar 31, 2012
30,075
Shucks. I was hoping he would be able to see the issue and draw that conclusion on his own if he was steered into looking in that direction.
 

Thread Starter

drkblog

Joined Oct 4, 2012
109
First of all thanks to everybody.

I'm aware this circuit isn't a replacement for a 4-input OR gate itself. In fact I realize I should have asked two separated questions: one regarding the gate, and the other about the circuit I need. Which isn't just a gate and will be used in a specific case.

My question about the gate comes from this circuit, proposed as a NOR gate:

Mine is just a modified version of this one. I added the diodes because I was afraid some current could drain to the inputs with LOW level. So I knew I was adding another voltage drop. But I wasn't sure about the current. So I'm going to try to answer WBahn questions now. But before I want to present the actual circuit I'm building. Which could make more sense:

There will be up to eight inputs. All the time one input is high and the rest are low.

Now the current issue. I'm going to do my best. But I remember almost nothing about this:

a. What is the output if there is no load at all and exactly one of the four inputs is HI (which I'm assuming is 5V)?

b. What is the output if there is no load at all and all four on teh inputs are HI?

c. Now let's say that you use five of these 4-input OR gates to make a single 16-bit OR gate by using four of them to each OR 4 of the inputs and then using the 5th to OR the outputs of the other four. What will the output of the second OR gate be, even if it has no load, if only one of the sixteen inputs is HI?

d. How much current does the source driving one of the inputs have to provide? Does it depend on how many of the other inputs are HI?
a. \(Ib = \frac{5V - (0.7V \times 2)}{14.7k\Omega} = 0.24mA\) The output is near 5V

b. \(Ib = \frac{5V - (0.7V \times 2)}{7.2k\Omega} = 0.5mA\) The output is near 5V

c. The base current won't be enough for switching the transistors ON

d. 0.24mA assuming the load has high impedance. If there is more than one input high each source will provide less current.
 

ronv

Joined Nov 12, 2008
3,770
Back in the old days there was a whole logic family based on your circuit. You can google DTL for it.

It can be simplified a little.
You need to make sure that your inputs can drive enough current. For example if the input was tied to plus five volts thru a 100k resistor it would not work well because the base drive would be to low.
 

Attachments

WBahn

Joined Mar 31, 2012
30,075
a. \(Ib = \frac{5V - (0.7V \times 2)}{14.7k\Omega} = 0.24mA\) The output is near 5V
Where does the 14.7kΩ value come from?

Assuming, for the moment, that it is correct, is it what you need? 0.24mA doesn't seem like a lot of current in an LED?
 

WBahn

Joined Mar 31, 2012
30,075
Ah, never mind on the questions in the last post. I thought you were using your modified schematic that has the 330Ω resistor and the LED.

Is your answer the base current (indicated by the 'b' in 'Ib') or the collector/emitter current?

In either case there is a problem because you are using Ohm's law to calculate the current through a resistance. But Ohm's law is very, very specific. It relates the voltage across THAT resistor to the current through THAT resistor. By taking the sum of 10kΩ and 4.7kΩ you are saying that "THAT resistor" is the series combination of the two, meaning that whatever current flows in one must be the same as the current that flows in the other. However, these two resistors are not in series because the current flowing in them is not the same -- in fact it is different by a couple orders of magnitude.

The absolute highest that the output can every be is 5V-2(0.7V)=3.6V. If it is any higher than that, the transistor would be off.

If we apply KVL down the base path to ground assuming just one input is HI, then we have

Vcc = Ib*Rb + Vd + Vbe + Vout

Solving for Ib:

Vcc = Ib*Rb + Vd + Vbe + Ie*Re

Vcc = Ib*Rb + Vd + Vbe + (Ic+Ib)Re

Vcc = Ib*Rb + Vd + Vbe + (βIb+Ib)Re

Vcc = Ib*Rb + Vd + Vbe + Ib(β+1)Re

Vcc = Ib*[Rb+(β+1)Re] + Vd + Vbe

Ib = (Vcc-Vd-Vbe)/*[Rb+(β+1)Re]

Going back to the first equation and solving for Vout:

Vcc = Ib*Rb + Vd + Vbe + Vout

Vout = (Vcc-Vd-Vbe) - Ib*Rb

Vout = (Vcc-Vd-Vbe) - (Vcc-Vd-Vbe)Rb/[Rb+(β+1)Re]

Vout = (Vcc-Vd-Vbe){ 1 - Rb/[Rb+(β+1)Re] }

Vout = (Vcc-Vd-Vbe){ (β+1)Re/[Rb+(β+1)Re] }

Vout = (Vcc-Vd-Vbe)/[1 + (Rb/Re)/(β+1)]

If we assume β=100, then with Rb=10kΩ and Re=330Ω, we have an output voltage of

Vout = (5V-0.7V-0.7V)/[1 + (10kΩ/330Ω)/(100+1)]

Vout = 3.6V/(1 + 30.3/101)

Vout = 3.6V/1.30 = 2.77V
 
Last edited:

WBahn

Joined Mar 31, 2012
30,075
What is the purpose of the emitter resistor? Wouldn't it be better in the collector circuit?

Bob
If it is moved to the collector, then the base current will be essentially directly proportional to the number of inputs that are HI. As long as any one input going high is sufficient to put the transistor into hard saturation, this is probably acceptable.

If we define "hard saturation" as being β<10 (a commonly used criterion), then the nominal collector current is

Ic = (Vcc-Vled-Vcesat)/Rc = (5V-2V-0V)/330Ω = 9.1mA

Note that I'm assuming a red LED with a 2V forward drop and also that I'm that Vcesat is 0V although 0.2V is probably more realistic.

So we want the Ib to be at least 910μA. Since

Ib = (Vcc-Vd-Vbe)/Rb = (5V-0.7V-0.7V)/Rb > 910μA

We need Rb to be no more than 3.96kΩ. So 10kΩ is a bit high, but probably would work without much problem.
 

Thread Starter

drkblog

Joined Oct 4, 2012
109
Ah, never mind on the questions in the last post. I thought you were using your modified schematic that has the 330Ω resistor and the LED.
No. I replied you thinking in the first schematic, because your questions were about it. I tried not to mix them.

Is your answer the base current (indicated by the 'b' in 'Ib') or the collector/emitter current?
I trying to calculate the base current. Later when BobTPH asked about the emitter resistor I realized I wasn't taking into account the voltage drop in that resistor.

In either case there is a problem because you are using Ohm's law to calculate the current through a resistance. But Ohm's law is very, very specific. It relates the voltage across THAT resistor to the current through THAT resistor. By taking the sum of 10kΩ and 4.7kΩ you are saying that "THAT resistor" is the series combination of the two, meaning that whatever current flows in one must be the same as the current that flows in the other. However, these two resistors are not in series because the current flowing in them is not the same -- in fact it is different by a couple orders of magnitude.
Well. I kinda knew I wasn't doing the right thing there :) I was just hoping I was getting near the number.

The absolute highest that the output can every be is 5V-2(0.7V)=3.6V. If it is any higher than that, the transistor would be off.
I don't understand this one.
 

WBahn

Joined Mar 31, 2012
30,075
No. I replied you thinking in the first schematic, because your questions were about it. I tried not to mix them.
Very reasonable thing to do.

Originally Posted by WBahn
The absolute highest that the output can every be is 5V-2(0.7V)=3.6V. If it is any higher than that, the transistor would be off.
I don't understand this one.
In order for the transistor to be on the base-emitter junction must be forward biased, right?

In order for the diode in the base circuit to be conducting, it must be forward biased, right?

So, neglecting the drop across the base resistor entirely, the voltage at the base of the transistor would be Vcc minus the voltage drop across the diode, or 4.3V, right? If the base of the transistor is 4.3V and there has to be a Vbe of 0.7V, then the emitter has to be at 3.6V, right?

That's if there is no voltage drop across the base resistor. If there is, then it gets subtracted as well. In your case, there is about 1V dropped across the base resistor, so you are down in the 2.6V range.
 
Last edited:

Thread Starter

drkblog

Joined Oct 4, 2012
109
If it is moved to the collector, then the base current will be essentially directly proportional to the number of inputs that are HI. As long as any one input going high is sufficient to put the transistor into hard saturation, this is probably acceptable.

If we define "hard saturation" as being β<10 (a commonly used criterion), then the nominal collector current is

Ic = (Vcc-Vled-Vcesat)/Rc = (5V-2V-0V)/330Ω = 9.1mA

Note that I'm assuming a red LED with a 2V forward drop and also that I'm that Vcesat is 0V although 0.2V is probably more realistic.

So we want the Ib to be at least 910μA. Since

Ib = (Vcc-Vd-Vbe)/Rb = (5V-0.7V-0.7V)/Rb > 910μA

We need Rb to be no more than 3.96kΩ. So 10kΩ is a bit high, but probably would work without much problem.
Alright. In this case there is no resistor under the emitter. Which, I think, simplifies the math. Because voltage drop over Re depends upon Ib and Ic, since Ie = Ib + Ic. And using β under 10 we can't say Ie ≈ Ic

I'm going to build this circuit in the breadboard:

Where the collector current should be 12.7mA and the base current should be 1.3mA
 

Austin Clark

Joined Dec 28, 2011
412
I believe a pull-down resistor at the base should be used. Even if all the inputs are LOW, the base could still carry current from outside sources (static, EM, etc;) and switch unreliably.
 

Thread Starter

drkblog

Joined Oct 4, 2012
109
It works! :)

It's a IR LED. It's a test circuit for this: http://forum.allaboutcircuits.com/showthread.php?t=89719&page=2

Before placing eight LEDs and transistors on the breadboard I wanted to test the clock-divider solution. So I wanted the eight outputs (which will control eight different LEDs) joined over a single LED for simplicity. Now that I tested it and successfully received the pulses on the other end. I can build the final circuit.

 
Top