How Electronic Gates Work

by Marshall Brain

If you have read the HowStuffWorks article on Boolean logic, then you know that digital devices depend on Boolean gates. You also know from that article that one way to implement gates involves relays. However, no modern computer uses relays -- it uses "chips."

What if you want to experiment with Boolean gates and chips? What if you would like to build your own digital devices? It turns out that it is not that difficult. In this article, you will see how you can experiment with all of the gates discussed in the Boolean logic article. We will talk about where you can get parts, how you can wire them together, and how you can see what they are doing. In the process, you will open the door to a whole new universe of technology.

Setting the Stage
In the article How Boolean Logic Works, we looked at seven fundamental gates. These gates are the building blocks of all digital devices. We also saw how to combine these gates together into higher-level functions, such as full adders. If you would like to experiment with these gates so you can try things out yourself, the easiest way to do it is to purchase something called TTL chips and quickly wire circuits together on a device called a solderless breadboard. Let's talk a little bit about the technology and the process so you can actually try it out! If you look back at the history of computer technology, you find that all computers are designed around Boolean gates. The technologies used to implement those gates, however, have changed dramatically over the years. The very first electronic gates were created using relays. These gates were slow and bulky. Vacuum tubes replaced relays. Tubes were much faster but they were just as bulky, and they were also plagued by the problem that tubes burn out (like light bulbs). Once transistors were perfected (transistors were invented in 1947), computers started using gates made from discrete transistors. Transistors had many advantages: high reliability, low power consumption and small size compared to tubes or relays. These transistors were discrete devices, meaning that each transistor was a separate device. Each one came in a little metal can about the size of a pea with three wires attached to it. It might take three or four transistors and several resistors and diodes to create a gate.

