Electronic – Building AND/OR/NOT gates from NAND

logic-gatesnand

I am trying to build three circuits, an AND, a OR and a NOT gate for a personal side project.

I think I have the logic part down right, i.e. using the following gate logic:

schematic

simulate this circuit – Schematic created using CircuitLab

I'm building this by connecting two switches and a led to a 4011 Integrated Circuit. I'm powering this with an Arduino (5V) or battery (6V).

Here is the newbie question. The behavior of the IC is …inconsistent once I try to cross connect any pins In order to use more than one gate (e.g. to build the AND gate)

What resistors do I need to insert in this circuit to make it work properly? How do I calculate their value? Or is it simply a case that I can't use the IC like this?

Best Answer

CMOS parts like the 4011 have a very high input impedance and will have a random value if left unconnected.

If you are connecting your switches between an input pin and the positive supply, you need a pull-down resistor (10K or so will do) to ensure that the input will be low when the switch is open. If your switches are between the input pin and ground, use a pull-up to the positive supply to make the inputs High when the switch is open.

Also, any unused inputs must be connected to either the positive supply or ground to ensure they don't sit at a "maybe" state and cause the input circuit of the gate to draw excessive current.

You don't need any resistors between the gates.

As one comment says, it is good practice to have 0.1 uF bypass capacitors between the power supply and ground at each IC - more important with flip-flops and other clocked logic than with simple gates, but it is good to get in the habit...

schematic

simulate this circuit – Schematic created using CircuitLab

Related Topic