IoT 201: Intro to printed circuit boards for IoT

Editor’s note: We continue our IoT 101/201 series with this introduction to printed circuit boards for IoT products. Most IoT products will have at least one, and if you’re not familiar with the process of creating one, it can get a bit confusing. This article outlines the processes and decisions that happen during the design and fabrication of your boards.

Taking your IoT design from breadboard to market requires a printed circuit board design, probably including several revisions, as you iterate your way to product launch. Whether you tackle the job yourself or outsource it, here’s the process that needs to take place as well as the key decisions that need to be made.

Material selection

This being part of our introductory tutorial series, we’ll start at the very beginning. When most of us say “printed circuit board” we’re thinking about a material called FR-4: a thin layer of copper laminated on one or both sides of a fiberglass core. The “FR” designation comes from a flame retardant added to the glass core. (In rare circumstances you might skip the retardant so your circuit card fails quickly in case of fire, but if you have a design like that you’re way beyond the scope of this IoT 201 discussion.) You may also want a flexible circuit for a wearable application or a semi-flexible circuit to solve a tough packaging problem, but for now I’ll assume “circuit card” means a rigid structure built from FR-4 material. Here’s the cross-section of a typical two-sided PCB you’ll get back from your supplier:

pc board details
Elements of a finished 2-sided PCB
  • Board substrate based on FR-4 material comes in a variety of colors and thicknesses. Common thicknesses of finished boards include 1.57 mm (0.063”) and 2.36 mm (0.093”) but you’ll find most suppliers can produce thinner or thicker boards if you need. Since IoT boards tend to be small and well supported, the thin material is probably just fine. Thicker boards tend to be used for backplanes and motherboards where flexing during use can cause failures, or when you have too many layers to fit in a thin profile.
  • Copper cladding is specified as a thickness or as a weight per surface area. A standard spec for PCB copper is 0.035 mm (thick) or 1 ounce (copper per square foot). The copper cladding will be etched during processing to leave only pads and traces of your circuit design.
  • Solder mask is applied to the etched board to repel solder during final assembly. The mask is essentially a photographic negative of the copper layer and is not something you need to explicitly design.
  • Surface finish is applied over the copper traces to prevent corrosion of the metal traces and to bond well with the solder. This process used to involve lead and other heavy metals that no longer meet international standards. Look for a supplier that offers lead-free HASL (Hot Air Solder Leveling), ENIG (electroless nickel immersion gold), ENEPIG (electroless nickel electroless palladium immersion gold), or other surface finishing technique that meets RoHS (Restriction of the use of Hazardous Substances) and WEEE (Waste Electrical and Electronic Equipment) requirements.
  • Vias pass a signal (or power trace) from one layer of a PCB to another. Vias are drilled and then plated through or filled with a rivet.

If two layers aren’t enough for your design you can stack a series of two-layer boards on top of each other. Each two-layer component will be etched separately, then laminated into the total stack before drilling, surface plating, and application of solder mask and silk screen. The board thickness spec will be for the entire stack; the copper spec will apply to each layer.

Note that it’s desirable to hold off the drilling step until the entire stack is assembled, even when drilling holes for vias that don’t connect to all layers. However, it’s possible to drill and plate blind vias between a subset of the layers, say between the bottom two layers in the following illustration. That adds a step in the processing of your board and therefore often increases cost, but sometimes it’s the only way to route a complicated design. I say “often” increases cost because a few strategically placed buried vias sometimes make the difference between a four-layer and a six-layer board.

pc board layers
Boards of four or more layers are initially etched as a series of two-layer boards, and then stacked.

Board design

Most people think of board design as a make vs. buy decision. I suggest a hybrid approach: outsource the initial design but prepare to modify the design in house so you can rapidly iterate your product. This approach outsources the steepest part of the learning curve: getting a first design that implements your prototype. It also proserves control over the iteration cycle and avoids problems when and if you want to change design houses down the road.

