CHAPTER 5

Images
Laying Out a Printed Circuit Board

In this chapter, you will first look at the various commands available to use when laying out a PCB and then make two example layouts for the bar-code example of Chapter 4. One of these layouts will use a typical hobbyist’s through-hole design. The other will use mostly surface-mount components. In the final section of this chapter, we spurn the help of the autorouter, lay out the same example manually, and compare it with the automatically generated layout.

Images

Experimenting

Before starting on the sound meter example, you will be experimenting with the many features that are available through the Board Editor. To have something to experiment with, use the board from the flasher example of Chapter 2 (Figure 5-1). During your experimentation, you are quite likely to completely mess up these project files, so remember that the original files can always be downloaded again from the book’s website (www.simonmonk.org).

Images


FIGURE 5-1   Board layout from the flasher project.

Open the flasher example project, and then open the board layout.

Images

Layers

A fundamental part of the Board Editor is the concept of layers. EAGLE defines a huge set of layers and also allows you to define your own layers and even automatically generate them from scripts. You will only ever need to use quite a small subset of these layers. At any time, you can control which layers are visible and which are hidden. This is useful to avoid clutter and to be able to concentrate on a particular aspect of the design without the confusion of everything being visible all the time.

The Layers command (second from the top icon on the left of the Command bar) provides you with a list of all the layers available, with the ones currently visible highlighted (Figure 5-2).

Images


FIGURE 5-2   Layers.

The scroll bar tells you just how many layers there are off the bottom of the window. Let’s look at the layers that we will most definitely use before looking at some of the more exotic ones. Table 5-1 lists the most common layers.


TABLE 5-1   Main Layers in Board Editing

Images

When you add a part to a schematic, that part can contribute various things to different layers in EAGLE. Thus part of the package description will be such things as the size and shape of the pads and the names and values that will end up on the “Pads” and “tNames” (or “bNames”) layers.

Images

The Command Toolbar

The basic structure of the Board Editor is the same as that of the Schematic Editor. The Command window on the left has commands, some of which, such as Move and Information, are the same as when using the Schematic Editor and some of which are new.

Figure 5-3 shows the Command toolbar for the Board Editor. The most important commands are highlighted in bold, and the ones marked with an asterisk (*) are new commands that only apply to the Board Editor and not the Schematic Editor.

Images


FIGURE 5-3   Board Editor Command toolbar.

Common Commands

Many of the commands in the Board Editor work in just the same way as those in the Schematic Editor. In this section we will look at just the most common commands.

Move

The Move command allows you to move parts around on the board layout. It does not affect the position of the same part in the Schematic Editor.

Group

Group moves and deletes are carried out in the same way as in the Schematic Editor. That is, you click the command (say, Move) and then click the Group command, drag over an area to make a multiple selection, and then right-click and use the Group move (or whatever) option in the menu. When laying out by hand, a very common Group operation is to Ripup a section of tracks that have been routed so that they can be rerouted better.

Delete

I have indicated that this is an important command, but actually it’s a command that is important that you do not use in the Board Editor, at least on parts. If you want to delete parts, then you should do it in the Schematic Editor. When you delete them there, they will automatically disappear from the Board Editor. If you try to delete a part in the Board Editor, you will see the error message in Figure 5-4.

Images


FIGURE 5-4   Trying to delete a part in the Board Editor.

The message is telling you that the change you are trying to make to the board cannot be applied back to the schematic. The exception to this is that simple changes such as changing the value of a component can be made in the Board Editor, and the change will then also appear in the Schematic Editor. Generally, it is better to assume that the schematic is the important master copy and that any design changes should be made there.

Name

You can safely change the name of a part in the Board Editor. Such a change will automatically update the corresponding part in the Schematic Editor.

Route

The Route command is what you use to convert an air wire (connection needing to be made) into a copper track. We will use the Route command extensively later on when we start laying out our example board.

When the Route command is selected, the Parameter toolbar fills with all sorts of useful parameters that we can set for the copper track we are about to route. We will see later that by using design rules and net classes, these may get set for us automatically, although there is always the option to tweak them manually. Figure 5-5 shows the Routing Parameter toolbar.

Images


FIGURE 5-5   Routing Parameter toolbar.

