Chapter 6

Building Projects

IN THIS CHAPTER

check Fleshing out an idea for an electronic project

check Creating a workable circuit design

check Building a prototype on a solderless breadboard

check Creating a permanent circuit on a printed circuit board

check Finishing the project by putting everything into a suitable enclosure

Yogi Berra is alleged to have said, “In theory, there is no difference between theory and practice. But in practice, there is.”

Much of this book is theoretical — how electric current works, how individual electronic components like resistors, capacitors, and transistors work, how digital logic works, and so on.

But the heart of electronics is building things. The reason for learning all the theory is so you can practice the art by actually building circuits and putting them to use.

Throughout this book, I back up theoretical explanations about how various types of electronic components work with simple construction projects you can build to demonstrate the theory in actual use. In this chapter, you learn the basic construction techniques needed to build these projects.

Specifically, you learn how to create a prototype of a circuit using a handy device called a solderless breadboard. Then, you learn several techniques for creating a more permanent version of the circuit, in which the components and all the circuit’s interconnections are soldered together on a circuit board. Finally, you learn how to enclose your circuit board in a project box or other enclosure.

In this chapter, I walk you through the process of building a fairly sophisticated electronics project. Although you’re welcome to do so if you wish, I don’t expect you to actually build the project as you read this chapter. Instead, I simply want you to gain an appreciation for the process of building a nontrivial project from start to finish.

Looking at the Process of Building an Electronic Project

Electronic projects such as the ones you learn about in this book typically follow this predictable sequence of general steps from start to finish:

  1. Decide what you want to build.

    Before you can design or build an electronic project, you must have a solid idea in mind for what you expect the project to do, what you want it to look like, and how human beings will interact with it.

  2. Design the circuit.

    Once you’ve settled on what you want to build, you need to design an electronic circuit that gets the job done. The end result of this step is a schematic diagram.

  3. Build a prototype.

    Before you invest the time and materials needed to build a permanent circuit, it’s a good idea to first build a prototype, which lets you quickly test the circuit to make sure it works. Usually, you build the prototype on a solderless breadboard.

  4. Build a permanent circuit.

    Once your prototype is working, you can build a permanent version of the circuit. Usually, you build the permanent version by soldering components onto a printed circuit board.

  5. Finish the project.

    To finish the project, you mount the circuit board along with any other necessary components such as batteries, switches, or light-emitting diodes in a suitable enclosure.

The remaining sections in this chapter describe each of these steps in greater detail.

Envisioning Your Project

Before you get lost in the details of designing and building your project, you should step back and look at the big picture. First, you need to make sure you have a solid idea for your project. Why do you want to build it? What will it do, who will use it, and why?

For example, every year I like to build something to scare trick-or-treaters on Halloween. A few years ago, I built a giant jack-in-the-box that pops up and screams when people walk up to it. The box was made of plywood, and the pop-up mechanism that made the door open and the scary clown pop up was driven by compressed air. Figure 6-1 shows the finished contraption. Trust me; I scared a lot of kids and more than a few adults with it.

image

FIGURE 6-1: One of my scarier electronics projects.

I knew right away that I’d need some type of electronic circuit to control the jack-in-the-box. At first, I wasn’t sure exactly what type of circuit I’d need, but I knew I needed a circuit of some kind.

Once you have a general idea for a project, you can flesh out the details. You’ll need to answer questions like these:

The jack-in-the-box Halloween prop is a fairly complicated project — too complicated to use as an illustration this early in the book. So, here’s a simpler project: an electronic decision maker. Have you ever resorted to tossing a coin to make a difficult decision? For this project, you create an electronic version of a coin toss. Instead of flipping a coin into the air to see if it lands heads or tails, you build an electronic device that does the coin toss. That way, you can make decisions even when you’re penniless.

The specifications for the coin-toss project are as follows:

tip As you flesh out the details for your project, you may want to start drawing diagrams to show how it will look. Figure 6-2 shows a hand-drawn sketch I created for the electronic coin tosser.

image

FIGURE 6-2: A hand-drawn sketch for an electronic coin tosser.

Designing Your Circuit

Once you have an idea for a project, the next step is to design a circuit that meets the project’s needs. At first, you’ll find it very difficult to design your own circuits, so you’ll turn to books like this one or to the Internet to find other people’s circuit designs. With a bit of Google searching, you can probably find a schematic diagram that’s very close to what your project needs.

