Have you ever seen the diagrams from textbooks or datasheets describing the internal workings of and NAND IC and wanted to make one out of discrete components, but then think it was too hard or complicated? Well it isn’t, with a little knowledge of electronics you can make your you discrete NAND logic.
The NAND gate is one of the universal bulding blocks used to build complex systems like computers.
|A||B||A NAND B|
I will not go in to the details of how to solder (or use a prototyping bradboard) and assume you know how to read simple electronic circuit diagrams.
If you don’t remember what the logic input and output of a NAND gate are, if you you are totally confused the folowing Wikipedia page for more background information on NAND Gates.
There are many ways to implement logic but one very popular way is using TTL logic. There are other types of ways to implment logic such as the more modern CMOS and the ancient DTL, but the TTL can be implemented with common inespensive parts using 5 volts.
74 series TTL (Transister Transitor Logic) integrated ICs are quite dated but are still used by electronics hobbyist.
This is what a TTL quad (ie contains 4) NAND gate package looks like:
And this is standard diagram of the internals of a single NAND gate inside such a package.
Almost any small signal diodes and NPN transistors can be used. Also note the resistor values don’t have to be exact as real versions of this logic gate are implented with different resistor values to increase the switching speed or reducing power consumption. Once you have implented one you may want to do further research to look at more refined versions.
Of course the above structures are etched in to silicon and that would be way to expensive to do at home. We are going to do it with discrete BJTs (bipolar junction transistors) that look like this:
One of the first problems you will run in to is inout transistor Q1, which is a multiple emitter transistor which you can’t get as a discrete component. Although they are easy to make when working directly on the silicon they don’t make sense when working with discrete components.
To implement the TTL NAND gate you can replace the Q1 transistor with two seperate transistors QA and QB, and just join both their base leads together and also join both their colector leads together. In prinicple it is aslo possible to extend this and add extra input transistors along with a diode to extend this to make a three or four input NAND gate. The reverse is also true. If you want to convert the NAND gate in to a NOT gate, you can just remove transistor QB and diode D2!
In the Discrete NAND diagram I have added an LED (D4) to show the output. For inputs A and B you either connect them to ground (logic 0) or to +5V (logic 1). You will need to do further reading elsewhere for a more precise description of the TTL logic levels. TTL inputs behave like a logic level 1 when left floating (not connected to eitehr ground or +5Volts) but I can’t gaurentee this will always be the case in this discrete version and it may be best to connect them high to make sure they work as expected.
I was able connect the descrete NAND circuit to switches (not shown in the circuit diagram) through some low value pull down resistors when not active but high when pressed.
I hope this dispells some fears that basic logic used in computers on the tiny scale today cannot be understood or implemented using simple discrete components.