From left to right, the icons are

       Grid. More on this later.

       Layer. Copper on the top or bottom of the board.

       • The next eight icons represent different styles of track bend. To get the hang of these, you will experiment with them when we try laying out the bar-code example.

       • There is then a “Miter” dropdown that allows you to select a curve radius for bends in the track. This used to be important for certain chemical etching processes where tight bends could cause the etchant to collect and overetch the track. Unless you are home etching your PCBs, this feature is largely down to personal preference.

       • Finally, there are two selection buttons that allow you to choose between square and curved miters.

Ratsnest

If you are routing a PCB by hand, you will probably find yourself hitting this button frequently. When clicked, it recalculates the shortest routes for all the air wires. Remember that these air wires indicate where there is more routing to do. When all the connections have been made, it will display the status message Nothing to do!

If there are still connections to be made, this command will recalculate them, indicating the shortest routes between existing tracks. Thus, having done a bit of routing, clicking Ratsnest will tidy everything up and recalculate the air wires for you.

Copy

If you remember from the Schematic Editor, Copy is actually more like “duplicate.” It is another command that should not be used with parts. Switch to the Schematic Editor if you want to add or duplicate parts. It is, however, useful to copy board-specific items that do not appear on the schematic, such as holes or text.

Rotate

This rotates the part through the angle specified in the Parameters toolbar. This is normally 90 degrees. However, you can use other angles by

       • Clicking the Rotate command

       • Typing the angle into the dropdown (say, 45) and hitting “Return”

       • Clicking Rotate again

       • Selecting 45 in the dropdown

       • Clicking on the part to rotate

This can be useful for unusually sized PCBs.

Add and Replace

Adding a part is another operation that is not permitted from the Board Editor, and while replacing parts, if they have compatible pins, it is much better to go back to the Schematic Editor and make the change there.

Value

Changing a component value in the Board Editor is just fine. Any change that you make in the Board Editor will automatically update the Schematic Editor.

Ripup

Ripup is the opposite of Route. It allows you to rip up sections of track so that they can be rerouted. You will use this command a lot.

Other Commands

You can, if you wish, skip over the commands in this section. They are described here for completeness and so that you know of their existence should you need them at some point in the future.

Mirror

The Mirror command is only useful if you are placing components on the bottom layer, as well as the top. Mirroring the component to go on the underside will automatically mirror the pads.

Paste

Paste is the same concept as the Paste in Cut and Paste, but this being EAGLE, it works in a different way. To make a copy to be pasted, you select items either individually or using the Group command. The Paste command then will attach a duplicate of everything selected to the cursor so that you can click to place it in the design. As with duplication, you should only use this feature with items that are specific to the board design, such as holes or text.

Pin Swap

Pin Swap is quite handy for making the routing process more convenient. For two-pin devices, you can achieve the same effect just by rotating it, without the side effect of it messing up your schematic (as has happened in Figure 5-6 following a Pin Swap).

Images


FIGURE 5-6   Pin-Swapping in the Board Editor.

Lock

The Lock command allows you to protect a part so that it cannot be moved or modified without first unlocking it. To unlock it, hold down the “Shift” key while using the Lock command. Or you could just be careful and use Undo if you make a mistake.

Smash

This is the same Smash command that lets you separate the labels for a part from the part itself in the Schematic Editor. This can be useful if you want to move, say, a part value away from the outline of the part to prevent overlaps of text and the part.

Split

Split allows you to add an extra bend on the segment of a track without having to reroute the section.

Meander

Meanders are used in high-frequency projects where the track length can affect when signals arrive at a component. A Meander zigzags to lengthen the track. This is something of a professional feature needed for boards operating at very high frequencies and unlikely to be needed by us hobbyists.

Shapes and Text

There are various different shapes and text that you can use to draw on your board. This can be in copper if you select top or bottom as the layer or can appear in the final silk screen if you select the layer that will eventually be used for silk screen—often tPlace and bPlace.

Remember that parts will come with their own text and placement guides, so you do not usually need to draw much in the way of annotation. The Polygon shape, when drawn in copper, can be used to create a ground plane, something we will discuss in the example section.

Via

Vias are used to allow a track from one layer to continue on another layer, that is, from top to bottom or vice versa. Physically, they are small holes with a connection between the layers. It is better to create vias automatically as you route simply by switching layers than to add them explicitly. In other words, avoid the Via command.

An exception to this is if you have two ground planes (see later in this chapter), one on the top layer and one on the bottom, and you want a good connection between them. You might then add a number of vias to achieve this.