In many cases, you won’t be able to find exactly the circuit you’re looking for. You may find a circuit that’s close, but you may need to make minor modifications to make the circuit fit your project’s needs. At first, making modifications to a circuit may seem beyond your abilities. But as you gain experience, you’ll find yourself tweaking circuits all the time to fit specific applications.

One helpful strategy for designing circuits is to break complex requirements down into simpler parts. For example, consider the pop-up jack-in-the-box Halloween prop I mention earlier. The complete circuit for this project required several different elements, including these:

The coin-toss project is much simpler than the jack-in-the-box project. In fact, a quick Google search will turn up several possible circuits that do almost exactly what the coin-toss project requires. For example, Figure 6-3 shows the schematic diagram for a typical coin-toss circuit you might find on the Internet. This circuit diagram uses a 555 Timer integrated circuit, four resistors, two LEDs, one capacitor, a switch, and a 9 V power supply (most likely a 9 V battery).

image

FIGURE 6-3: A schematic diagram for a simple coin-toss circuit.

The schematic diagram shown in Figure 6-3 differs from our project’s needs in just two ways. First, it doesn’t have an on/off switch. And second, it uses a push button instead of the user’s fingers to start and stop the LEDs from flashing.

Figure 6-4 shows the schematic after I made those modifications. As you can see, I added a push-button switch that must be pressed to provide the +9 V voltage needed to run the circuit, and I replaced the push button that was in the original schematic with two open terminals. When the user touches these two terminals, the resistance of his or her finger completes the circuit.

image

FIGURE 6-4: The schematic diagram for the coin-toss circuit after it has been modified a bit for our project.

remember Please don’t worry at all if you don’t understand how the circuit depicted in Figure 6-4 works. I wouldn’t expect you to at this point in the book! Understanding how a circuit works and building that circuit are two entirely different things; you can (and probably will) build plenty of circuits whose operation you don’t understand. The only thing you should focus on at this point is how the schematic diagram indicates the various connections between the parts in the circuit. You learn the details of how this circuit works in Book 3, Chapter 2 .

One final step you might want to consider when designing a circuit is to create a final version of the schematic diagram that indicates what components will be mounted on your final circuit board and what components won’t be on the circuit board. This diagram will come in handy later, when you’re ready to create the circuit board that will become the permanent home of your circuit.

For example, Figure 6-5 shows a version of the coin-toss circuit that uses a dashed line to delineate the items that won’t be mounted on the circuit board: the battery power supply (that is, the images voltage source and the ground), the push-button power switch, the two metal finger contacts, and the two LEDs. Instead, they’ll be mounted separately within the project box. Thus, the circuit board will need to hold only six components: the 555 timer integrated circuit, the four resistors, and the capacitor.

image

FIGURE 6-5: A schematic diagram that indicates which components are on the main circuit board and which aren’t.

Once you’ve completed your circuit design, you’ll want to compile a list of all the parts you’ll need to build the circuit. Then, you can rummage through your parts bin to figure out what parts you already have at your disposal and what parts you’ll need to purchase. Here’s a list of the components you’ll need to build the coin-toss circuit:

Part ID

Description

R1

images resistor

R2

images resistor

R3

images resistor

R4

images resistor

C1

images capacitor

LED1

5mm red LED

LED2

5mm green LED

IC1

555 timer IC

SW1

Momentary-contact, normally open push button

Prototyping Your Circuit on a Solderless Breadboard

Before you commit your circuit to a permanent circuit board, you want to make sure it works. The easiest way to do that is to build the circuit on a solderless breadboard. The solderless breadboard lets you quickly assemble the components of your circuit without soldering anything. Instead, you just push the bare wire leads of the various components you need into the holes on the breadboard and then use jumper wires to connect the components together.

The beauty of working with a solderless breadboard is that if the circuit doesn’t work the way you expect it to, you can make changes to the circuit simply by pulling components or jumper wires out and inserting new ones in their place. If you discover that your schematic diagram is missing an important connection, you can add another jumper wire to create the missing connection or, if you want to see how the circuit might work with a different resistor or capacitor, you can pull out the original resistor or capacitor and insert a different one in its place. Figure 6-6 shows a typical solderless breadboard.

image

FIGURE 6-6: A typical solderless breadboard.

Understanding how solderless breadboards work

Although many different manufacturers make solderless breadboards, they all work pretty much the same way. The board consists of several hundred little holes called contact holes that are spaced images inch apart. This is a convenient spacing because it also happens to be the standard spacing for the pins that come out of the bottom or sides of most integrated circuits. Thus, you can insert all the pins of even a large integrated circuit directly into a solderless breadboard.

