Thursday, January 29, 2015

@MAKE Electronics Experiment 19 - logic chips (Part I)

There is not much to Experiment 19, but it's still really neat.

This is the first use of logic chips, and Charles is just introducing the concept. In this experiment, we use a 74HC00 quad 2-input NAND chip and a 74HC08 quad 2-input AND chip.  My 08s have not arrived from China yet, so Part I deals with the 00.

Logic chips use Boolean logic, taking False as 0 and True as 1.  Since there are two inputs, the Boolean operation yield an off or on (logic LOW or logic HIGH) condition.

The 00 applies a NAND, or negative and, operation on the two inputs.  This means that it's the opposite of an AND operation, in which both inputs must be true (or on or HIGH) to yield a true (or on or HIGH) output.  The negative of that means that NAND yields a true (or on or HIGH) result unless bioth inputs are true (or on or HIGH).

Here's a truth table (T=true or on or HIGH, F=false or off or LOW):

input1     input2   AND  NAND
  F             F            F          T
  F             T            F          T
  T             F            F          T
  T             T            T          F

In the experiment, we first have to supply 5V, regulated, to the chip.  We take the 9V input (in my case from a Compact Switching Power Supply - Selectable Output 3-12VDC from Adafruit), through a 7805 voltage regulator and 2 capacitors to smooth it out. The output of the 7805 (4.95V by my meter) supplied the chip. Charles calls for a 33uF capacitor, but I only have 22s and 47s, so I used a 47.

The circuit only used one of the 4 gates. 74HC00 is a 14-pin chip.  Pins 1, 4, 9, and 12 are input1. Pints 2, 5, 10, and 13 are input2.  3, 6, 8, and 11 are the outputs from the corresponding inputs. 14 is power and 7 is GND. Gate 1 is pins 1 and 2 with output on pin 3.  All other input pins are tied to GND (LOW), and the other 3 outputs are floating.

The inputs 1 and 2 (pins 1 and 2) are connected to power through a normally open momentary switch., with 10K pull-down resistors connected to GND. Output (pin 3) is connected to a low-current LED, which is connected to a 1K resistor to GND. Each input is LOW unless the button it is connected to is pushed, closing the connection to power and taking it HIGH.

Here's the schematic and breadboard layout:

Figure 4-46
Figure 4-47

Both figures are from Charles Platt, Make: Electronics, First Edition, Maker Media, Inc., 2009, p. 182.

Both inputs are LOW on power up. Pressing a button takes its input HIGH. Referring to the truth table above, we expect the LED will light unless both inputs are HIGH. This is in fact what happens: when the power is connected, the LED is on and stays on unless both buttons are pushed. See the video here.