Hole

It is quite common to add a hole to a PCB so that it can be fixed into an enclosure. The Hole command lets you do this. When adding a hole, be careful that no tracks will be cut by the hole.

Dimensions

The Dimension command lets you annotate part of a design with dimensions.

ERC

You should not need this from the Board Editor because you should not be changing things there that affect the electric rule checker (ERC).

Show

This command has a similar purpose to the Information command except that rather than opening a little window that gives you details of the component selected, it displays the information in the status area at the bottom of the screen.

Mark

The Mark command allows you to set a local origin anywhere on the Board Editor so that you can see the coordinate values relative to that point. Clicking on the “GO” button (looks like a traffic signal) cancels the Mark. This can be used to measure things on the board, but frankly, I have never found a good use for it.

Change

The Change command allows you to change almost anything about an object on the schematic diagram. You can, of course, change these things using the Information command.

Miter Wires

This command allows you to put a curve in a line or polygon. To use it, select the command, and then click on a corner of a line. You can then set the radius in the dropdown in the Parameter toolbar.

Optimize

This removes unnecessary midpoints from a straight line.

Signal

The Signal command would allow you to define signals in the board layout, but if you try to click on it, EAGLE just tells you that you can’t use it. It will only work if forward/backward annotation is disabled, which would be silly. Just ignore this feature.

Attributes

You can add your own custom attributes to a component and then decide whether you want them to be displayed. See Chapter 4 for an example of using this to add a “power” property to a resistor.

Autoroute

This command runs the autorouter. More on this later.

DRC

The design rule checker (DRC) is to the Board Editor what the ERC is to the Schematic Editor. It performs all sorts of checks that make sure that tracks are not crossing each other on the same layer, located too close together, and so on.

Because the design rules are complicated to set up, you can load and save sets of design rules and even download sets of design rules that others, such as Sparkfun, have made available to everyone.

Images

The Grid

The schematic is drawn on a grid, which helps you to lay things out neatly by allowing you to snap parts and net lines to the nearest point on the grid. However, the grid is much more important for board design.

By default, the grid spacing is 0.05 in. You can change this using the Grid option on the View menu. This opens the dialog shown in Figure 5-7.

Images


FIGURE 5-7   Changing the grid.

Occasionally, it can be useful to reduce the grid spacing if you are running short on space. It is a good idea to keep it at fractions of 0.1 in. because most parts have leads on that pitch.

Images

Sound Meter Layout (Through-Hole)

Now that we have taken the tour, it’s time to start working on a board. We are going to begin with a through-hole board design for the sound meter example project.

Rather than show you a perfect first-time layout, this design will lead you through the real example as I worked through it. This is not a perfect example layout. There are deliberate initial errors, which we will work through and correct, that are quite likely to crop up when you do your own first designs.

Open the schematic diagram for the sound meter project.

Create a Board from the Schematic

We do not yet have a board for this schematic, so from the File menu, select the option “Switch to Board.” You will be informed that the board does not exist and will be asked if you want to create it from the schematic. Say “Yes,” and the Board Editor will open, looking something like Figure 5-8.

Images


FIGURE 5-8   An initial board.

Thus we have what could be described as a big heap of components on the left and a rectangle representing the board on the right. We even have some text that has escaped from the frame on the schematic. Delete the block of text to make it easier to concentrate on the components.

Decide on Board Size

Sometimes you will know what size board you are aiming for, and other times it is best to add the components and do some of the layout before making a decision. Because 5 by 5 cm (just short of 2 by 2 in.) is used as the cutoff size for a big price hike by the author’s favorite PCB fabrication shop, we will give ourselves the constraint of fitting the design onto a 5- by 5-cm board.

Our units are all in inches, so move the top and right edges (drag them in the middle) so that the board is 1.95 in. square. Watch the size change in the top left of the editor area.

At first sight, it does not look like everything is going to fit on the resized board (Figure 5-9), but trust me, it will.

Images


FIGURE 5-9   A quart and a pint pot.

Position and Rotate the Components

Let’s start moving the parts onto the board. The layout broadly follows the schematic. Thus we can put IC1 and associated components over on the left. Then the filter components and IC2 and, finally, the LEDs can be put over on the right side.

