Chapter 6

Building Your Own Electronic Projects

In This Chapter

arrow Fleshing out your idea

arrow Creating a workable circuit design

arrow Building a prototype on a solderless breadboard

arrow Creating a permanent circuit on a printed circuit board

For this chapter, we assume that you know something about circuits and components, have your workbench set up and have read the vital Chapter 4 on safety – you have, haven’t you? Seriously, if not, do it now: electricity can kill.

All the theory and preparation are fine, of course, but the heart and fun of electronics is getting your hands dirty building real working circuits and putting them to use. Throughout this book, we back up theoretical explanations with simple construction projects you can build to demonstrate the theory in practice. In this chapter, you discover the basic construction techniques needed to build these projects.

Specifically, you find out how to design your project and create a prototype of a circuit using a handy device called a solderless breadboard. We also describe creating a more permanent version of the circuit, in which you solder all the components and the circuit’s interconnections on a circuit board. Plus you discover how to mount your circuit board in a project box or other enclosure.

Building an Electronic Project in Five Steps

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

remember.eps 1. Decide what you want to build.

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

2. Design the circuit.

When you’ve settled on what you want to build, you have 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 in the time and materials needed to construct a permanent circuit, building a prototype first is a good idea. This prototype lets you test the circuit quickly to make sure it works. Usually, you build the prototype on a solderless breadboard (as we describe in the later aptly named section ‘Prototyping Your Circuit on a Solderless Breadboard’).

4. Build a permanent circuit.

When your prototype is working, you can build a permanent version of the circuit, usually by soldering components onto a printed circuit board (PCB).

5. Finish the project.

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

This chapter describes each of these steps in greater detail.

Envisioning Your Project

Before you get lost in the details of designing and building your project, you need to step back and look at the big picture to make sure that you have a solid idea for your project. Think about why you want to build it, what it’s going to do, who will use it and why.

Perhaps the project is something you don’t really need, but may be fun and instructive to make, like a flashing Christmas tree decoration or a giant Halloween jack-in-the-box to scare trick-or-treaters. Or it may be an extraordinary new invention of your own that’s about to make you a billionaire. We can’t show you a picture of the latter (because you haven’t built it yet!), but we do show you the giant Halloween jack-in-the-box in Figure 6-1.

9781118589717-fg010601.tif

Figure 6-1: A very scary electronics project.

When you have a general idea for a project, you can start to flesh out the details. Consider questions such as the following:

check.png tip.eps What will its user interface be? In other words, how will a person work with the device to get it to do what it’s supposed to do?

check.png Will it be a stand-alone device or interact with other devices?

check.png Will it be powered by batteries or plug into a wall outlet to get its power? Or will it be solar powered?

check.png How big will it be? Does it need to be small enough to hold in your hand or fit in your pocket? Or will it sit on a shelf?

We take a fairly simple project to start with: an electronic decision-maker. You’ll appreciate this project if you’ve ever resorted to tossing a coin to make a difficult decision, because it’s an electronic version of a coin toss. Instead of flipping a coin into the air to decide, say, which team kicks off, you can build an electronic device that does the equivalent of a coin toss for you.

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

check.png The device has two LED indicators to indicate heads and tails.

check.png The device has two small metal contacts, which users can touch with their fingers. When a person touches both of the posts, the LEDs start flashing, alternating back and forth, much like a coin flips end over end when tossed into the air. When the user stops touching the two metal contacts, one of the two lights stays lit, indicating whether the result of the coin toss is heads or tails. Which light stays lit is essentially random.

check.png The device has an on/off pushbutton to conserve battery life. The user depresses the pushbutton to make the device work; when the button is released, the device is turned off.

check.png The device is battery powered and contained in an enclosure small enough to hold in your hand.

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

9781118589717-fg010602.tif

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

Designing Your Circuit

After you have an idea for a project (as we describe in the preceding section), you need to design a circuit that meets the project’s needs. At first, you may have difficulty designing your own circuits, but don’t worry: simply 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 requires.

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

