Build a Custom-Printed Circuit Board

PCBs aren't so hard to make and needn't break the bank

Breadboarding a new circuit is a key skill and an important step in many projects—especially early on, when you need to move wires around and substitute components. But that very flexibility also makes it easy to knock wires out. Eventually, if your project is a keeper, you’re going to want something with a bit more permanence.

Printed circuit boards (PCBs) solve all those shortcomings. But most people don’t even consider translating a one-off project into a PCB design. For one thing, PCB fabrication has traditionally been expensive, viable only in commercial quantities. (One alternative is to do it yourself with etches and silk screens, a messy and time-consuming process.) Also, there are technical constraints involved with PCB designs that are daunting to the casual hobbyist. But it turns out that nowadays you can produce a professional PCB very inexpensively.

all aboard
Photos: James Turner
ALL ABOARD: The circuit board before [top] and after [bottom] it is populated with parts. Click on image to enlarge.

I only recently delved into the mysteries of PCB fabrication, for an upcoming IEEE Spectrum article on building a robotic digital microscope. Part of the project is a variable LED illumination system, and to dim LEDs you need to design a pulse-wide-modulation circuit. With a little research, I found a design based around a 555 timer chip, a power transistor, a couple of diodes, two resistors, and three capacitors. Not a huge number of components, but enough that I was dreading getting them all hooked up on a breadboard. Since I already had the design in hand, I was pretty confident it would work out of the box. That made it a perfect candidate for doing it as a PCB.

I had looked into custom PCBs a while back. I had even downloaded Eagle, a PCB design program from CadSoft Computer. I liked Eagle (and eventually returned to it for this project), but back then the cost of a single board—US $75 and up—stopped me. This time I discovered BatchPCB.

BatchPCB consolidates a bunch of individual projects onto a single large board and then cuts them apart when they come back from the factory. Small boards can be fabricated for under $20 this way. There’s a three-week turnaround, but I wasn’t in a hurry. I dove into designing my LED dimmer board.

A basic review of PCBs is in order here. A PCB consists of a thick, rigid insulating layer with conductive traces on the top and bottom. Because the middle insulates, the traces on the top and bottom can run over each other. To get a signal from one side to the other, you drill a hole called a via, which is like a trace running through the board vertically. You also drill holes for ICs, resistors, diodes, and other discrete pieces. The traces lead to the holes, and the components have solder pads, allowing them to be soldered in place.

Some components may be connectors to bring signals to the board, and you can also leave larger holes with solder pad rings around them to solder external wires directly. You can even add layers with traces in between the top and the bottom, although this can get pricey. At BatchPCB, a two-layer board costs $2.50 per square inch (about $0.40 per square centimeter), while a four-layer board costs $8 for the same area (about $1.24/cm2).

The first step in creating a custom PCB is laying out the schematic view. Place your components (which usually come from a component library included with your design software) onto a canvas, and then connect the pins with lines representing electrical connections. You may find yourself faced with multiple choices for the same part number. That’s because many components come in different packages, such as a DIP (dual in-line package) chip or a surface-mount chip. For hobby PCBs, you almost always want to go with the big, clunky DIPs and SIPs (system-in-packages), because they’re easily found at hobby venues and are easier to solder than surface-mounted devices, which are meant for commercial applications. Although the various packaging options may look the same in the schematic view, they will appear very different when you go into the layout view to actually design the board.

board room
Photos: James Turner
BOARD ROOM: First lay out the components [left], then organize them and route the traces [right]. Click on image to enlarge.

In addition to your components and interconnections, you’ll also have to place any needed power or ground signals. The Eagle library includes such components as VCC, VDD, and GND, for just this purpose. You also have to remember to place connectors on the board to bring in power and ground, as well as to connect the board to exterior devices such as LEDs or a potentiometer.

When you have everything where it needs to be, you can run an electrical rule check, or ERC, to make sure there are no glaring errors. Common problems include wires that look like they’re connected but aren’t (in Eagle, connected wires have little dots at the intersections) and power or ground connections you forgot to hook up. Remember that the ERC validates only the design’s electrical properties, not that the board will actually do what you want!

Once you’re happy with the schematic, you can switch over to the board layout view. When you first do this in Eagle, the components are scattered randomly, with the wires directly connecting between the pins. You should move around components in a way that makes sense (connectors at the edges, for example). You’ll still be left with a rat’s nest, however. In order to produce the board, you must assign signals to a layer, and different signals on the same layer can’t touch.

With Eagle, you have to do this by hand unless you pay for the professional version, which has auto-layout capabilities that route your signals with the press of a button. Some PCB vendors offer their own design tools that can also do this for you.

With the signals laid out, you can finally run a design rule check, or DRC. This makes sure you won’t have drill holes too close to signal lines or traces too close to each other or the end of the board. The rules are customizable, and BatchPCB offers a file that will set up Eagle with its preferred DRC values. If your design passes the DRC, you’re ready to upload the design files.

You can (and should) also add silk-screen lettering on the top using a special layer. This printing indicates where components should go with outlines and part numbers, so you won’t put that 100K resistor where the 1K one should go.

The lingua franca of PCB fabrication is the Gerber file, named for Gerber Systems, the original creators of the format. Each board will have multiple files. There’s one for each layer and the locations of solder pads. A separate ”drill file” defines where the holes will be drilled in the board.

When you upload these files to BatchPCB (following some fairly complete walkthroughs available on the site), BatchPCB runs its own DRC and also produces image files showing what the finished layers will look like. You can print these out and make sure your components will fit in the holes. Finally, just give BatchPCB your payment info and sit back for a few weeks.

When my boards arrived, I couldn’t have been more pleased. They looked so professional, down to the silk-screened component symbols. Better still, they worked perfectly. I had ordered two boards, and paid $20 (of which $14 went toward setup and shipping). So I got my boards for effectively $10 apiece. At higher quantities the pricing works out even better.

If you’ve never designed a PCB, I highly encourage it. For $20, you’re risking a bunch of time but hardly any money. And the pride you’ll feel holding a commercial-quality board of your own making? Priceless.

This article originally appeared in print as "Board Certified."

About the Author

James Turner is a contributing editor for O’Reilly Media and a correspondent for the Christian Science Monitor. His 15-year-old son, Daniel, has also caught the DIY bug and occasionally assists Turner in brainstorming his designs.

Advertisement
Advertisement