Remember that when using the Move command on a part, you also can rotate it through 90 degrees by right-clicking. Frequent use of the Ratsnest command will tidy up the air wires. You will probably also need to zoom in to be able to identify the parts correctly.

In deciding where to place the components so as to broadly follow the schematic, it is very helpful to have the schematic available for reference. If you have two monitors, keep the schematic up on one of them and the Board Editor on the other or simply print out a copy of the schematic to refer to as you place the components.

I used the Smash command on all the capacitors and then used the Change (size 0.05) on the part name label to make it easier to read the capacitor names. We will come back to part labels later in this chapter when we sort out the silk-screen text.

When all the components are in place, the board should look like Figure 5-10.

Images


FIGURE 5-10   Board with all parts added.

Currently, there is a rat’s nest of unrouted wires. Clicking on the Ratsnest command will tidy this up a little (Figure 5-11).

Images


FIGURE 5-11   Board after the Ratsnest command.

Add Mounting Holes

It will be useful if this board has some mounting holes on it so that it can be attached to a front panel or otherwise secured in an enclosure. Now is a good time to add the holes, before we start routing the air wires, because the tracks will have to stay well clear of the holes.

Select the Hole command from the Command toolbar. Change the drill size to 0.2 in. in the dropdown list in the Property toolbar, and then add three holes, as shown in Figure 5-12. It does not matter if the holes are on top of air wires.

Images


FIGURE 5-12   Board with mounting holes added.

Get Some Design Rules

Before we run the autorouter, we need to set up a few rules about how thick we want the tracks to be, how far apart they are to be, and so on. We can do this in two ways, one by using a set of design rules and the other by defining some net classes (which we started in Chapter 4).

Let’s start with the design rules. We are going to use a set of design rules that Sparkfun supplies as a free download. You should have installed these back in Chapter 1 (see the section “Installing the Sparkfun Design Rules”). If you did not install them, please do so now.

You may remember that back in Chapter 4 we defined a new net class called Supply, with the intention that it should provide thicker tracks for tracks that supply power to the chips. We created the names for the classes and changed the GND and V+ nets to be of the Supply class, but we did not set the track thicknesses.

Thus, from the Edit menu, select “Net Classes..” and modify the parameters so that they look like Figure 5-13.

Images


FIGURE 5-13   Setting dimensions in the net classes.

This sets the track width to 10 mils (0.01 in.) for a regular signal and 20 mils for a supply signal.

Run the Autorouter

It is time at last for the really fun bit—running the autorouter. Click on the Autoroute command. We do not need to change anything on the Autoroute settings; the defaults should work just fine. But let’s take a moment to look at some of the settings (Figure 5-14).

Images


FIGURE 5-14   Autorouter settings.

This is actually the first of many autorouter settings tabs and probably the only tab that you might want to change. The Preferred Directions setting acts as a hint as to how to use the two layers. By setting one to be predominantly horizontal and the other vertical, you tend to minimize the number of vias you need. If you want to produce a single-layer board, then you can do that here by setting the top layer to be “N/A.”

The routing grid specifies the grid to which the bend points in the tracks should be matched. Reducing this number sometimes may be necessary to fit all the tracks in.

Running the autorouter will produce a result something like Figure 5-15. It will not be exactly like Figure 5-15 because your parts will not be in exactly the same positions as mine.

Images


FIGURE 5-15   The first routing.

This is actually a pretty good result. The board looks pretty neat. You can see the thicker tracks for GND and V+. However, you will notice that there are still some air wires that have not been routed.

Tweak the Result

Rather than route the air wires manually, to improve the layout marginally, we are going to add a ground plane. A ground plane, as the name suggests, adds a large area of copper on the board that is connected to ground. Because quite a lot of the components have a connection to ground, this actually reduces the number of tracks required on the bottom layer, making it more likely that all the air wires will route.

Before we can add the ground plane, we need to “rip up” the tracks that have just been laid. You can do this either by using Undo or you can select the Ripup command, select the Group command, drag over the whole board, and then from the right-click menu select “Group Ripup.”

Having turned all the tracks back into air wires, add a ground plane by selecting the Polygon tool and drawing a square around the outline of the board (Figure 5-16). Make sure that the Layer dropdown is set to “16 Bottom” and the Width dropdown is set to 0.01 (both on the Parameter toolbar once “Polygon” is selected).

Images


FIGURE 5-16   Adding a ground plane.