tip.eps 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 we mention in the preceding section. The complete circuit for this project requires several different elements, including:

check.png A circuit to detect when someone has entered the room to trigger the prop’s action.

check.png A circuit to open and close the jack-in-the-box.

check.png A circuit to time how long the jack-in-the-box is to stay open.

check.png A circuit that plays a screaming sound.

check.png A circuit that provides a 30-second delay before the prop is activated again.

The coin-toss project is much simpler than the jack-in-the-box project. In fact, a quick Google search turns 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 can find on the Internet. This circuit diagram uses a 555 timer integrated circuit (IC), four resistors, two LEDs, one capacitor, a switch and a 9 V power supply (most likely a 9 V battery).

You may have noticed that the schematic diagram shown in Figure 6-3 differs from this project’s needs in just two ways: it doesn’t have an on/off switch and it uses a pushbutton instead of the user’s fingers to start and stop the LEDs from flashing.

9781118589717-fg010603.eps

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

Figure 6-4 shows the schematic after we make these modifications. As you can see, we add a pushbutton switch to be pressed to provide the +9 V voltage needed to run the circuit and we replace the pushbutton in the original schematic with two open terminals. When the user touches these two terminals, the resistance of the fingers completes the circuit.

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

9781118589717-fg010604.eps

Figure 6-4: The schematic diagram for the coin-toss circuit after we modify it a bit for this project.

tip.eps When designing a circuit, consider creating a final version of the schematic diagram that indicates what components are to be mounted on your final circuit board and what components won’t be on the circuit board. This diagram comes in handy later, when you’re ready to create the circuit board that becomes 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 +9 V voltage source and the ground), the pushbutton power switch, the two metal finger contacts and the two LEDs. Instead, they’re going to be mounted separately within the project box. Thus, the circuit board needs to hold only six components: the 555 timer IC, the four resistors and the capacitor.

9781118589717-fg010605.eps

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

After you complete your circuit design, compile a list of all the parts you 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 need to purchase. Here’s a list of the components you need to build the coin-toss circuit:

Part ID

Description

R1

1 KΩ, 0.25 W resistor

R2

10 KΩ, 0.25 W resistor

R3

470 Ω, 0.25 W resistor

R4

470 Ω, 0.25 W resistor

C1

0.1 μF capacitor

LED1

5 mm red LED

LED2

5 mm green LED

IC1

555 timer IC

SW1

Momentary-contact, normally open pushbutton

Prototyping Your Circuit on a Solderless Breadboard

Before you commit your circuit to a permanent circuit board, you want to make sure that it works. The easiest way to do so is to build the circuit on a solderless breadboard, which lets you assemble the components of your circuit quickly 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 (short pieces of connecting wire) 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 it 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 may 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 standard solderless breadboard.

9781118589717-fg010606.tif

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 0.1" apart (2.54 mm). This is the standard spacing for the pins that come out of the bottom or sides of most integrated circuits and allows you to 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 constructing even complicated circuits easy. Figure 6-7 shows how this pattern works.

9781118589717-fg010607.tif

Figure 6-7: The contact holes in typical solderless bread-boards 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. You connect components such as resistors, capacitors, diodes and integrated circuits in these holes.

remember.eps The rows of holes aren’t connected across the ditch. Thus, each row comprises two electrically separate terminal strips: one connecting the holes labelled A to E, the other connecting the holes labelled F to J.

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 and you find two bus strips on either side of the breadboard. For most circuits, you use the bus strips on one side of the breadboard for the voltage source and 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 labelled with numbers from 1 to 30 and the columns are identified with letters A to 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 aren’t 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.

warning_bomb.eps Solderless breadboards are designed for low-voltage DC circuits only. Never use one with 230 VAC household mains electricity, because doing so is very dangerous indeed. It can fry the board in a best case scenario or you in the worst case.

Laying out your circuit

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

remember.eps The key when assembling a circuit on a solderless breadboard is to ensure that every connection represented in the schematic diagram is faithfully recreated 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 tasks 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 isn’t 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 pins appear 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.)

