# How to make a NAND Gate?

Im using 123d circuits by Autodesk and I am trying to make a NAND logic gate.

When i simulate my circuit (one in picture) it does not work and the LED does not turn on. I am using 2 NPN transistors, 2 switches and 3 1k resistors. The battery is 9v. Can someone help me find whats wrong with it?

Your circuit is a strange mix of upside-down-ness. Figure 1 shows a more-likely-to-work configuration.

simulate this circuit – Schematic created using CircuitLab

Figure 1. The standard solution to this problem.

A few tips:

• Draw your schematics with positive rail on top and negative at the bottom. It will be easier to trace current flow from top to bottom.
• Draw inputs on the left and outputs on the right. (You did this.)
• Add a ground symbol somewhere. Even if not connected to the Earth it provides a reference for all measurements taken on the circuit.
• It's not clear from your comment whether you think I stole your answer or you are genuinely grateful. If the former then I can assure you that the idea wasn't stolen as the same AND gate design question has come up several times in the past few weeks. I think visually and find the schematics say far more than text can, are less ambiguous and intelligible to those with weak English. I try to add an illustration to all my answers if I think one will help. We complain when there are no schematics in the questions so I feel it's only right that we add them to our answers. Jul 4, 2016 at 12:58
• Agree. I didn't spend the time to draw a schematic, and they do make things more clear. And I haven't read the other questions, so wouldn't know about other answers. Jul 4, 2016 at 14:09

The battery and diode polarity are opposite to what is required using NPN transistors. With an NPN transistor, the base and collector need to be +ve wrt the emitter for collector to emitter current to flow.

If you substitute PNP transistors, I think the circuit might work.

• I do not think it can work just swapping parts, topology is not right. Jul 2, 2016 at 17:39
• I had to "bend" the circuit a bit to think about it too. If you redraw the circuit with the +ve battery terminal at ground, you will see the diode is in the emitter to ground leg of the transistor totem. I think the topology is OK, just the polarities are wrong. Jul 2, 2016 at 17:42
• for some reason I assumed the pnp emitters would have gone in place of the npn collectors, which won't work. thanks for the clarification Jul 2, 2016 at 17:44
• I'm confused, Does electricity flow from negative to positive or vice versa? Jul 2, 2016 at 18:34
• That's a more complicated question that generally appreciated….Electrons (which constitute electricity in most cases, and certainly in conductive metal wires) flow from negative to positive. In semiconductors we also talk about "holes", which is really a place where an electron could be, but isn't. Holes have a positive charge, and flow from positive to negative, but only in a semiconductor. In an ionic solution, both positive and negative ions can exist, and flow in opposite directions. Jul 2, 2016 at 18:41