Beneath the plastic surface of the solderless breadboard, the contact holes are connected to one another inside the breadboard. These connections are made according to a specific pattern that’s designed to make it easy to construct even complicated circuits. Figure 6-7 shows how this pattern works.

image

FIGURE 6-7: The contact holes in typical solderless breadboards are internally connected following this pattern.

The holes in the middle portion of a solderless breadboard are connected in groups of five that are called terminal strips. These terminal strips are arranged in two groups, with a long open slot between the two groups, like a little ditch. It is in these holes that you will connect components such as resistors, capacitors, diodes, and integrated circuits.

It’s important to note that the rows of holes are not connected across the ditch. Thus, each row comprises two electrically separate terminal strips: one that connects the holes labeled A through E, the other connecting the holes labeled F through J.

tip The breadboard is designed so that integrated circuits can be placed over the top of the ditch, with the pins on either side of the integrated circuit pushed into the holes on either side of the ditch.

The holes on the outside edges of the breadboard are called bus strips. There are two bus strips on either side of the breadboard. For most circuits, you will use the bus strips on one side of the breadboard for the voltage source and use the bus strips on the other side of the board for the ground circuit.

Most solderless breadboards use numbers and letters to designate the individual connection holes in the terminal strips. In Figure 6-7 , the rows are labeled with numbers from 1 through 30, and the columns are identified with the letters A through J. Thus, the connection hole in the top-left corner of the terminal strip area is A1, and the hole in the bottom-right corner is J30. The holes in the bus strips are not typically numbered.

Solderless breadboards come in several different sizes. Small breadboards usually have about 30 rows of terminal strips and about 400 holes altogether. But you can get larger breadboards, with 60 or more rows with 800 or more holes.

Laying out your circuit

The most difficult challenge of creating a circuit on a solderless breadboard is the task of translating a schematic diagram into a layout that can be assembled on the breadboard. Only in rare cases will a circuit assembled on a breadboard look like the circuit’s schematic diagram. In most cases, the components are arranged differently and jumper wires are required to connect the components together.

remember The key when assembling a circuit on a solderless breadboard is to ensure that every connection represented in the schematic diagram is faithfully re-created on the breadboard. For example, the schematic diagram in Figure 6-4 indicates that pin 1 of the 555 timer IC must be connected to ground. Thus, when you build the circuit on a breadboard, you must ensure that this connection is properly made.

One of the first challenges you face when building a circuit on a breadboard is connecting the pins on an integrated circuit. In a schematic diagram, the pin connections on an integrated circuit are rarely drawn in numerical order. For example, in the schematic diagram shown in Figure 6-4 , the pin connections on the 555 timer IC are listed in this order, going counterclockwise from the top left: 7, 6, 2, 1, 3, 8, and 4. (Pin 5 is not used.)

But the pins on an actual 555 timer IC chip are arranged in numerical order starting at the top-left corner of the chip, as shown in Figure 6-8 . Notice also that there are pins on the left and right side of the chip but none on the top or bottom. (The dot imprinted on the top of the chip is used to identify pin 1.)

image

FIGURE 6-8: How the pins are numbered on a 555 timer integrated circuit.

You’ll have to use your wits to re-create a circuit represented by a schematic diagram on a solderless breadboard. Here are some pointers to get you started:

Assembling the coin-toss circuit on a solderless breadboard

This section presents a complete procedure for assembling the coin-toss circuit on a small solderless breadboard. Once you get all your materials together, you should be able to complete this project in about an hour.

All the parts required to build this prototype circuit can be purchased from RadioShack, or you can order them online from any electronic parts supplier. For your convenience, here is a complete list of the parts you’ll need to build this prototype circuit, along with the RadioShack catalog part numbers:

Part Number

Quantity

Description

2760003

1

Small solderless breadboard

2760173

1

Solderless breadboard jumper wire kit

2761723

1

LM555 timer IC

2711321

1

images resistor (5 per package)

2711335

1

images resistor (5 per package)

2711317

2

images resistor (5 per package)

2721053

1

images polyester film capacitor

2760041

1

Red LED 5mm

2760022

1

Green LED 5mm

2700325

1

9 V battery snap connector

2302209

1

9 V battery

You can build this circuit using equivalent parts from any supplier. So if you already have equivalent parts on hand, you don’t need to run out to RadioShack and purchase them just for the sake of spending money.