Although the polygon is a shape, it is deemed to have edges, and the “Width” attribute sets the width of these. These are judged by the same design rules as other tracks, and making them wide interacts with the design rules, making the ground plane smaller than the board outline. In short, keep the width small to avoid problems.

When the square has been drawn, there will be a thin blue dashed line all around the outline of the board. Click on “Ratsnest,” and the polygon will fill with blue (Figure 5-16).

Now we need to associate the polygon with the GND signal. To do this, click the Name tool, select “Polygon,” and name it GND (Figure 5-17). Note that it can be quite tricky to select the polygon rather than the board dimension lines. When you click on “Ratsnest” again, you will see some of the air wires vanish because they are now taken care of by the ground plane and will not require Track to route them.

Images


FIGURE 5-17   Naming the ground plane.

Having made the ground plane, run the autorouter again. Figure 5-18 shows the result.

Images


FIGURE 5-18   Autorouting with a ground plane.

This time the autorouter failed to route just one air wire. Also, the ground plane has broken up. There is a portion over on the right where the ground plane could not spread though because of the design rules. Let’s try to sort out these problems.

If you cannot see where the air wire is, then it helps to temporarily hide some of the layers. The air wires are all on the “19 Unrouted” layer.

The remaining air wire is between the two anodes of LED9 and LED10. All the positive leads of the LEDs are connected together on the left. It would be easier if they were on the right because they would then be on the same side as the connections from IC2. So let’s rip up all the tracks, rotate the LEDs, and try again. Laying out a board is an iterative process. Unless you have a few components on a large board, you are likely to have to make several attempts to route the board.

This time, the result is much better (Figure 5-19). There is still one air wire between LED9 and LED10, but the ground plane now covers the whole bottom layer.

Images


FIGURE 5-19   A second autorouting with ground plane.

This looks like it should have been autorouted, and this is probably so because LED10 is so close to the edge of the board that routing it would break a design rule.

Anyway, for now, we will route it manually, just to illustrate manual routing. Select the Routing command, then change the width to 0.2, and make sure that the top layer is selected. Then draw the track up from the positive (+) connection on LED9 to LED10. Figure 5-20 shows this in progress.

Images


FIGURE 5-20   Adding the final track.

Click “Ratsnest” again, and you should be told Nothing to do. The full board is shown in Figure 5-21. At this stage, you can probably tell that we will need to revisit the layout soon.

Images


FIGURE 5-21   Fully laid-out board.

Run the Design Rule Checker

Before we can declare our board finished, we need to run the DRC on it. When this is run on the design, it produces a results window in which you can select problems, and they are highlighted in the design.

Figure 5-22 shows the errors I get. Clicking on one of the errors in the list will highlight the area on the board. In the figure, this is LED10 being too close to the top edge of the board.

Images


FIGURE 5-22   Results of the DRC.

These errors all relate to things being too close to the top edge of the board. These include

       • J1, which is easily moved down a little

       • The hole next to LED2, which is too close to the diodes (I solved this by moving the diodes a little to the left.)

       • LED10, which is less easy to fix

Because all the LEDs are on a 0.05-in. grid, if we move them all down one grid position, then we will just move the problem to the bottom edge of the board. Therefore, change the grid spacing to 0.025 in. (on the View menu). Rip up everything (again), and move the LEDs away from the edges and closer together. After the autorouter has been run again, there are no air wires. Figure 5-23 shows the result.

Images


FIGURE 5-23   Moving the LEDs closer together.

Run the DRC again. You may find an error relating to the ground plane, complaining of “width.” You can ignore this.

Let’s now move on to the next stage in the preparation of our board—sorting out the silk-screen layer.

Text on the Silk Screen

To make our board look really good, as well as making it easy to assemble and see which component goes where, we need to sort out the writing that will appear on the board, known as the silk screen. The “tPlace” is the layer responsible for the silk screen, so let’s turn off some of the layers to get a clear view of what we are working on.

Open the Layers list by clicking the Layers command, and select just the layers “Pads,” “Dimension,” “tPlace,” “tOrigins,” “tNames,” and “tValues.” Figure 5-24 shows the result of this.

Images


FIGURE 5-24   Hiding layers.

This is actually quite a mess. Labels are in different-sized fonts, and some are overlapped by the part outlines. This is quite common because the parts that we have used have been provided by different manufacturers all with their own standards of EAGLE part design. There is some tidying up to be done.