Whatever your strategy you’ll need to consider three aspects of the design. The mechanical design includes the outline of the PCB and how it attaches to the housing. I won’t go into that here at all. I’ll focus on the two electrical aspects of board design: layout of components and routing of the signal and power traces.

Schematics and tooling

To get started you’ll need a schematic of your entire design, entered in the CAD software package of your choice. The screenshots in this tutorial show Eagle desktop software from Cadsoft. The tool is available as freeware for evaluation, but to use it for commercial purposes you need to buy at least the Standard license ($69 / 75.14 Euro). That license allows you to create boards with up to 2 signal layers, up to 100 x 80 mm routing area, described in up to two pages of schematics. For reference, that’s enough to build an Arduino board. A license that supports four-layer designs will set you back $820.

Each component in your schematic will need to be specified by part number, including packaging options; the software taps component databases for pin-outs and package dimensions.

Grounding and decoupling

Improper grounding causes intermittent problems that will drive you nuts, so before discussing board layout let’s talk about powering and grounding your production circuitry. Grounding problems are especially vexing for mixed-signal designs typical of IoT products. The problem stems from the dual roles of “ground”. On the one hand, ground is a reference voltage. The single-sided analog inputs of ARTIK 5 and 10 modules are referenced to ground, as are almost all digital signals on the board. On the other hand, ground is also a return path for current from unipolar power supplies. Therefore noise on the ground plane becomes noise in your signals.

Capacitors help stabilize the power rail. Digital circuits spike current when they change states, with instantaneous currents far exceeding the current capacity of most power supplies. Inrush current at the leading edge of a transition can drop the supply voltage below reset thresholds. Plummeting current at the trailing edge of the transition can induce damaging voltage spikes due to the inductance inherent in the copper traces of a PCB.

Two simple techniques solve most grounding problems:

  • Separate digital and analog grounds. When you connect a component to ground in your schematic, specify whether you mean digital ground or analog ground. Then connect all digital grounds, separately connect all analog grounds, and finally connect digital and analog ground networks at only one point on the circuit board.
  • Add decoupling capacitors near the power supply pins of every active component in your design. A 0.1 uF capacitor is usually sufficient. Place the capacitors as close to the power supply pin as possible. Ceramic, surface-mount packages are the default choice, but if you need to use through-hole capacitors keep the leads as short as possible to minimize inductance.
PCB schematic
Note the decoupling capacitors on each power supply pin of the ARTIK 10 developer board’s Arduino interface.

Layout

Once the schematic is complete it’s time to start designing your board. In Eagle just click the “Generate board” button while looking at your schematic. If you’re starting from scratch you’ll need to specify mechanical properties of the board. I’ll skip the mechanical details and jump right to the layout process: placing components on the board.

eagle screenshot

Here’s a good strategy for laying out your board:

  1. Check the design rules for your layout package. Chances are the default settings are just fine, but it doesn’t hurt to compare them against the default specs for the board shop you plan to use.
  2. Turn on “snap to grid” before placing anything.
  3. Connectors have special constraints so place them first. For example, if you’re building a plug-in card for an ARTIK developer board you’ll have pin headers that mate with sockets in the Arduino corner of the developer board. In fact you can start your design with an online search for “eagle cad Arduino shield template” to find design files with the correct outline and header placement. Then place any remaining connectors for sensors or other external devices, taking into account clearance for the mating connector and cable.
  4. Mounting holes, switches, LED, heat sinks, and other components may also require specific locations.
  5. Think neighborhoods when placing ICs. By grouping components that relate to each other you’ll make routing easier. Check design notes for your components for placement tips: packages frequently put all inputs on one side of the package and all outputs on the other.
  6. Which end’s up? Try to orient each package the same (pin 1 upper left for example) or at most two orientations (upper left and upper right).
  7. Watch polarity of parts like diodes and electrolytic capacitors. Set all positive leads in the same orientation and use a square pad for positive, round pad for negative lead.
  8. Give yourself room between components – it takes more space to run traces than most beginners expect. A good rule of thumb is about 10 mm (0.39”) between ICs, more for bigger ICs (like an ARTIK module). If you’re overly generous you’ll see slack after routing and can tighten up the placement and maybe save a little on board cost. If you start too tight, though, you’ll struggle to get the board routed and it may drive you to a multi-layer board.
  9. Don’t trust the tool to catch problems with components interfering with each other. Print the layout and lay your components on top.

