# Creating a Logic Gates

Background

I've arrived to a dilemma in my personal project where I'll need to design a circuit like the following:

The logic makes sense to me, but I found that I am unsure in what nature would it be best for me to implement a gate in my circuits.

Let's take the NOT gates for instance; I thought making a NOT gate would involve one single transistor:

However I read an article that criticizes this approach, saying it is crude. Instead it offers this insane thing:

The article states that it "maximizes voltage gain", but doesn't explain how very well. The article also goes on to explain how the circuit works, which I admit is clever, but I don't see the advantage of this over the single transistor method. The above circuit also seems like overkill. Is the single transistor method no more than an academic exercise?

The Actual Question

What's a real, practical way to implement small logic in circuitry? In the case of the NOT gate, I have the single transistor, multi transistor and IC approach. Integrated circuit inverters however sell only in arrays (that I can find), so this also seems like overkill to me.

To me, the most pragmatic approach is the single transistor, but I'm unsure if this is a correct assumption.

First off - don't believe everything you read - the single transistor may be crude but it works. Where it falls down is that its not particularly fast switching or useful when you come to design integrated circuits. The 'replacement circuit' is the basis of a ttl logic gate. (7400 series) which has subsequently been replaced by CMOS circuitry which at some point in the future will be replaced by something else.

If all you want is a simple (single) NOT gate then the single transistor could be way to go. It all depends on the requirements of your circuit (speed, voltage range, logic levels etc.)

The main problems are;

(1) fanout - how much current can you take from the output without lowering the output voltage too much.

(2) Logic level tolerence (noise margin) - What value of voltage constitutes a '1' or a '0'. In a one transistor circuit anything over 0.6V would be seen as a '1'. The saturation of the transistor may be 0.3V so it doesn't leave much of margin for error.

• Thanks for the insight, I'm working with an old protocol so I'm sure speed won't be a constraint. I liked the single transistor approach because it seemed like a simple yet elegant solution. I will have to make sure that the transistor fits within the logic levels. Commented Jul 27, 2013 at 2:23

Inverters are available in single gate parts. The part numbers often contain "1G04", as in SN74AHC1G04. 1G04's are available in several logic families, including AHC, AUC, and LVC. For TTL levels instead of CMOS levels, I think you want an AHCT1G04. There's also 1G06 for a single inverter with open-drain output, and 1G14 for a single inverter with Schmitt-trigger input.

Generally an IC gate will be cheaper, smaller, and faster than the discrete transistor/resistor solution. The performance parameters will be guaranteed by the datasheet with much less design/analysis work required for the user.

Some cases where you might want to use the discrete implementation:

• You need to have control of the pull-up resistance
• You need to source or sink very high currents (more than the 5-24 mA offered by the standard parts).

Assuming that you refer to the gates in the circuit you show: the best way to implement those is to leave them out.

Option 1: Connect the Dout directly to the gate of the mosfet, and invert the logic within the rest of the circuit (presuming it is a microcontroller). To 'disable' the output, drive the gate low.

Option2: Again asuming you are driving the bus from a microcontroller, just connect the pin directly to the bus, not FET needed, and switch the pin between low (for a low output) and high (for a high or disabled output).

The best solution uses 0 components....

• Option 1 is clever, and it makes me question why the logic gates were needed in the first place. Commented Jul 27, 2013 at 2:26
• Logic gates are not needed here, but they might make the circuit easier to understand. I do Dallas one-wire and I2C from any microcontroller pin that can switch between in and out. Without an external FET. Commented Jul 27, 2013 at 6:37