For instance, there is not really any need to label every LED. Just labeling LED1 and LED10 would be fine. To remove the extra labels, we need to use the Smash command to separate the labels from the parts. In fact, we are probably going to end up modifying, moving, or deleting pretty much every label on the board.

Very few of the labels are in the correct place, so we may as well smash them all by selecting the Smash command, selecting the Group command, dragging over the whole board area, and from the right-click menu selecting “Group: Smash.”

Having used Smash to separate the labels from the components themselves, carry out the following actions to do some tidying up:

       • Move the labels for LED10 and LED1 away from the holes.

       • Delete the labels for LED2 through LED8.

       • Delete the 1N4148 value on D1.

The fonts are all different, so we will use the Change tool to change all the labels to be of size 0.05 and font type Vector. Generally, it is better to use the Vector font everywhere on the board. This will guarantee that the text on the actual board will look like the text in the Board Editor.

Click on the Change command (the icon looks like a wrench). Change only changes the last setting that you make in the Change menu. On the menu, you will see “Size.” Change this to be 0.05. Select the Group tool, select the whole board, and then right-click and do “Group: Change.”

Repeat the process but setting each label to be the Vector font by selecting “Font” and then “Vector” from the Change menu. Then again, set the “Ratio” to be 12.

Finally, repeat the process one last time using the Change tool to set the “Layer” of all the labels and component outlines to be “tPlace” because this is the layer that we will use for the silk screen. Note that this is probably best not done as a Group selection unless you are very careful not to select the board outline, which is in the “Dimension” layer and needs to remain on this layer.

Drag the labels about so that they don’t overlap. Note that to move, you must have the Origins layer selected.

When you think everything is changed, go to the Layers menu and deselect “tNames” and “tValue” so that only “tPlace,” “Dimension,” and “Pads” are selected. The silk screening should now look something like Figure 5-25. The board looks pretty good now.

Images


FIGURE 5-25   The “tPlace” layer.

We can just add text to the tPlace layer using the Text command. Use this command to add labels that identify the two terminals of J1. Note that after selecting the Text command and entering the text in the box, you can set the layer (“tPlace”) as well as the font size and characteristics to match those we set earlier using the Parameter toolbar. That is,

       • Layer: tPlaceGND

       • Size: 0.05

       • Font: Vector

       • Ratio: 12

Figure 5-26 shows the text added.

Images


FIGURE 5-26   Labeling the terminals of J1.

Add Text to the Bottom

Having legible and well-placed labels will make the board much easier to assemble. However, if you are just making one board for yourself, then it does not matter too much.

The final step in this process is to add some text (a web address) to the silk-screen layer on the bottom of the board (“bPlace”). EAGLE always shows you the view looking down at the top layer, so writing on the underside of the board will be mirrored in appearance. We have a lot of text on the top, so use the Layers command to hide the “tPlace” layer. Then use the Text command to add some text. Remember to select the layer “bPlace” in the Layer dropdown on the Parameters toolbar. You can see the result of this in Figure 5-27.

Images


FIGURE 5-27   Adding text to the “bPlace” layer.

This completes the through-hole version of the board design. The final version of the board, with “bPlace” hidden, is shown in Figure 5-28. Next, we will look at a surface-mount version of the same design.

Images


FIGURE 5-28   Final through-hole board layout.

Images

Sound Meter Layout (Surface-Mount)

Having successfully made the through-hole version of the PCB, it is time to look at producing a second, more modern version of the board that uses surface-mount components.

In an ideal world, you would be able to use the same schematic but with surface-mount device (SMD) package variants of the components. Unfortunately, this is not possible in EAGLE. This does not mean, however, that you have to start the whole design over. The process is to take a copy of the schematic for the through-hole version and then go through all the components, replacing the through-hole parts with SMD equivalents.

Create a New Schematic and Board

Make sure that you have saved your through-hole schematic. You are now going to save a copy of the schematic under a different name but in the same project as the original. Thus, with the Schematic Editor open, select the option “Save As…” Then save the schematic with the name soundMeter_sm.sch, as shown in Figure 5-29. The addition of _sm indicates that this is the surface-mount version. It has no special significance as far as EAGLE is concerned; it just allows us to distinguish the two versions.

Images


FIGURE 5-29   Saving the schematic to copy it.