You won’t need many tools for this project. You can probably assemble it without any tools at all, but you may want to keep your wire cutters, wire strippers, and tweezers handy.

The steps that follow identify specific holes in the terminal strip area of the breadboard using numbers and letters. If you’re using a different breadboard than the one listed in the parts list, you might encounter a different numbering system. If so, you can refer to Figure 6-7 to translate the numbers given in the steps for the breadboard you’re using.

Once you have everything you need, follow these steps to assemble the circuit:

Follow these three steps to insert the IC and connect it to power.

  1. Insert the 555 timer IC.

    Take a close look at the 555 timer IC. On the top, notice a small dot in one corner; this dot marks the location of pin 1. Carefully insert the leads of the 555 timer IC into the breadboard near the middle of the board, inserting pin 1 into hole E14 and pin 8 in hole F14. The IC will straddle the groove that runs down the center of the board.

  2. Connect pin 1 of the 555 timer IC to the ground bus.

    Insert one end of a small jumper wire into hole A14 and the other end into the nearest available hole in the bottommost bus strip.

  3. Connect pin 8 of the 555 timer IC to the +9 V bus.

    Insert one end of a small jumper wire into hole J14 and the other end into the nearest available hole in the topmost bus strip.

  4. Connect pins 2 and 6 of the 555 timer together.

    Insert one end of a small jumper wire into hole C15 and the other end in hole H16. The jumper wire will reach over the top of the 555 Timer chip.

    Figure 6-9 shows what the breadboard looks like after these three steps.

image

FIGURE 6-9: The breadboard after the IC has been inserted and connected to the power buses.

The next five steps connect the LEDs and resistors R3 and R4. The LEDs will use the terminal strips in rows 19 and 21.

  1. Connect pin 3 of the IC to row 19.

    Insert one end of a short jumper wire in hole C16 and the other end into hole C19.

  2. Connect the two segments of row 19.

    Insert one end of a short jumper wire into hole E19 and the other end into hole F19. This jumper wire bridges the gap between the two terminal strips in row 19, effectively making them a single terminal strip.

  3. Insert the red LED.

    If you look carefully at the red LED, you’ll see that one lead is a bit shorter than the other. This short lead is called the cathode. The longer lead is called the anode. Insert the cathode (shorter lead) into hole D21. Then, insert the anode (longer lead) into hole D19.

  4. Insert the green LED.

    The green LED also has a short cathode lead and a longer anode lead. Insert the anode (long) lead in hole G21 and the cathode (short) lead in hole G19.

    technicalstuff Note that the leads of the two LEDs are installed reversed from one another: the red LED’s anode and the green LED’s cathode are inserted into row 19, while the red LED’s cathode and the green LED’s anode are inserted into row 21. There’s a very good reason for this, but I wouldn’t expect you to understand it yet even if I tried to explain it. So for now, take it on faith that you must install the two LEDs reversed like this for the circuit to work. (You learn more about LEDs, cathodes, and anodes in Book 2, Chapter 5 .)

  5. Insert resistors R3 and R4.

    Both of these resistors are images . You can identify these resistors by looking at the three color strips painted on the resistors — they’re yellow, purple, and brown. Insert one end of the first resistor in hole B21 and the other end in the nearest available hole in the bottommost bus strip (the ground bus). Then, insert one end of the other resistor in hole I21 and the other end in the nearest available hole in the topmost bus strip (the images bus).

    Figure 6-10 shows what the breadboard looks like after these steps.

image

FIGURE 6-10: The breadboard after the LEDs have been connected.

