Digital Electronics for the Beginner

Let’s say you’re a programmer and your experience in digital electronics involves that one class you were required to take in college.  Or…you’re a young person who is interested in learning this cool stuff, because, well… it seems cool.  One option is to buy one of those learning kits and go through the tutorials.  If you’re on a budget, you can start with one of these:

electronic_snap_circuits

I’ve played with this kit myself and I would recommend any parent that wants to introduce their kid to electronics, this is a good buy.  It has a card for each project that explains the circuit as well as the parts used by the circuit.  There are troubleshooting instructions and warnings about how to build a circuit without burning up components.

Let’s pretend that we wanted to just focus on some digital circuits and jump right into integrated circuits.  Here’s a list of what you’ll need to get started:

  1. Breadboard
  2. Power supply
  3. Wire
  4. IC assortment
  5. LEDs
  6. Resistors

Let’s start with the breadboard.  This is a large plastic “board” that has a lot of holes in it.  You use it to plug your wires, IC’s, LEDs and resistors into.  Integrated circuits are rather tiny, so attempting to wire them with alligator clips or twisting wire to the leads is not a good solution.  Radio Shack used to be my go-to place for stuff like breadboards, but they don’t sell much electronic stuff these days (assuming you can find a Radio Shack).  Jameco Electronics is my current go-to place to find anything I need.  Here’s a typical breadboard from Jameco (and a good starter one):

breadboard

If you’re on a really tight budget you can get one of the really small ones for under $5.00:

cheap_breadboard

The small breadboard above will probably fit 3 or 4 integrated circuits.  The Jameco brand one above will hold about 20 ICs.

Next, you’ll need a power supply.  I would recommend sticking to TTL logic circuits since they are more durable than any other integrated circuits (I’ll get to the details of this soon).  So you’ll need a stable 5v power supply to power your circuits.  This is probably the most expensive part.  If you’re comfortable with wiring a plug to a power supply you can go cheap and get something like this (for around $20):

cheap_power_supply

Don’t let the picture fool ya, it has a cover (you can see it in the spec sheet).  For a young adult, I would recommend spending more money and obtain a safer power supply, like this one:

power_supply

This power supply has an adjustable output and costs around $67 at Amazon (click here).

I’m going to ignore the fact that you might need a meter to troubleshoot.  Technically, if you’re building TTL circuits, all you really need is a resistor and an LED.  So you can get a variety pack of resistors at Jameco for around $5 (click here):

resistor_assortment

For a pack of LEDs, I would just by 10 of these, which are about 12 cents each (click here):

led

The last boring component you’ll need is wire.  Just buy a roll of 22-guage solid wire.  Jameco has several colors available in 100 foot rolls for $8 (click here).

Now for the reason you’re doing this, the integrated circuits.  Jameco has some Grab Bags that are cheap, but they contain random TTL circuits and most are not very useful for an experimenter.  They also have component kits that contain known quantities of each type of TTL circuit, but those are really expensive.  So I would recommend buying this variety (filter to the 74LS series, they’re cheaper):

  • 2 inverters (74LS04)
  • 4 NAND gates (74LS00)
  • 2 NOR gates (74LS02)
  • 2 AND gates (74LS08)
  • 2 OR gates (74LS32)

The total for those should be under $6.

Let’s Build a Circuit

OK, you’re first circuit.  Let’s make this as easy as possible.  Here’s a circuit diagram of what we will build:

and_gate_circuit

Basically, it’s just an AND gate with both inputs set to zero and an LED output.  We will be switching our input wires to simulate a 1 or a 0 for inputs and see what the LED does.

Your first step is to install an AND gate (74LS08) into your breadboard.  To do this, you’ll need to identify pin 1.  There is usually a marking at one end of the chip and sometimes a small dot in the upper left corner.  The dot represents pin 1 and you should orient this chip on your breadboard with the dot facing up.  Here’s an example:

chip_inserted

Notice how the IC straddles the groove in the breadboard.  The groove is a break in the contacts formed by the breadboard circuit.  Each line of holes run horizontally.  The numbers you see are the row numbers of each set of holes.  For line 30 (above), there are 5 holes in a horizontal row on the left and 5 holes on the right of the groove that are connected together.  For an in-depth explanation of how breadboards work, I would recommend reading this: How to use a breadboard.  Armed with this knowledge, I’ll continue with the circuit.

Next, you’ll need to go to your favorite search engine and find a tech sheet for the 7408 TTL circuit.  TTL can come in L, S, LS or normal package types.  The circuit number will always be “74” followed by an optional letter or pair of letters and then 2 or 3 digits like “08”.  So a 2-input AND gate can come in packages marked as 74LS08, 74L08, 74S08 or just 7408 (there are other types as well).  The package type is meaningless to this exercise so you can ignore which type of package you own (if you bought from the list above, you’ll have all “LS” type TTL circuits).  You can also ignore anything that comes before the “74”.  These characters represent the manufacturer.  So search the Internet for “TTL 7408” and you’ll stumble onto a PDF like this:

Quadruple 2-input Positive AND Gates