There are perhaps 100 different SSI and MSI chips in the series. ranging from simple AND gates up to complete ALUs (arithmetic logic units). and current chips can contain up to 20 million transistors. These chips shrank the size of computers by a factor of about 100 and made them much easier to build. Then LSI (large scale integration) allowed designers to fit all of the components of a simple microprocessor onto a single chip. The first Pentium processor was released in 1993 with 3. You can build anything you want with them. This led to MSI (medium scale integration) chips containing simple components. An SSI IC typically consists of a 3-mm-square chip of silicon on which perhaps 20 transistors and various other components have been etched." This discovery gave rise to SSI (small scale integration) ICs. 20 or 24 little metal leads protruding from it to provide connections to the gates inside. was the first commercially successful single-chip microprocessor. As chip manufacturing techniques improved. The 8080 processor. such as full adders. made up of multiple gates. resistors and diodes could be manufactured together on silicon "chips. The breadboard lets you wire things together simply by plugging pieces of wire into connection holes on the board. A solderless breadboard . It was an LSI chip that contained 4. A typical chip might contain four or six individual gates. a DIP is a small plastic package with 14. Transistors. named for the specific wiring of gates on the IC). one gate at a time. As pictured on the right. The 7400-series chips are housed in DIPs (dual inline packages). called the 7400 series. The easiest way to construct something from these gates is to place the chips on a solderless breadboard.2 million transistors. released by Intel in 1974.800 transistors. integrated circuits (ICs) were invented. 16.In the early 1960s. The specific ICs we will use are of a family called TTL (Transistor Transistor Logic. we are going to go back in time a bit and use SSI ICs. These chips are still widely available and are extremely reliable and inexpensive. more and more transistors could be etched onto a single chip. VLSI (very large scale integration) has steadily increased the number of transistors ever since. In order to experiment with gates. The chips we will use are from the most common TTL series.

• Of the parts described above. The chips are fairly particular about this voltage. regulated 5volt power supply whenever working with TTL chips. you must have several pieces of equipment. Therefore. Assembling Your Equipment In order to play with TTL gates. such as the 4000 series of CMOS chips. but you can do the same thing with an LED. CMOS chips have the additional advantage that they use much less power. all are easy except the 5-volt power supply. You therefore have two choices. If you fail to use the resistors. they are very sensitive to static electricity. You use LEDs to see the output of a gate. Radio Shack . • An LED (light emitting diode) is a mini light bulb. we will stick with TTL here. A resistor and an LED This equipment is not the sort of stuff you are going to find at the corner store. You can either buy a surplus power supply from Jameco (for something like a video game) and use the 5-volt supply from it.All electronic gates need a source of electrical power. TTL gates use 5 volts for operation. You have a few choices when trying to purchase the components listed above: • 1. it is not hard to obtain these parts. Let's walk through a few details on these parts to make you more familiar with them: As described on the previous page. so we will want to use a clean. We will talk through both options below. or you can use a little power-cube transformer and then build the regulator yourself. a breadboard is a device that makes it easy to wire up your circuits. Certain other chip families. • The logic probe is optional. However. • A volt-ohm meter lets you measure voltage and current easily. No one seems to sell a simple. depending on where you get them. Here's a list of what you will need to purchase: • • • • • • • • A breadboard A volt-ohm meter (also known as a multimeter) A logic probe (optional) A regulated 5-volt power supply A collection of TTL chips to experiment with Several LEDs (light emitting diodes) to see outputs of the gates Several resistors for the LEDs Some wire (20 to 28 gauge) to hook things together These parts together might cost between $40 and $60 or so. However. We will use it to make sure that our power supply is producing the right voltage. are far less particular about the voltages they use. the LEDs will burn out immediately. and that makes them less reliable unless you have a static-free environment to work in. cheap 5-volt regulated power supply. It makes it easy to test the state (1 or 0) of a wire. • We will use the resistors to protect the LEDs.

(Be sure to download their PDF catalog or get a paper catalog from them -. 300ma) 7805 5-volt voltage regulator (TO-220 case) 2 470-microfarad electrolytic capacitors Jameco # 149964 51262 93817 Notes • • • *Jameco also has "assorted LEDs" (or grab bags) that are much cheaper on a perLED basis. has a good inventory and good prices. You will also need a pair of wire cutters and wire strippers. If you are shopping at Jameco. If you can find a good surplus store in your area that caters to people building their own stuff. Look around and see what's available. you may want to get two or three of each chip just in case -. but having the proper tool makes it easier. A local electronics parts store .Most major cities have electronics parts stores. You might also want to purchase an extra 7805 or two. You can get .2.Jameco has been in business for decades. then you have found a goldmine. This is one place where a surplus electronics shop will have much better prices. with Jameco part numbers listed.) The following table shows you what you need to buy. 3. you can use scissors and your fingernails.they only cost about 30 cents each. and many cities are blessed with good surplus electronics stores. In a pinch. A mail-order house like Jameco .it makes it much easier to traverse the Web site. Part Breadboard Volt-ohm meter Logic probe (optional) Regulated 5-volt power supply 7400 (NAND gates) 7402 (NOR gates) 7404 (NOT gates) 7408 (AND gates) 7432 (OR gates) 7486 (XOR gates) 5 to 10 LEDs 5 to 10 330-ohm resistors Wire (20 to 28 gauge) Jameco # 20722 119212 149930 See below 48979 49015 49040 49146 50235 50665 94529* 30867 36767 For the Power Supply (optional) (See next section for details) Part Transformer (7 to 12 volts.

Note that: • • • The transformer MUST produce DC voltage. and is probably the easiest path. you will find that they have about 20 different surplus power supplies like this. You need 5 volts at at least 0. That will work fine. Now plug the transformer in (once it is plugged in. Hook the black and red leads of the volt meter up to the transformer's wires randomly and see if the voltage measured is positive or negative. I also find that a small pair of needle nose pliers is helpful at times. You may have an old one lying around that you can use -. Radio Shack. If you look in the Jameco catalog.wire cutters and wire strippers at Jameco. Your alternative is to build a 5-volt supply from a little power-cube transformer. Now you know that the wire to which the black lead is attached is the negative (ground) wire. This is a 5-volt power supply from an old Atari video game. You want to make sure that the transformer is producing approximately the stated voltage (it may be high by as much as a factor of two -. If it is negative. One option you have is to buy from Jameco something like part number 116089.1 amps) or more. you need three parts: • • A 7805 5-volt voltage regulator in a TO-220 case (Radio Shack part number 276-1770) Two electrolytic capacitors. As mentioned previously. What you need is a transformer that produces 7 to 12 DC volts at 100 milliamps or more. Jameco has a 7. reverse the leads. Strip about a centimeter of insulation off both wires. The first capacitor takes out any ripple coming from the An electrolytic capacitor . It MUST produce 100 milliamps (0. neither Radio Shack nor Jameco seem to offer a standard. so you also want to determine which wire is the negative and which is the positive. so do not purchase more power supply than you need. Your transformer is acting like a battery for you. If not.that is okay). Radio Shack sells a 9-volt 300-milliamp transformer (part number 273-1455). then cut off the connector and get access to the 5-volt and ground wires. Building the Regulator To build the regulator. producing all sorts of voltages and amperages.5-volt 300-milliamp model (part number 149964). The Power Supply You will definitely need a regulated 5-volt power supply to work with TTL chips. while the other is the positive wire. It MUST produce 7 to 12 volts. Clip the connector off the transformer and separate the two wires.3 amps (300 milliamps) -. What you can do is buy the power the imprint on the cover and make sure it meets all three requirements. inexpensive 5-volt regulated power need no more than 2 amps. you can purchase a transformer from Radio Shack or Jameco.000 microfarads (typical Radio Shack part number 272-958) The 7805 takes in a voltage between 7 and 30 volts and regulates it down to exactly 5 volts. and tons of other places. NEVER let the two wires from the transformer touch one another or you are likely to burn out the transformer and ruin it). anywhere between 100 and 1. Wal-mart. Use your volt meter (see below) to measure the voltage. You can use your volt meter (see below) to make sure the power supply produces the voltage you need.

The 7805 has three leads. You need to make sure you get the polarity right when you install the capacitor. input voltage (7 to 30 volts). and the second capacitor acts as a load balancer to ensure consistent output from the 7805. You can build this regulator on your breadboard. To connect the regulator to the transformer. The following figure shows you the wiring: . the three leads are. you need to understand how a breadboard is internally wired. The "+" sign indicates that electrolytic capacitors are polarized: There is a positive and a negative terminal on an electrolytic capacitor (one of which will be marked).transformer so that the 7805 is receiving a smooth input voltage. and output voltage (5 volts). To do this. ground. If you look at the 7805 from the front (the side with printing on it). you can use this configuration: The two capacitors are represented by parallel lines. from left to right.

6. Connect the ground wire of the transformer to one of the long outer strips on the breadboard. Connect ground from the terminal strip to the middle lead of the 7805 with a wire -simply cut a short piece of wire. 5. the meter measures resistance. and then stick wires at different points in the breadboard (the test leads for the meter are likely too thick to fit in the breadboard's holes). Down the center of the board is a channel.On the outer edges of the breadboard are two lines of terminals running the length of the board. All of these terminals are internally connected. Connect the positive wire from the transformer to the left lead (input) of the 7805. strip off both ends and plug them in. 7. Typically. Connect a capacitor from the left lead of the 7805 to ground. On either side of the channel are sets of five interconnected terminals. It might look like this when you are done (two views): . Another way to see the connections is to pull back the sticker on the back of the breadboard a bit and see the metal connectors. In the ohm setting. You can use your volt-ohm meter to see the interconnections. Connect the 5-volt lead of 7805 to the other long outer terminal strip on the breadboard. Connect the second capacitor between the 5-volt and ground strips. 3. Resistance will be zero if there is a connection between two points (touch the leads together to see this). and infinite if there is no connection (hold the leads apart to see this). You will find that points on the board really are interconnected as shown in the diagram. Plug the 7805 into three of the five-hole rows. 2. Now connect the parts for your regulator: 1. You have created your regulator. 4. paying attention to the polarity. Set the meter's dial to its ohm setting. you run +5 volts down one of them and ground down the other.

. it is likely the 7805 is very hot. Plug the transformer back in for a moment and see if that changed anything. If you do not. Make sure the ground wire and positive wire from the transformer are not reversed (if they are." Plug in the transformer and measure the input and output voltage of the 7805. and lets you know when the power supply is "on. Make sure the transformer is producing any voltage at all by disconnecting it and checking it with your volt meter. through the resistor.In both of the above figures. The LED connects between the +5 and ground strips. You should see exactly 5 volts coming out of the 7805. the lines from the transformer come in from the left. The left capacitor filters the transformer voltage. while the right capacitor filters the +5 volts produced by the 7805. See the previous page to learn how to do this. You can see the ground line of the transformer connected directly into the ground strip running the length of the board at the bottom. and possibly fried). then immediately disconnect the transformer and do the following: • • • Pull out the capacitors. and whatever voltage your transformer delivers going in. The top strip supplies +5 volts and is connected directly to the +5 pin of the 7805.

you can test it further and see that it is on by connecting an LED to it. things look like this: . Now we can experiment with Boolean gates! Playing with Boolean Gates If you used the table on the previous page to order your parts. have a polarity. try reversing the leads and see if that helps. so if your LED does not light. You must use the resistor or the LED will burn out immediately. It might seem like we've had to go to a tremendous amount of trouble just to get the power supply wired up and working. LEDs. although anything between 200 and 500 ohms will work fine.XOR (four gates per chip) Inside the chips.OR (four gates per chip) 7486 . A good value for the resistor is 330 ohms.NAND (four gates per chip) 7402 .NOR (four gates per chip) 7404 . being diodes.NOT (six gates per chip) 7408 .AND (four gates per chip) 7432 . you should have six different chips containing six different types of gates: • • • • • • 7400 . But you've learned a couple of things in the process.Once you see 5 volts coming out of the regulator. You need to connect an LED and a resistor in series -something that is easy to do on your breadboard.

+5 represents a binary "1" and ground represents a binary "0. So the LED . Here is what is happening. The LED should light. reverse the LED so it lights. If you happen to burn a chip out accidentally. The resistor leaves pin 3 and connects to the LED. there will normally be a dot at pin 1. the chip is receiving +5 volts on pin 14 (red wire) and ground on pin 7 (black wire). which is also connected to ground.Let's start with a 7408 AND chip. If you look at the chip. it "floats high. So the AND gate should be seeing 1s on both the A and B inputs. pin 7 must connect to ground and pin 14 must connect to +5 volts. or some other marking to indicate pin 1. So connect those two pins appropriately.) Now connect an LED and resistor between pin 3 of the chip and ground. Your IC should look like this: In this figure. If not. In TTL. (If you connect them backward you will burn the chip out." meaning the gate makes an assumption that there is a 1 on the pin." If an input pin to a gate is not connected to anything. Connect wires from +5 and ground to the gate's A and B inputs to exercise the gate. throw it away so you do not confuse it with your good parts. You can see from the diagrams that on all chips. meaning that the output at pin 3 is delivering 5 volts. or an indentation at the pin 1 end of the chip. Push the chip into the breadboard so it straddles the center channel. so don't connect them backward.

You will be AMAZED at what you can create with just a few ICs and some creativity." "V. However. Curt Reeder The books at Radio Shack with part numbers ranging from 62-5010 to 62-5026 These books are very inexpensive and have a large number of circuits to try out and play with. Bergquist.on my meter. 250 volts and 1. Build It! In theory. There will usually be multiple voltage ranges available in this section -. here are the steps to get ready to measure a battery's voltage: 1. it is often more convenient to use larger-scale devices so that you don't have to combine 50 chips to build something common like an ALU. 3." "Gnd" or "-" (minus).complete data on all TTL chips (also available from Jameco) IC Projects. you now have the fundamental knowledge you need to build any digital device. If you would like to work on a bigger project. as described in How Boolean Logic Works. from Texas Instruments . This is the standard behavior for an AND gate. For example. find a AA. 50 volts. You can take the basic gates discussed in this article and construct anything. What we want to do with the meter right now is learn how to measure voltage. or the Q bit of the full adder. wire up the XOR gate." "Pos" or "+" (plus). Take your red test lead and insert it in the hole marked (depends on the meter) "Volts.000 volts (fancy auto-ranging meters may set the range for you automatically). Take your black test lead and insert it in the hole marked (depends on the meter) "Common. Have fun with it! For more information on electronic gates and related topics. Your ." "Com. It is also helpful to see examples of different ways to combine gates to create complicated systems. Then try wiring up something more complicated. one black and one red. check out the links on the next page. Every meter is different. It has two "leads" (wires). C or D battery to play with (not a dead one).a great introductory book full of information and ideas TTL Logic Data Book. To do this. Turn the dial to the "DC Volts" section. the following books will be helpful: • • • • TTL Cookbook. We will use it as a voltage source.lights. Some meters have multiple holes for the red lead -. current and resistance. If you ground either pin 1 or 2 or both on the chip.5 volts. Using a Volt-Ohm Meter A volt-ohm meter (multimeter) measures voltage. by Carl J. the LED will extinguish. but in general. If you want to learn more about TTL devices. and see that they behave as expected. Try out the other gates by connecting them on your breadboard and see that they all behave according to the logic tables in the Boolean logic article. by Don Lancaster . the ranges are 2.make sure you use the one for volts. 2. you can try building the digital clock described in How Digital Clocks Work." "Ground.

The meter should read 5 volts. Change the voltage range if necessary and then connect the black lead to ground and the red lead to what you presume to be the positive 5-volt wire. that is 2.25 volts.5 volts. It is important that you hook the black lead up to negative and the red lead up to positive and stay in the habit of doing that.meter will have similar ranges. as well.25 volts. . In my case. so find the closest voltage greater than 1. Now. hold the black lead to the negative terminal of the battery and the red lead to the positive terminal. You should be able to read something close to 1.25 volts off the meter. Now you can use the meter to test your power supply. The battery will have a voltage of 1.