The next five steps connect the finger-touch circuit that lets the user activate the coin toss by touching the two metal contacts. For the purposes of this prototype, you connect one end of a pair of jumper wires to the circuit and leave the other ends protruding from the end of the breadboard. Touching the bare ends of these wires with your fingers will simulate touching the metal contacts that you use in the final version of the circuit. The two jumper wires will be inserted into holes in row 9.

  1. Insert resistor R1 from pin 7 of the IC to the +9 V bus.

    Resistor R1 is the images resistor, which should be connected between pin 7 of the IC and the images bus. This resistor has stripes in the following sequence: brown, black, and red. Insert one end of this resistor into hole J14 and the other end into the nearest available hole in the topmost bus strip.

  2. Insert capacitor C1 from pin 2 of the IC to the ground bus.

    Insert one lead of the capacitor (it doesn’t matter which) into hole B15, and then insert the other into the nearest available slot in the bottommost bus strip.

  3. Insert resistor R2 from pin 7 of the IC to one of the metal contacts.

    This resistor is the images . It should be connected between pin 7 of the IC and one of the metal contacts that the user will touch with his finger to activate the coin-toss action. This resistor has the following sequence of color stripes: brown, black, and orange. Insert one end of it into hole H15 and the other end into hole H9.

  4. Connect a jumper wire from pin 2 of the IC to the other metal contact.

    Insert one end of a short jumper wire into hole B15 and the other end into hole B9.

  5. Insert the two jumper wires that simulate the metal contacts.

    Pick out a couple of jumper wires long enough to reach from row 9 and dangle an inch or so over the edge of the breadboard. Insert one end of these wires into holes E9 and F9 and leave the other ends free. Separate the ends of the two jumper wires to make sure they’re not touching; they should be about images inch apart.

    Figure 6-11 shows what the breadboard looks like after these steps.

image

FIGURE 6-11: The breadboard after the finger contact jumpers have been connected.

The remaining two steps complete the circuit by connecting the power supply.

  1. Connect the battery snap connector.

    The leads on the battery snap connector use stranded rather than solid wire, so you’ll need to prepare them a bit before you insert them into the breadboard.

    1. Use your wire strippers to strip off about images inch of insulation from the end of both leads.
    2. Use your fingers to twist the leads as tightly as you can, so that no individual strands are protruding from the very tip of the wire.
    3. Insert the red lead into the last hole of the topmost row and insert the black lead into the last hole of the bottommost row.
  2. Connect the 9 V battery to the snap connector.

    The red LED should immediately light up. (If not, see the troubleshooting tips in the next section.)

You can now test the circuit by touching both of the two free jumper wires. Pinch them both between your thumb and index finger, but don’t let the wires actually touch each other. The resistance in your skin will conduct enough current to complete the circuit, and the LEDs will start alternately flashing red, green, red, green, and so on. They will continue to flash until you let go of the jumper wires. Then, one or the other will stay lit. When you touch the wires again, the flashing will resume.

Figure 6-12 shows the completed circuit in operation.

image

FIGURE 6-12: The prototype of the coin tosser in operation.

Notice that if you squeeze the wires tightly, the rate at which the LEDs flash increases. If you squeeze tight enough, the LEDs will flash so fast that both will appear to be solid on. The LEDs are still flashing alternately, but they’re flashing faster than your eye’s ability to discern the difference, so they appear to be on constantly.

What if it doesn’t work?

If your circuit doesn’t work, there are a number of troubleshooting steps you can take to find out why and correct the problem. Here are some helpful troubleshooting tips:

Constructing Your Circuit on a Printed Circuit Board (PCB)

Once you’re satisfied with the operation of your circuit, the next step is to build a permanent version of the circuit. Although there are several ways to do that, the most common is to construct the circuit on a printed circuit board, also called a PCB. In the following sections, you learn how printed circuit boards work and how to assemble the coin-toss circuit on a PCB.

tip Note that assembling a circuit on a PCB requires that you know how to solder. To learn that all-important skill, refer to Chapter 7 of this minibook.

Understanding how printed circuit boards work

A printed circuit board is made from a layer of insulating material such as plastic or some similar material. Copper circuit paths are bonded to one side of the board. The circuit paths consist of traces, which are like the wires that connect components, and pads, which are small circles of copper that the component leads can be soldered to. Figure 6-13 shows a typical printed circuit board.

image

FIGURE 6-13: A printed circuit board.

There are two basic styles of printed circuit boards available:

Surface-mount PCBs are easier for large-scale automated circuit assembly. However, they’re much more difficult to work with as a hobbyist because the components tend to be smaller and the leads are closer together. Thus, all the PCBs used in this book are of the through-hole variety.

Using a preprinted PCB

The easiest way to work with printed circuit boards is to purchase a preprinted board from RadioShack or another electronics parts supplier. RadioShack carries several different preprinted circuit boards in its stores. You can find an even greater variety of preprinted PCBs if you shop online distributors such as www.hobbyengineering.com , www.jameco.com , or www.allelectronics.com .

As you can see, preprinted PCBs come in a wide variety of shapes and sizes. The most useful, from a hobbyist’s point of view, are the ones that mimic the terminal-strip and bus-strip layout of a solderless breadboard. For example, Figure 6-14 shows a PCB that has 550 holes laid out in a standard breadboard arrangement. With a preprinted PCB that has a breadboard layout, you can transfer your breadboard prototype circuit to the PCB without having to come up with an entirely new layout.