9781118589717-fg010608.tif

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

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

1. Start by designating the top row of bus strips as the positive power supply and the bottom row as the ground. Connect your battery connector to holes in one end of these bus strips, but don’t yet connect the battery; applying power to your circuit before you finish assembling it is never a good idea.

2. Insert any ICs required for the circuit. Place them so that they straddle the ditch in the middle of the terminal rows and, if your circuit has more than one IC, orient them all the same. You only confuse yourself if pin 1 is on the bottom-left corner of some of your ICs and on the top-right corner of others.

tip.eps Each pin of each IC is connected to a terminal strip that has four additional connection holes, and so you can connect as many as four additional components or jumper wires to each pin. If your circuit requires more than four component connections to a single pin, use a jumper wire to extend the pin’s terminal strip to an unused row anywhere on the breadboard.

3. Use jumper wires to connect the voltage source and ground pins for each IC.

Attach them to the nearest available connection hole in the voltage and ground buses.

4. Work your way around the rest of the pins for each IC, connecting each component as needed. If one end of a component connects to an IC pin and the other end connects to the voltage source or ground, plug one end of the component into an available connection hole on the terminal strip for the IC pin and plug the other end into the nearest available connection hole on the voltage supply or ground buses.

tip.eps 5. Trim the leads of the various components if you want so that the parts fit closer to the breadboard. Doing so results in a neater breadboard circuit and, with fewer bare leads sticking up high above the breadboard, you reduce the likelihood of leads accidentally coming in contact with each other and creating a short circuit. In a complex circuit, keeping the component leads away from each other without cutting them down to size can be difficult.

Assembling the coin-toss circuit on a solderless breadboard

We now describe the complete procedure for assembling the coin-toss circuit from the earlier sections on a small solderless breadboard. With all your materials gathered together, you should be able to complete this project in about an hour.

You can purchase all the parts required to build this prototype circuit from your local electronics shop or you can order them online from any electronic parts supplier. Components are available in different tolerances. This list doesn’t specify these, but for this project a tolerance of 5 per cent is perfectly fine – you don’t need to spend more of your hard-earned cash on the more expensive and precise 0.1 per cent parts.

For your convenience, here’s a complete list of the parts you need to build this prototype circuit:

Quantity

Description

1

Small solderless breadboard

1

Solderless breadboard jumper wire kit

1

555 timer IC

1

1 kΩ, 0.25 W resistor

1

10 kΩ, 0.25 W resistor

2

470 Ω, 0.25 W resistor

1

0.1 μF polyester film capacitor

1

Red LED 5 mm

1

Green LED 5 mm

1

9 V battery snap connector

1

9 V battery

You don’t need many tools for this project. In fact, 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 breadboard that’s different to the one we’re using, you may encounter a different numbering system. If so, refer to Figure 6-7 and translate the numbers given in the steps for your breadboard.

Inserting the integrated circuit

When you have everything you need ready, follow the steps below to assemble the circuit. The first four steps involve inserting the IC and connecting 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 straddles the ditch that runs down the centre 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 reaches over the top of the 555 timer chip.

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

9781118589717-fg010609.tif

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

Wiring the LEDs

The next five steps connect the LEDs and resistors R3 and R4. The LEDs 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 into 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 can 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 and 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.eps 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 and the red LED’s cathode and the green LED’s anode are inserted into row 21. A very good technical reason does exist for this method, but for now take it on trust that you must install the two LED’s reversed like this for the circuit to work. (You discover more about LEDs, cathodes and anodes in Book II, Chapter 5.)

5. Insert resistors R3 and R4.

Both of these resistors are 470 Ω. You can identify them by looking at the three colour stripes 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 +9 V bus).

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

9781118589717-fg010610.tif

Figure 6-10: The bread-board after the LEDs have been connected.

Connecting the contact jumpers

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 simulates touching the metal contacts that you use in the final version of the circuit. You insert the two jumper wires into holes in row 9:

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

