# Help with design of BJT logic gates

#### Ron Watkins

Joined Jun 5, 2018
47
Im trying to build some BJT logic gates and have opted to use the 2N2222 transistor and a 12V power source.
Im looking for how to size the current limiting resistors to achieve both cut-off and saturation cleanly.
Im not clear on how to achieve the base current and drive the collector current.

Joined Mar 10, 2018
4,057
Several videos, google "logic gates using transistors"

Regards, Dana.

#### Ron Watkins

Joined Jun 5, 2018
47
Been watching a bunch, but still not sure how the math works out exactly.
I need to see how to compute the correct base resistor. Datasheet is a bit confusing to me, not sure exactly how much I(b) I need for saturation.
Not sure how to tell what I need exactly.
May be part of my issue is im looking for 12V Vcc

#### Alec_t

Joined Sep 17, 2013
11,277
Choose a collector current (arbitrary). Divide by 10. Use that as the base current.

#### Ron Watkins

Joined Jun 5, 2018
47
Choose a collector current (arbitrary). Divide by 10. Use that as the base current.
I looked at the datasheet. Im a bit concerned about the Vbe which is stated to be 6V max.
The input will swing from ground to 12V, which is twice this limit, is that going to be an issue?

#### Ron Watkins

Joined Jun 5, 2018
47
https://www.onsemi.com/pub/Collateral/P2N2222A-D.PDF

If you understand how transistors work, study figure 4, collector saturation region.

Can you relate to that graph?
Vce will be 12V, which is off the chart, however since it's nearly vertical, im assuming that I need 0.007ma to make it turn on?
So, if I take 12V/0.000,007A I get 1.7Mohm for Rb? So, with 12V input it will turn on and when it get's to 0V it will turn off?

#### dl324

Joined Mar 30, 2015
10,734
I looked at the datasheet. Im a bit concerned about the Vbe which is stated to be 6V max.
The input will swing from ground to 12V, which is twice this limit, is that going to be an issue?
That has to be the reverse breakdown voltage for the BE junction. It shouldn't be a factor.

#### crutschow

Joined Mar 14, 2008
24,949
Vce will be 12V, which is off the chart, however since it's nearly vertical, im assuming that I need 0.007ma to make it turn on?
You are going in the wrong direction.
12V is the OFF collector voltage.
You need to look at the ON collector voltage, which you want to be a minimum (at the bottom of the chart).
That means the base current should be about 5-10% of the collector current.

So to determine the base current and the base resistor to provide that current, you need to know the collector ON collector current, which is determined by the collector resistor.

#### Alec_t

Joined Sep 17, 2013
11,277
The input will swing from ground to 12V, which is twice this limit, is that going to be an issue?
You don't connect the 12V (or whatever) input voltage directly to the transistor base; you use a series resistor. The transistor needs a Vbe of about 0.7V to turn on, so the base current will then be (Vinput - 0.7V)/R, where R is the series resistor value.
The 6V limit you are referring to is Vemitter-base (Veb), not Vbase-emitter (Vbe). In other words the base must never be driven more than 6V below the emitter voltage or there will be reverse-voltage breakdown of the transistor junction.

#### MrChips

Joined Oct 2, 2009
21,091
Don't overthink the problem.

1) Select the collector current and calculate the collector load resistance.
For example, if collector current is 1mA, R = 12V / 1mA = 12kΩ

2) Base current = Collector current / 10 = 0.1mA
Hence, approximately R = 12V / 0.1mA = 120kΩ

#### Bordodynov

Joined May 20, 2015
2,600

#### Ron Watkins

Joined Jun 5, 2018
47
Don't overthink the problem.

1) Select the collector current and calculate the collector load resistance.
For example, if collector current is 1mA, R = 12V / 1mA = 12kΩ

2) Base current = Collector current / 10 = 0.1mA
Hence, approximately R = 12V / 0.1mA = 120kΩ
Ok, the datasheet I have sais that the collector current should be 600ma, so that would be a 20ohm collector resistor, correct?
And that should map to a 200ohm base resistor?

#### crutschow

Joined Mar 14, 2008
24,949
the datasheet I have sais that the collector current should be 600ma
No, it doesn't say that.
600mA is the maximum (not to exceed) collector current rating.
If you operated at that current, each transistor stage would dissipate 7.2W of power when on, and your circuit would make a nice heater.
You want to operate at a much lower collector current (likely 1 mA or less depending on the maximum operating frequency you want) to minimize power.

#### Ron Watkins

Joined Jun 5, 2018
47
Where can I find out how much base current is needed to turn the resistor from non conducting to saturated? If I know that base current, I can use the 10x multiplier to get the collector current. Is there a specific symbol im looknig for in the datasheet for what base current will saturate the transistor?

#### Alec_t

Joined Sep 17, 2013
11,277
If I know that base current, I can use the 10x multiplier to get the collector current.
No. Do it the other way round. Start with the collector current (say 1mA) and divide by 10 to get the base current.

#### dl324

Joined Mar 30, 2015
10,734
If I know that base current, I can use the 10x multiplier to get the collector current.
One of your early considerations should be the fanout you want your gates to have. Then you can select a collector current and, from that, calculate an appropriate base current.

After 16 posts in this thread, there's still no schematic from you.

When I designed some discrete gates, I chose to use NAND gates (DTL to be specific).

#### crutschow

Joined Mar 14, 2008
24,949
Is there a specific symbol im looknig for in the datasheet for what base current will saturate the transistor?
No symbol.
You just look for the base current they used for the Vce saturation test conditions.
Typically the base current is 1/10th the collector current.
So if you have a collector current of 1mA, the base current should be 100μA.
If you wanted to save a little current (with a slightly higher Vce saturation voltage), you could use 1/20th of the collector current or 50μA.

#### Ron Watkins

Joined Jun 5, 2018
47
One of your early considerations should be the fanout you want your gates to have. Then you can select a collector current and, from that, calculate an appropriate base current.

After 16 posts in this thread, there's still no schematic from you.

When I designed some discrete gates, I chose to use NAND gates (DTL to be specific).
Sorry, wsan't aware anyone was looking for a schematic. I have seen a bunch of generic ones on the web, but notably they are all lacking in specific resistor values... Ill attach a picture here of what I am thinking about.

#### Audioguru

Joined Dec 20, 2007
11,249
The graphs on datasheets are for a "typical" transistor that is kept with its chip at 25 degrees C for a moment before it heats up. But transistors are made with a spread of spec's from minimum to maximum. You get whatever they have.
You should design for "worst case" so that every circuit you make works, not just the ones that have typical or better specs (you cannot buy) for only a moment with the chip at 25 degrees C.