image

FIGURE 6-14: A preprinted PCB that uses a standard breadboard layout.

Some preprinted circuit boards have layouts that are similar to standard breadboard layouts, but not identical. So check carefully before you build; you may have to make minor adjustments to your circuit layout to accommodate the PCB you’re using.

tip If necessary, you can cut a larger PCB to a smaller size. One way to cut a PCB is to score it on both sides with a heavy-duty utility knife, and then snap it at the score. Another way is to cut it with a rotary tool such as a Dremel.

Building the coin-toss circuit on a PCB

This section presents a complete procedure for building the coin-toss circuit on a small preprinted PCB. Once you get all your materials together, you should be able to complete this project in about an hour.

All the parts required to build this prototype circuit can be purchased from your local RadioShack. Or, you can order them online from any electronic parts supplier. For your convenience, here is a complete list of the parts you’ll need to build this prototype circuit, along with the RadioShack catalog part numbers:

Part Number

Quantity

Description

2760159

1

General-purpose, dual-printed circuit board

2760723

1

LM555 timer IC

2711321

1

images resistor (5 per package)

2711335

1

images resistor (5 per package)

2711317

2

images resistor (5 per package)

2721053

1

images polyester film capacitor

2760041

1

Red LED 5mm

2760022

1

Green LED 5mm

2751547

1

Normally open, momentary-contact push button

2700325

1

9 V battery snap connector

2302209

1

9 V battery

You will also need about a foot each of 22-gauge solid insulated wire and 22-gauge stranded insulated wire. The color doesn’t matter.

Note: This list is similar to the list I give earlier in this chapter for building the coin-toss circuit on a solderless breadboard. If you have the parts from that project, you can reuse them here.

Figure 6-15 shows the layout of the preprinted circuit board. Before we start building the circuit, study the layout of this board for a moment to familiarize yourself with it. As you can see, this board doesn’t contain bus strips like those found on a breadboard. However, the overall layout of the board is similar to the layout of the terminal strips on a breadboard. The center portion of the board contains a total of 20 terminal strips, 10 on each side of the ditch. Each strip has three holes but is also connected to a second strip of two holes along the edge of the board. Thus, each strip effectively has five holes.

image

FIGURE 6-15: The layout for the PCB used in the coin-toss circuit.

The strips aren’t numbered on the board, but I’ve numbered them in Figure 6-15 . I use the numbers 1 through 10 to number the strips on the left side of the board and the numbers 11 through 20 to number the strips on the right. In the instructions that follow, I use these numbers to indicate which holes to attach components or jumper leads to. Note: To keep things simple, I just specify the terminal strip number and leave it up to you to decide which of the five holes in the strip to use.

remember The numbers used in the PCB layout are relative to the bottom of the board — that is, the surface of the board with the copper traces and pads. Thus, the numbers 1 through 10 are on the left and the numbers 11 through 20 are on the right. When you flip the board over to insert components from the top of the board, you’ll have to mentally reverse the numbers: 1 through 10 is on the right and 11 through 20 is on the left.

tip When installing components onto the PCB, use an alligator clip as a temporary clamp to hold the components flush against the board. This will enable you to turn the board upside down so you can solder the leads to the pads. If you don’t clamp the component to the board, the component will fall out when you turn the board upside down, or you’ll be tempted to hold the component in place with one finger while you solder the leads. Bad idea: Resistors get really hot when you solder them.