Resistor R1 is the 1 kΩ resistor, which you connect between pin 7 of the IC and the +9 V bus. This resistor has stripes in the following sequence: brown, black and red. Insert one end of this resistor into hole J15 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 10 kΩ. Connect it between pin 7 of the IC and one of the metal contacts that the user touches to activate the coin-toss action. This resistor has the following sequence of colour 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 2–3 cm 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 ensure that they’re not touching; make them about 12 mm apart.

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

9781118589717-fg010611.tif

Figure 6-11: The bread-board after the finger contact jumpers are connected.

Powering up

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 need to prepare them a bit before you insert them into the breadboard:

a. Use your wire strippers to strip off about 1 cm of insulation from the end of both leads.

b. 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.

c. 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 between your thumb and index finger, but don’t let the wires actually touch each other. The resistance in your skin conducts enough current to complete the circuit, and the LEDs start alternately flashing: red, green, red, green and so on. They continue to flash until you let go of the jumper wires. Then, one or the other stays lit. When you touch the wires again, the flashing resumes.

Figure 6-12 shows the completed circuit in operation.

9781118589717-fg010612.tif

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 flash so fast that they appear to be on constantly. The LEDs are still flashing alternately, but they’re flashing faster than the ability of your eyes to discern the difference.

Troubleshooting if your circuit fails to work

If your circuit doesn’t work, here are some troubleshooting tips to help you find out why and correct the problem:

check.png Examine all the component leads to make sure that none are touching each other. If any of the leads are touching, gently adjust them so that they’re not touching.

check.png Make sure that the circuit is getting power. Use your multimeter to test the battery voltage (see Chapter 8 of this minibook for information on how to do that), and verify that the leads from the battery snap connector are inserted properly into the solderless breadboard.

check.png Double-check your wiring carefully. Make sure that you’ve inserted every jumper and every component in the correct spot.

check.png Verify the orientation of the 555 timer IC. You need to ensure that pin 1 is in hole E14 and pin 8 is in hole F14.

check.png Ensure that the LEDs are inserted in the correct direction. For the red LED, the short lead (the cathode) goes in D21 and the long lead (the anode) goes in D19. For the green LED, the short lead (the cathode) goes in G19 and the long lead (the anode) goes in G21.

Constructing Your Circuit on a Printed Circuit Board (PCB)

When you’re satisfied with the operation of your prototype (as we describe in the preceding section), the next step is to build a permanent version of the circuit. Although you can do this in several ways, the most common method is to construct the circuit on a printed circuit board (PCB). In this section, you discover how PCBs work and how to assemble the coin-toss circuit on one.

tip.eps Assembling a circuit on a PCB requires that you know how to solder. To find out about this all-important skill, check out Chapter 7 of this minibook.

Understanding how PCBs work

A PCB 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 to which you can solder the component leads. Figure 6-13 shows a typical PCB.

You can purchase two basic styles of PCBs:

check.png Through-hole: A PCB in which the copper circuits are on one side of the board and the components are installed on the opposite side. In a through-hole PCB, small holes are drilled through the board at the centre of the copper pads. You mount components to the blank side of the board by passing their leads through the holes and soldering the leads to the copper pads on the other side of the board. When the solder joint is completed, you trim away any excess wire lead.

check.png Surface-mount: A PCB in which the components are installed on the same side of the board as the copper circuits. No holes are drilled.

9781118589717-fg010613.tif

Figure 6-13: A printed circuit board.

remember.eps 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. All the PCBs we use in this book are of the through-hole variety.

Using a preprinted circuit board

The easiest way to work with PCBs is to purchase a preprinted board from an ­electronics shop or order one from an electronics parts supplier online. Maplin carries several different preprinted circuit boards in its shops and at http://www.maplin.co.uk/components/pcb-development on its website.