After saving the copy of the schematic, you will notice that the Title field in the schematic’s frame will now also be updated to soundMeter_sm, allowing us to tell our schematics apart should we print them out.

Saving a copy of the schematic in this way will automatically create a copy of the board called soundMeter_sm.brd that is linked to the new schematic.

Swap Parts on the Schematic

The surface-mount schematic (soundMeter_sm.sch) is currently exactly the same as the through-hole schematic. We now need to go through the parts on the schematic and swap them for equivalent SMD packages. The microphone and screw terminals will remain as through-hole devices.

Let’s start with IC1. Click the Replace command on the Schematic Editor’s Command menu and then use “*7611*” as the search string (Figure 5-30).

Images


FIGURE 5-30   Replacing IC1.

Looking at the search results, you can see that the chip is available as DIL08 (through hole) and SO08 (small-outline eight-pin SMT). So select the SMT option, and hit “OK.” Now click on IC1 on the schematic. It may seem like nothing has happened, but if you now look at the board layout, you will see that IC2 now looks very different (Figure 5-31).

Images


FIGURE 5-31   IC1 SMD package on the board layout.

You can also see that the routing is now, of course, all in a mess. This is only going to get worse, so we may as well go back to air wires by doing a group ripup. To do this, click on the Ripup command, then click on the Group command, drag over the whole area of the board, and right-click and slect the option “Ripup: Group.”

We may as well set the Board Editor back to a useful state ready for layout by just showing the layers “Top,” “Bottom,” “Pads,” “Vias,” “Unrouted,” “Dimension,” “tPlace,” and “tOrigin.” We were kind of lucky with IC1 in that there was a drop-in SMD replacement using the same pin names. Unfortunately, things are not quite so easy for IC2. Using the Replace tool and a search string of “*3914V*” will find an SMD equivalent of the chip, but when we try to do the replacement, we will get an error message Date A in the old version of device set LM3914N can’t be mapped to any gate in the new version of this device set (neither by name nor coordinates).

This is so because the part has been designed differently from the original and uses different names for many of the pins. For example, the connections to the LEDs are called LED1, LED2, and so on rather than L1, L2, and so on (Figure 5-32).

Images


FIGURE 5-32   SMD package for IC2.

In Chapter 11 you will see how to copy and modify parts from libraries, but for now, we will reconcile ourselves to having to manually replace IC2. This may seem a little daunting but is pretty straightforward. A good tip is to print or take a screen capture of the existing schematic to use as a reference before deleting IC2 prior to replacing it.

Use the Delete command to remove IC2 from the schematic. This will leave a big hole in the schematic but otherwise leave the net lines in tact. Unfortunately, these will also be in the wrong positions when we add in the SMD version of IC2, so make a Group delete of all the net lines close to where the new IC2 will be added. Now use the Add command to add in the new version of IC2 (search for “*3914V*”). The result will look something like Figure 5-33.

Images


FIGURE 5-33   Making room for the replacement IC2.

Using your screen capture or printout of the old schematic as a reference, connect everything up again so that the schematic looks like Figure 5-34. Note that the newly added IC2 will need to be dragged onto the board because it will initially be placed outside its outline.

Images


FIGURE 5-34   Revised Schematic with IC2 replaced.

You will also need to copy a V+ terminal and connect it to the V+ pin of IC2.

Switch back to the schematic view, and replace the components as per Table 5-2.


TABLE 5-2   SMD Replacements

Images

As you replace the components with their SMD equivalents, switch over to the board layout every now and then and notice how the components have changed and how much more sparse the board is looking.

Now that we have all the components swapped over to SMD equivalents, we need to do a bit of tidying up and reroute the board.

Resize and Tidy the Board

You can pack a lot more into an SMD design than a through-hole design. So we can take the opportunity to make the board a bit smaller and move the LEDs closer together. The mounting holes on the first design were also rather large, so we can reduce them to just two smaller holes. Note that to be able to delete or move holes, you will need to make the “Holes” layer visible.

It is easier to rearrange the components first and then adjust the size of the board to just contain them. Rearrange the components on the board until you are happy with the result, and then run the autorouter again. When running the autorouter this time, change the routing grid to 10 mils when the Autorouting window opens. This will allow the router to work around the smaller pitched pins of the SMD components. The final result might look something like Figure 5-35.

Images