Here are the steps for building the coin-toss circuit on a preprinted PCB.

  1. Break the PCB in half.

    The preprinted circuit board comes with two identical sections. We need just one of those sections for this project, so you can break the board in half and save the other half for another project. (To break the board, just grab an end in each hand and snap it in two.)

  2. Insert the 555 timer IC.

    Remember that the dot or notch on the 555 IC marks pin 1. Install the chip so that pin 1 is in strip 4 and pin 8 is in strip 14. Then solder the chip carefully into place. (See Chapter 7 of this minibook for tips on soldering.)

  3. Install the jumper wires.

    This circuit needs a total of nine jumper wires. Cut the jumper wires from the 22-gauge solid wire and carefully strip the insulation from each end. Use needle-nosed pliers to bend the bare end of each jumper wire down, insert both ends into the appropriate holes, solder the leads to the pads, and then use your wire cutters to snip the excess of the end of each lead.

    The following table provides the PCB strip locations for each jumper wire. Use your own judgment to determine which hole in the indicated strip to place the jumper wire in. Whenever possible, use the shortest possible path for each jumper wire.

    Jumper #

    From strip

    To strip

    1

    9

    10

    2

    19

    20

    3

    5

    16

    4

    4

    10

    5

    7

    19

    6

    2

    6

    7

    1

    5

    8

    2

    12

    9

    14

    19

  4. Install the resistors.

    There are four resistors to be installed. Use the following table to install each resistor into its correct location. Bend the leads down and insert each resistor into the correct holes, solder the resistor in place, and then snip off the excess wire from the ends of the leads.

    Resistor#

    Value

    Colors

    From strip

    To strip

    R1

    images

    Brown, black, red

    15

    20

    R2

    images

    Brown, black, orange

    11

    15

    R3

    images

    Yellow, purple, brown

    13

    19

    R4

    images

    Yellow, purple, brown

    3

    10

  5. Install the capacitor.

    Install the capacitor into strips 5 and 10. Push the capacitor all the way in until it’s flush with the board. Then solder the leads to the pad and trim off the excess wire.

  6. Install the LEDs.

    Remember that LEDs are directional and must be installed in the correct direction or they won’t work. One lead is shorter than the other to help you tell which lead is which. This short lead is the cathode, and the longer lead is the anode.

    The following table shows where to install the LEDs:

    LED Color

    Cathode (short lead)

    Anode (long lead)

    Red

    12

    13

    Green

    3

    2

    When you install the LEDs, do not push the LED in until it is flush with the circuit board. Instead, push just a little bit of the leads into the holes so that the LED stands up about an inch from the top of the board.

  7. Install the jumper wires for the metal contacts.

    Cut two, 2-inch lengths of stranded wire and strip about image inch of insulation from each end. Solder one end of each wire into holes in strips 1 and 11 and leave the other ends free. When the circuit is installed in its final enclosure, you connect the ends of these wires to the metal posts that the user will touch to activate the coin-toss circuit.

    tip Feeding the stranded wire through the holes in the circuit board can be tricky. First, carefully twist the loose strands until there are no stragglers protruding from the end of the wire. Then, carefully push the wire through the hole. If any of the strands get caught and refuse to go through the hole, pull the wire out and try again.

  8. Connect the push button.

    Cut a 2-inch length of stranded wire and strip about image inch of insulation from each end. Solder one end to either terminal on the push button (it doesn’t matter which). Push the other end through a hole in strip 10 and solder it in place.

  9. Connect the battery snap connector.

    Strip off about image inch of insulation from the end of both leads. Then, solder the black lead to the free terminal on the push button (the terminal you did not use in Step 8) and solder the red lead to a hole in strip 20 on the PCB.

  10. Connect the 9 V battery to the snap connector.

    The red LED should immediately light up, indicating that the circuit is ready to do its decision-making work.

  11. Turn off your soldering iron.

    You’re done!

Test the circuit by pinching both of the free jumper wires between your fingers. The LEDs should alternately flash until you let go, at which time one or the other will remain lit.

Figure 6-16 shows the completed circuit in operation.

image

FIGURE 6-16: The completed coin-tosser PCB.

Finding an Enclosure for Your Circuit

Once your circuit board is finished, the final step to completing your project is to mount it in a nice enclosure such as a plastic, metal, or wooden box. You can purchase plastic or metal boxes specifically designed for electronics projects from most electronic parts suppliers. Most RadioShack stores stock a half dozen or so different sizes in their stores, but you’ll find a better assortment of sizes if you shop online. Figure 6-17 shows an assortment of boxes I picked up at my local RadioShack.

image

FIGURE 6-17: Project boxes come in a variety of shapes and sizes.

If you don’t want to spend the money for a bona fide electronic project box, here are a few alternative ways to find the perfect enclosure for your project:

Working with a project box

Most project boxes are made of plastic or metal and have a detachable lid that’s held on with four screws, one at each corner of the lid. To gain access to the insides of the box, you simply remove the screws to release the lid.

The inside of the box may be completely smooth, or it may contain ridges or mounting studs designed to make it easier to mount components inside the box. If there are no such accoutrements inside the box, you’ll have to devise your own method of attaching the various bits and pieces that need to go inside. Here are some tips:

Mounting the coin-toss circuit in a box

In this section, you finish the coin-toss project by mounting its circuit board in a plastic project box along with a 9 V battery, a power button, and the two metal contacts that the user can touch to toss the coin.

