# Single-transistor OR gate

Discussion in 'General Electronics Chat' started by drkblog, Oct 16, 2013.

1. ### drkblog Thread Starter Member

Oct 4, 2012
109
0
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?

2. ### MrChips Moderator

Oct 2, 2009
17,729
5,539
Actually, you don't need the transistor.
Google resistor diode logic or just diode logic.

3. ### WBahn Moderator

Mar 31, 2012
23,549
7,202
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.

4. ### WBahn Moderator

Mar 31, 2012
23,549
7,202
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?

5. ### crutschow Expert

Mar 14, 2008
20,795
5,909
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.

6. ### WBahn Moderator

Mar 31, 2012
23,549
7,202
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.

7. ### drkblog Thread Starter Member

Oct 4, 2012
109
0
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. $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.

8. ### BobTPH Senior Member

Jun 5, 2013
1,343
291
What is the purpose of the emitter resistor? Wouldn't it be better in the collector circuit?

Bob

drkblog likes this.
9. ### crutschow Expert

Mar 14, 2008
20,795
5,909
Sorry, I missed that.

10. ### drkblog Thread Starter Member

Oct 4, 2012
109
0
Yes. Assume R2 is before the LED.

11. ### ronv AAC Fanatic!

Nov 12, 2008
3,657
2,817
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.

• ###### dtl.png
File size:
143.8 KB
Views:
22
drkblog likes this.
12. ### WBahn Moderator

Mar 31, 2012
23,549
7,202
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?

13. ### WBahn Moderator

Mar 31, 2012
23,549
7,202
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: Oct 17, 2013
14. ### WBahn Moderator

Mar 31, 2012
23,549
7,202
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.

15. ### drkblog Thread Starter Member

Oct 4, 2012
109
0
No. I replied you thinking in the first schematic, because your questions were about it. I tried not to mix them.

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.

Well. I kinda knew I wasn't doing the right thing there I was just hoping I was getting near the number.

I don't understand this one.

16. ### WBahn Moderator

Mar 31, 2012
23,549
7,202
Very reasonable thing to do.

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: Oct 17, 2013
17. ### drkblog Thread Starter Member

Oct 4, 2012
109
0
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

18. ### WBahn Moderator

Mar 31, 2012
23,549
7,202
Assuming a red LED, I think this should work fine for you. (Famous last words?)

drkblog likes this.
19. ### Austin Clark Active Member

Dec 28, 2011
412
47
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.

drkblog likes this.

Oct 4, 2012
109
0
It works!