FIGURE 5-35   Final SMD board layout.

Images

Manual Layout

In the example layouts thus far, we have made use of the services of the autorouter. It does a pretty good job and is certainly much quicker than laying out the board by hand. However, it is a good idea to know how to lay out a board manually for a number of reasons:

       • The autorouter cannot always completely lay out a board that a human mind can.

       • For some circuits where the designer (that’s you) wants to keep certain track lengths short and thick, a full manual layout usually will yield better results.

       • It’s fun. If you like puzzles, then you will probably enjoy laying out a board by hand. It can be a fascinating challenge to lay out a board so that all the tracks are as short and direct as possible with a minimum number of vias. This is especially true when it’s a board that the autorouter believes to be impossible—it’s you against the machine!

I am going to lead you through laying out the through-hole version of the sound meter project starting with the same component positions as we used in the automated layout. So that both layouts can be available to compare, you will find the design files for this called soundMeter_manual.sch and soundMeter_manual.brd. The staring point is the unrouted board, as shown in Figure 5-36.

Images


FIGURE 5-36   Unrouted board.

As with the automated layout, we have kept the ground plane on the bottom layer.

I like to start a manual layout with the power-supply nets. In this design, many of these are provided by the ground plane, so we can start by laying out the positive supply.

Once the Route tool has been selected, the Parameter toolbar will display the options available to us. I described these options at the start of this chapter. In Figure 5-37, I have set these parameters ready for routing the positive power line on the top layer.

Images


FIGURE 5-37   Routing toolbar.

The first thing to note is that the Layer dropdown is set to “1 Top.” We then have to select the fourth of the “Wire bend” types. It does not really matter which one you chose, but I find that this one produces nice-looking layouts. The miter radius is set to 0 because we do not need the corners of the tracks to be rounded. The width is set to 0.02 because this is the track width that we specified for the power-supply net class.

We have also opted to use square vias with the size set automatically. But we will try to make a layout that does not need any vias.

The only parts of the design that require significant current to flow are the power supply to IC2 and the supply lines to each LED. In fact, the supply to IC2 could be as much as 200 mA if all the LEDs are lit.

When using the Routing tool, start at a pad, and an air wire will become highlighted along with the rest of that air wire’s net. This indicates all the possible target points for your routing, so just move the cursor along the route you want to take, left-clicking to make a waypoint in the route. When you arrive at a valid destination, the route will stop automatically, and you can go off and find another air wire to route.

If you go wrong, you can, of course, use the Undo command. If you find an earlier mistake that you want to correct, the just select the Ripup command, and click on the tracks that you want to route again and they will revert to being air wires.

You can also modify the path of the routing using the Move command if the track is just a little off and does not need complete rerouting.



Figure 5-38 shows the positive supply to both ICs routed on the top layer. Notice how we have kept the route of the positive supply from J1 to IC2 as direct as possible. We have also routed the supply to the LEDs around the edge of the board so that the long track does not cut off a section of the board near the top, which would then be difficult to route around.

Images


FIGURE 5-38   Routing the supply nets.

My next step is normally to route easy wins, that is, things such as the connections between IC2 and the LEDs. Figure 5-39 shows these routed on the bottom layer. Remember to change the layer in the dropdown list to bottom and to change the width to 0.01 (10 mils).

Images


FIGURE 5-39   Routing the LEDs.

At first, it will seem like the routing on the bottom layer is interfering with the ground plane. When you press “Ratsnest,” gaps around the tracks will magically open up.

There are some other obvious tracks to be laid around the center of the board. In particular, we want the tracks for the feedback components around IC1 (R3 and C1) to be kept short and close to IC1. While we are routing on the top layer, let’s route anything we can do without to take a long route around the board. So let’s complete them using the top layer (Figure 5-40).

Images


FIGURE 5-40   Routing the rest of the top layer.

We now have just one air wire (between IC1 and C4) that cannot be easily routed on the top layer. Therefore, switching to the bottom layer, we can add this in. The final result of the manual routing is shown in Figure 5-41. You might like to compare this with the automatic routing shown back in Figure 5-28.

Images


FIGURE 5-41   Final manual layout.

Images

Summary

In this chapter, we have designed two versions of the same board, one using through-hole components and one using surface-mount technology. Having produced our board design, the next logical step is to generate the design files that will allow the boards to actually be made. This is the topic of Chapter 6.