Now that your chip is properly inserted into the breadboard and you have a spec sheet, you’ll need to wire your power.  To form a complete circuit, each chip needs +5 volts and ground (or zero volts).  The spec sheet has a package diagram showing the pins of the chip:

ttl7408spec

You’ll connect your +5 volts to the VCC pin (pin 14) and your ground or zero volts to the GND pin (pin 7).  Your breadboard should have some power runs along the side.  The Jameco board has red and blue stripes next to these power runs.  Connect your positive power supply to the red run and the ground to the blue run.  Then you can connect your chip like this:

power_connected

Next, you can connect an LED to the output.  First, let’s look at the spec sheet again and identify one AND gate that we can use.  If you examine the logic diagram you’ll see how the inputs and outputs of each AND gate is marked:

and_gate_logic_diagram

There are 4 AND gates on this chip, but we only need one.  So we’ll use the first one.  The first AND gate uses inputs 1A and 1B.  The output to this gate is 1Y.  In the pin-out diagram shown earlier, the inputs correspond to pins 1 and 2.  The output is on pin 3.  So let’s insert an LED and connect pin 3 to one side of the LED:

output_connected

LEDs are one-way devices, so when you insert the LED, make sure the long lead is connected to your wire.  If the circuit doesn’t work you can pull out the LED and reverse it.  Inserting an LED in backwards will not hurt anything.

The next step is very important because LEDs are sensitive to too much current.  So we’ll need a resistor to limit how much current is drawn by the LED.  If you don’t use a resistor you’ll hear a popping sound and you might smell something burning.  That would be the end of your LED.  If this happens, just throw it away, turn off your power, correctly wire a resistor (as I’ll describe next) and install a new LED.  As my high-school electronics professor used to say “no-burn, no-learn!”

On the short lead to your LED, connect one side of a 100 ohm resistor and connect the other side of the resistor to the blue bus bar (or ground).  To identify a 100 ohm resistor the colored stripes should be brown-black-brown (ignore the gold or silver stripe):

100_ohm_resistor

Resistors come in a variety of sizes.  To identify resistor sizes, you can go to this excellent website and memorize your color code (and it also includes a color code calculator).  Now your circuit should look something like this:

resistor_wired

Next, connect pins 1 and 2 to ground (or the blue bus):

circuit_done

Now, connect your power supply (plus lead connects to both red buses and the ground lead connects to both blue buses).  Adjust the voltage to +5 volts (if your power supply is adjustable).  Then turn it on… and… nothing happens.  This is the expected output.  So let’s make the LED light.  In order to do that, we’ll need to make both inputs a 1 or +5 volts.  Or do we?

TTL logic is wired in such a way that most circuits will treat an open input as a 1 or high.  So just remove the two input wires.  You can pull those wires while the circuit is on.  Notice how the LED lights up:

circuit_active

If your LED does not light, then you’ll need to troubleshoot.

  • Double-check to make sure all your wires are connected to the right pins.
  • You can see in the picture above that my IC is inserted between rows 56 to 62.  Row 56 on the right side is the positive connection.  Make sure the red bus on the right side is connected to the positive power supply lead.
  • Check the blue bus on the right side to make sure it is connected to ground.  Then check both the blue and red buses on the left, they will also need to be connected to the power supply.
  • Disconnect the wire from pin 3 of your AND gate and connect it right to the red bus.  Did the LED light up?  If not, then you need to check that the LED and resistor are wired correctly.  Maybe the LED is in backwards?
  • Make sure pin 14 (upper right) of your chip is wired to positive power and it is +5 volts.
  • Make sure pin 7 (lower left) is wired to ground (or the blue bus).
  • If the LED lights, but your circuit still doesn’t work, the chip could be bad (not likely, but you never know).  Turn off your power supply, remove the chip from the breadboard and insert another 74LS08 chip.  Make sure the pins are lined up exactly as the previous chip was lined up.

If your circuit is working, then you should experiment with all the combinations of inputs for your AND gate.  There are 4 possible inputs to a digital circuit that has two inputs.  Here’s a truth table of what the 4 inputs are for an AND gate:

and_gate_truth_table

As you can see the circuit will only light if both inputs are a 1 or open.  If either input is a zero, then the light will go off.

The 74LS00 NAND gate can be substituted for your AND gate.  Make sure you turn off your power supply before removing one chip and inserting a new one.  Also be careful to line up the pins the same.

If you successfully tried the NAND gate, the NOR and OR gates are also identically pinned.  The inverter, however, is not.  So don’t attempt to wire the inputs and outputs the same because the inverter only has one input.  So pin 1 is the input and pin 2 is an output.  Feel free to connect the output of your 7404 to the LED (pin 2) and try pin 1 with high and low inputs.

Review

So what did we learn?

  • LEDs will burn out if we don’t limit the current they draw with a resistor.
  • LEDs go one way and the long lead is wired to the positive supply.
  • TTL chips are marked to identify pin 1.
  • TTL logic treats an open input as a 1 or a high.
  • We learned the resistor color code scheme.
  • We learned how to find and read a TTL IC spec sheet.
  • We learned how a breadboard works.
  • We learned how to wire power to a TTL chip.

2 thoughts on “Digital Electronics for the Beginner

Leave a Reply