All the parts you need for this project can be purchased at most RadioShack stores — with the exception of the standoffs, which I got at a local hardware store. In addition to the circuit board assembled earlier in this chapter, you’ll need the following materials:

Part Number

Quantity

Description

2701803

1

Project enclosure images inches

2700326

1

9 V battery holder

N/A

8

images -inch 6-32 standoff male-to-female

N/A

6

6-32 nuts (to fit standoffs)

N/A

4

images - inch bolts (to fit standoffs)

Once you’ve collected your parts, here’s the procedure for putting the project together:

  1. Drill the required mounting holes in the lid.

    You need to drill a total of eight holes in the lid. Four are for mounting the circuit board, two are for the LEDs, and two are for the metal finger contacts.

    Figure 6-18 provides a template you can use. The smaller holes are image inch, the two larger holes are image inch. Note: The distance between the four holes at the top of the lid must be exactly image inches so that they line up with the mounting holes in the circuit board. The measurements for the other holes don’t need to be as precise.

  2. Drill a images -inch hole for the push button near the top of the left side of the box.

    The exact location isn’t that important. I suggest you hold the box in the palm of your left hand and drill the hole at a location where your thumb will be able to easily reach the button.

  3. Mount the push button in the box.

    Remove the nut from the neck of the push button, pass the neck through the hole you drilled in the preceding step from the inside of the box, and then thread the nut onto the neck from the outside of the box and tighten it down with pliers.

  4. Use Epoxy or hot glue to glue the 9 V battery holder to the base of the box.

    Position the holder near the top of the box, adjacent to the hole you drilled for the switch.

  5. Mount the circuit board standoffs.

    Mount four of the image -inch standoffs on the underside of the lid by inserting the threaded end of the standoff through the appropriate hole and attaching a 6-32 nut on the other side. See the left side of Figure 6-19 for guidance on how to attach these four standoffs.

  6. Mount the finger touch contacts on the lid.

    To make the metal contacts that the user can touch to toss the coin, first insert the threaded end of one of the standoffs through the hole from the top side of the lid, and then screw a second standoff into it from the bottom of the lid. Then attach a 6-32 nut to the threaded end of the standoff that’s beneath the lid. See the right side of Figure 6-19 for guidance on installing these standoffs.

    Figure 6-20 shows how the box should appear at this point. In this figure, you can see the battery holder and push button already installed in the box, and you can see the standoffs on the underside of the lid.

  7. Mount the circuit board to the standoffs.

    To complete this step, you must first bend the LEDs around so that they wrap over the edge of the circuit card and then face straight down. Be very careful when you bend the LEDs so that you don’t break the leads or damage any of the solder joints. Figure 6-21 shows what the circuit board looks like when the LEDs are properly turned around.

    Once the LEDs are ready, position the circuit board over the four standoffs. The LEDs should slide right into the two image -inch holes you drilled for them in Step 1. If they don’t, just nudge them a bit to make them fit. When everything is in place, secure the circuit board to the standoffs using the 6-32 bolts.

  8. Connect the finger contacts.

    Attach the free ends of the two jumper wires that are connected to the circuit board to the two finger contacts. To connect each wire, wrap the stripped end of the wire tightly around the threaded part of the standoff. Then, attach a 6-32 nut to the standoff and tighten it with pliers.

    Figure 6-22 shows what the project looks like with the circuit board installed into the lid and the jumpers connected to the finger contacts.

  9. Install the battery.

    Insert the battery into the holder, and then connect the snap adapter to the battery.

  10. Attach the lid to the box.

    Carefully flip the lid over and secure it to the box using the screws that came with the project box.

  11. Turn it on and toss a coin!

    You’re finally ready to use the coin-tosser project to help you make decisions. Hold the project box in your left hand and depress the push button with your thumb. Then, touch the index finger of your right hand to the two finger contacts, and watch the LEDs alternate. When you’re ready, let go and see whether the red or green light stays lit.

    Figure 6-23 shows the finished project.

image

FIGURE 6-18: Location for drilling holes in the lid of the project box.

image

FIGURE 6-19: Installing the standoffs.

image

FIGURE 6-20: The box with the push button, battery holder, and standoffs installed.

image

FIGURE 6-21: The circuit board with the LEDs turned around.

image

FIGURE 6-22: The circuit board attached to the lid and the finger contacts connected.

image

FIGURE 6-23: The completed coin-toss project.