Routing

Now it’s time to create the copper traces to connect your components. Here are some tips:

  • Remember snap-to grid.
  • Start with power and ground and make the traces good and wide. A default of about 0.65 mm (25 mils) is a good place to start. It’s best to run a wide rail with separate spurs for each current sink rather than daisy-chaining.
  • Direction matters. On two-layer designs, you typically designate one layer for “horizontal” traces and the other for “vertical”. To change directions or to cross traces, use a via.
  • Signal trace widths of 0.15 mm (0.006”) are standard.
  • Spacing between traces of 0.15 mm (0.006”) are standard.
  • Smaller traces are possible depending on your supplier. When turning a corner on fine traces use a radius or 45 degree bends. When copper is etched a corner naturally thins and fine lines can sometime fail.
  • Match trace lengths for parallel signals in high-speed circuits, for example address or data lines. The Eagle package includes a length tuning tool for this purpose. The tool also supports differential pair routing.
board trace details
In this layout detail from an Arduino reference design, notice the wide power traces and how the designer generally worked horizontally on the blue layer and vertically on the red layer, with yellow showing vias connecting the two layers.

Specify quality

There’s one last specification your board supplier will expect, and that’s a quality level. IPC-6011 details three levels of quality, typically denoted in a spec as IPC1, IPC2, or IPC3.

  • IPC1 General Electronic Products is probably sufficient for IoT end nodes. “The major requirement is function of the completed printed board.”
  • IPC2 Dedicated Service Electronic Products is worth considering for IoT gateways where “high performance and extended life is required and for which uninterrupted service is desired but not critical.”
  • IPC3 High Reliability Electronic Products is out of scope for most IoT designs. This level assumes “equipment downtime cannot be tolerated and must function when required such as in life support items or flight control systems.”

Iteration and advanced techniques

This introductory description makes the design process sound much more linear than it typically is: you’ll find yourself iterating through the process for all but the simplest boards. As you’re routing a section you may find a change in placement simplifies the process. Eagle and other CAD tools can automatically route sections of a design but you’ll probably need to do some manual work, too. As you’re placing components it’s sometimes useful to run the autorouter to test your placement: a high completion rate indicates a good layout.

ground fenceAs you work through your design you’ll probably come across challenges that are beyond the scope of this introductory tutorial. Here are two techniques to keep in mind:

  1. Place a ground fence around RF circuits to avoid cross-trace interference. Notice the copper traces around the RF circuits of this ARTIK 10 developer board
  2. Consider adding a literal ground plane. Complex designs often can’t be implemented on a two-layer board. While it’s possible to add a third layer, it’s more common to jump right to a four-layer design. Most designers designate one layer “ground”, one “power” and the remaining two “signal” layers.

Check your work

Once you think you’re done placing and routing your board, it’s time to check your work and order your first prototype boards. Here’s a quick checklist to be sure you’re ready:

  • Check for open connections. In Eagle click the ratsnest button while in design view and look at the message pane on the lower left of the screen. If it reports any “airwires” you’re not quite done! Look for floating gold lines and route the missing traces. If you can’t see the airwires try turning off all layers except “unrouted”.
  • Run the design rule check.
  • Once more, lay your components on a printout to look for obvious problems.
  • Decide who you want to build your prototype boards. You can order them from within Eagle or you can conduct an online search for prototype PCB suppliers.
  • Get a list of design rules from your candidate vendor and compare them against your design rules. Change vendors or your rules if they don’t match.

Then, order your printed circuit boards! When they arrive you’ll have taken that first step toward something that looks a lot like an IoT product.