Preprinted circuit boards 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 (check out the earlier section ‘Understanding how solderless breadboards work’). For example, Figure 6-14 shows a PCB that has 550 holes laid out in a standard breadboard arrangement. A preprinted circuit board with a breadboard layout allows you to transfer your breadboard prototype circuit to the PCB without having to come up with an entirely new layout.

9781118589717-fg010614.tif

Figure 6-14: A preprinted circuit board that uses a standard breadboard layout.

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

tip.eps If necessary, you can cut a larger PCB to a smaller size. One way to do so is to score it on both sides with a heavy-duty utility knife, and then snap it at the score.

Building the coin-toss circuit on a PCB

This section presents a complete procedure for building the coin-toss circuit (that we introduce in the earlier section ‘Envisioning Your Project’) on a small preprinted circuit board. With your materials together, you can complete this project in about an hour.



You can buy most of the parts required to build this circuit from your local electronics shop or order them online from any electronics parts supplier. You can order the specific Radioshack preprinted circuit board that we use from www.t2retail.co.uk. Here's a complete list of the parts you need to build this circuit (the list is similar to the earlier one in 'Assembling the coin-toss circuit on a solderless breadboard' and so by all means reuse any parts here):

Quantity

Description

1

Radioshack dual general-purpose, IC PC board

1

555 timer IC

1

1 kΩ, 0.25 W resistor (5 per package)

1

10 kΩ, 0.25 W resistor, 5% tolerance (5 per package)

2

470 Ω, 0.25 W resistor, 5% tolerance (5 per package)

1

0.1 μF polyester film capacitor

1

Red LED 5 mm

1

Green LED 5 mm

1

Normally open, momentary-contact pushbutton

1

9 V battery snap connector

1

9 V battery

You also need about 30 cm each of 22-AWG (American Wire Gauge) solid insulated wire and 22-AWG stranded insulated wire. The colour doesn’t matter.

Figure 6-15 shows the layout of the preprinted circuit board. Before you start building the circuit, study this layout to familiarise yourself with it. As you can see, this board doesn’t contain bus strips like those found on a breadboard. However, the overall layout is similar to the layout of the terminal strips on a breadboard. The centre 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.

The strips aren’t numbered on the board, but we number them in Figure 6-15. We use numbers 1 to 10 for the strips on the left side of the board and numbers 11 to 20 for the strips on the right. In the instructions that follow, we use these numbers to indicate which holes you attach components or jumper leads to. To keep things simple, we 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.eps 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 to 10 are on the left and the numbers 11 to 20 are on the right. When you flip the board over to insert components from the top of the board, you have to reverse the numbers mentally: 1 to 10 is on the right and 11 to 20 on the left.

tip.eps When installing components onto the PCB, use a crocodile clip as a temporary clamp to hold the components flush against the board. Doing so enables 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 falls out when you turn the board upside down.

warning_bomb.eps Don’t be tempted to hold the component in place with one finger while you solder the leads: resistors get really hot when you solder them.

9781118589717-fg010615.eps

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

Here are the steps for building the coin-toss circuit on a preprinted circuit board:

1. Break the PCB in half.

The preprinted circuit board comes with two identical sections. You need just one of those sections for this project, and so 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-AWG 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 minitable provides the PCB strip locations for each jumper wire. Use your own judgement to determine in which hole in the indicated strip to place the jumper wire. 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.

You need to install four resistors. Use the following minitable 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.

tb010601

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. 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.

7. Install the LEDs.

Remember that LEDs are directional and you have to install them in the correct direction or they don’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.

Here’s where to install the LEDs:

LED Colour

Cathode (Short Lead)

Anode (Long Lead)

Red

12

13

Green

3

2

When you install the LEDs, don’t push the LED in until it’s flush with the circuit board. Instead, push just a little bit of the leads into the holes so that the LED stands up about 25 mm from the top of the board.

8. Install the jumper wires for the metal contacts.

Cut two, 5-centimetre lengths of stranded wire and strip about 1 centimetre 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 (see the later section ‘Mounting Your Circuit’), you connect the ends of these wires to the metal posts that the user touches to activate the coin-toss circuit.

tip.eps Feeding the stranded wire through the holes in the circuit board can be tricky. Carefully twist the loose strands until no stragglers protrude from the end of the wire, and 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. Alternatively, you can ‘tin’ the twisted wire by adding a thin coat of solder to the end, which maintains the flexibility of stranded wire whilst making it easier to feed through small holes.

9. Connect the pushbutton.

Cut a 5 cm length of stranded wire and strip about 1 cm of insulation from each end. Solder one end to either terminal on the pushbutton (it doesn’t matter which). Push the other end through a hole in strip 10 and solder it in place.

10. Connect the battery snap connector.

Strip off about 1 cm of insulation from the end of both leads. Then solder the black lead to the free terminal on the pushbutton (the terminal you didn’t use in Step 9) and solder the red lead to a hole in strip 20 on the PCB.

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

The red LED immediately lights up, indicating that the circuit is ready to do its decision-making work. If the LED doesn’t light up, something isn’t right; use the troubleshooting guide for the prototype to help you work out what has gone wrong.

12. Turn off your soldering iron.

Congrats . . . you’re done!

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

Figure 6-16 shows the completed circuit in operation.

9781118589717-fg010616.tif

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

Mounting Your Circuit

When 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 boxes specifically designed for electronics projects from most parts suppliers. Maplin stocks various sizes of plastic, a few metal and several waterproof enclosures in its shops and you can find loads more online. See Figure 6-17 for some options.

9781118589717-fg010617.tif

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

Finding a suitable enclosure for your circuit

If you want something a bit different to a standard electronic project box, here are a few alternative ways to find the perfect enclosure for your project:

check.png Search discount department stores for small storage boxes. You may find one that’s just the right size and shape for much less money than an official project box of the same size.

check.png Check out the electrical department of any hardware store, where you can find inexpensive plastic and metal boxes designed for household wiring. You can adapt many of these boxes for your electronic projects.

check.png Take a quick look at boxes that used to contain any old electronic gizmos before you throw them away. If you think a box may be useful for a project someday, take it apart and discard all the innards, keeping only the empty carcass.

warning_bomb.eps Be careful whenever you disassemble any electronic device. Make sure that you first completely remove the power source and watch out for large capacitors that may be holding on to their charge.

check.png Keep an eye out at car-boot sales. You never know when you may find something suitable to adapt.

check.png Make one out of Lego. The bricks are too small and hard to drill for inlets and outlets, but you can build in the entry holes where you need them.

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 contain ridges or mounting studs designed to make mounting components inside the box easier. If it’s just smooth, however, you have to devise your own method of attaching the various bits and pieces that need to go inside. Here are some tips:

check.png Gather together a good assortment of small drill bits to drill holes through the box to mount your components. You need to drill holes to mount the circuit board as well as such things as battery holders, switches, LEDs, speakers and whatever else your project requires.

check.png Make a good sketch of your project box and how its parts are to be arranged before you start drilling holes. When you’re sure that you have everything laid out the way you want, use a marker to indicate the exact position of the holes you need to drill.

check.png Mount the circuit board using standoffs to provide some empty space between the board and the case. A standoff is a screw that allows you to mount the board so that it’s raised above the bottom of the project box.

tip.eps If you have an ample supply of nuts and bolts, you can fashion your own standoffs simply by cutting a short length of plastic tubing and feeding a long bolt through it.

check.png Consider mounting the circuit board on the back of the lid instead of inside the body of the box. This approach sometimes frees up more room within the box for larger items such as batteries or a speaker.

check.png Attach switches to the box by drilling a hole large enough to allow the neck of the switch to pass through. The switch comes with a nut that you can tighten over the neck of the screw to secure the screw to the box.

check.png Use a small amount of epoxy or other glue to set components without mounting nuts in place. The glue helps to secure them to the box.

check.png Employ stranded wire for connections within the project box. Stranded wire holds up better to the handling it occasionally gets when you open the box, for example, to change the batteries.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset