ProjekinAja. Embedded Systems Stage 5 · PCB Design Lesson 5.8
● Stage 5 · Lesson 5.8

DRC, DFM, and Getting a Board Manufactured

DRC tells you the board matches your rules. DFM tells you whether anyone can build it. They are not the same rules.

⏱ ~26 min read 🧠 Rules vs capability 🛠 KiCad Board Setup, kicad-cli, an order form

🎯 By the end you'll understand

How to turn a fab's capability sheet into design rules that actually protect you, and why setting them to the fab's absolute minimum is the wrong move. What design-rule checking genuinely verifies and the specific classes of defect it has no model of at all — mask slivers, unfilled vias in pads, parts too close to a scored edge, and placement rotations that are correct in your tool and wrong in the assembler's. How to generate Gerber X2, drill, BOM and placement files reproducibly from the command line, what every field in a placement file means, and why the assembler's rendered preview is the last free gate before a board exists. And what five assembled boards cost against twenty-five, which is a lesson about fixed costs rather than about boards.

KEY INSIGHT"DRC clean" is a statement about you, not about the board

Zero errors, zero warnings, exclusions all reviewed. The fab rejected it in four hours for a solder-mask sliver between two pads on a part nobody had looked at since the library was copied.

A design-rule check compares your board against constraints you typed into Board Setup. If you typed generous numbers, DRC is generous. If you typed your fab's absolute floor, DRC only complains when the board is literally unbuildable. If you never enabled a check, it is not run. "DRC clean" therefore means precisely one thing: the board is consistent with the rules in this project file. It is not a claim about physics, about the factory, or about whether the thing will work.

Design for manufacture is the other half, and it runs against a different rule set that lives in someone else's building: what their drills, their etch line, their mask process, their pick-and-place and their reflow oven can actually do, at what yield, at what price tier. Some of those rules overlap with yours. Many do not, and a few of them the fab will simply apply to your data without asking — quietly changing the board you thought you designed. The job of this lesson is to move as much of that second rule set as possible into the first one, and to know exactly what remains outside it.

🔑 Hold onto this

Three rule sets act on your board, and only one of them is yours. Your design rules decide what DRC catches. The fab's capability decides what is buildable and at what price. The assembler's conventions decide what actually gets placed on the pads — and that third one has no checker at all, only a rendered preview that you have to choose to look at.

HOW IT WORKSFrom capability sheet to Board Setup

Every fab publishes a capability page: minimum trace and space, minimum drill, minimum annular ring, minimum hole-to-hole, copper-to-edge clearance, solder-mask dam, silkscreen line width and text height, and the tiers at which each of those changes price. These are current published capabilities, not physical constants — they improve, they vary between process tiers, and they differ between fabs. Read the page the week you design and copy the numbers into the project.

For a standard four-layer process of the kind Beacon uses, JLCPCB's published capability at the time of writing sits around 0.09 mm minimum trace and space, a 0.15 mm minimum via drill, and roughly 0.13 mm minimum annular ring. Those are the numbers below which the board either cannot be built or moves into an advanced price tier.

⚠ Do not set your design rules to the fab's minimum

This is the single most common misuse of a capability sheet. The fab's minimum is the edge of what their process can do, with their tolerances consuming all of it. Design at that edge and every normal variation — etch undercut, drill wander, registration between layers — eats into a margin that is already zero, so yield falls and the boards that do come back are the ones that happened to be lucky.

Set your rules above the fab's floor and let DRC defend that margin for you. Beacon's house rules are 0.15 mm trace and space against a 0.09 mm capability and a 0.25 mm drill against a 0.15 mm capability, with the tighter numbers used deliberately and only in the module's fan-out, where a documented exception is worth more than a blanket relaxation.

ConstraintFab capability (current, standard 4-layer)Beacon's house ruleWhy the gap
Minimum trace / space0.09 mm0.15 mmEtch variation; a 0.09 mm trace on a 1 oz layer has no margin against undercut
Minimum via drill0.15 mm0.25 mmDrill wander and aspect ratio on a 1.6 mm board; 0.15 mm used only in the module fan-out, as a documented exception
Annular ring0.13 mm0.15 mmRegistration tolerance between drill and copper; breakout is invisible after assembly
Copper to board edge0.2 mm0.5 mmRouting tolerance; exposed copper at a cut edge is a short waiting for a screwdriver
Solder-mask web (dam)~0.2 mm0.2 mm, checkedBelow this the fab removes the dam and merges the openings. The rule is only useful if you enter it
Silkscreen line / text0.15 mm line, 1 mm textsame, checkedThinner is dropped by the printer; smaller is illegible under a microscope during rework

Running DRC honestly

Two habits separate a DRC run that means something from a ritual.

CORE CONCEPTWhat DRC never checks

Here are the categories that live outside any rule you can type, roughly in order of how often they arrive as a surprise.

Four defects that pass every clearance rule Mask sliver dam 0.08 mm fab removes it; pads share one opening Via in pad solder wicks down starved joint above; no tool checks this Part at a scored edge V-groove 0.6 mm snapping flexes the board ceramic cracks, sometimes later Silk over a pad R14 clipped by the fab designator gone; rework is done by counting pads
None of these violates a copper clearance. Two of them (mask web, silk clearance) can be checked by KiCad if you enable the constraint and enter the fab's number; two of them cannot be checked at all and are found by a human, by the fab's engineering query, or by nobody.

SEE ITDFM checker

Eight real issues seeded into Beacon Rev A's layout. Choose the rule set you run DRC against, decide whether you will spend three minutes on the assembler's rendered preview, and see which gates catch what. The eighth issue is the one this whole stage has been walking towards.

⚙ Interactive · DRC vs DFM vs the preview

Deterministic. The rule sets are stated explicitly rather than assumed from any tool's defaults, and the fab-behaviour column reflects the usual practice of low-cost prototype assemblers: some issues are rejected, some are queried, and some are silently corrected on your behalf.

Caught by your DRC
—
Caught by fab DFM
—
Reaches the board
—
Verdict
—
Seeded issueYour DRCFab DFMWhat happens

Run it once with the fab's minimum as your rule set. DRC goes quiet, which feels like success and is the opposite: you have set your checker to complain only when the board is unbuildable, so it stops defending the margin between "buildable" and "buildable reliably". Then run it with the house rules on but the 3D preview skipped, and watch the number that reaches the board fall to one. That last one is not a rule problem. It is the placement rotation of a four-pad LED, and the only thing standing between it and twenty-five rotated parts is a person choosing to look at a picture.

IN PRACTICEGenerating the outputs

Four artefacts leave your project and become someone else's input.

ArtefactFormatWhat it carriesThe usual mistake
FabricationGerber X2 (or IPC-2581 / ODB++)Copper, mask, paste, silk, board outline — plus, in X2, attributes naming each layer's function and each pad's netPlotting plain RS-274X, so the fab's CAM has to guess which file is which layer; or omitting the Edge.Cuts layer entirely
DrillExcellonHole positions, diameters, plated versus non-platedA drill origin that differs from the plot origin, putting every hole in the wrong place relative to the copper
Assembly BOMCSVDesignators grouped by part, value, footprint, supplier part number, do-not-populate linesNo supplier part numbers, so the assembler guesses; or a "DNP" that is a note in a comment rather than a field
Placement (CPL / POS)CSVDesignator, value, package, mid X, mid Y, rotation, layerRotation in your tool's convention, which the assembler reads in theirs

Generate them from the command line rather than by hand. KiCad ships kicad-cli, which makes the whole output set a reproducible artefact of a specific commit instead of a folder somebody produced on a Tuesday.

tools/make-fab.shKiCad 8 CLI
# Reproducible fabrication and assembly outputs, tagged with the commit.
set -euo pipefail
OUT="fab/revA-$(git rev-parse --short HEAD)"
mkdir -p "$OUT"

kicad-cli pcb export gerbers --output "$OUT" beacon.kicad_pcb
kicad-cli pcb export drill   --format excellon --output "$OUT" beacon.kicad_pcb
kicad-cli pcb export pos --format csv --units mm --side both \
    --output "$OUT/beacon-cpl.csv" beacon.kicad_pcb
kicad-cli sch export bom --output "$OUT/beacon-bom.csv" beacon.kicad_sch

# The one manual gate that no script replaces:
#   upload, open the assembler's rendered preview, and look at every
#   polarised part. Rotation is not in any file you can diff.
zip -j "$OUT.zip" "$OUT"/*
fab/revA-9c41f2a/beacon-cpl.csvexcerpt · placement file
Designator,Val,Package,Mid X,Mid Y,Rotation,Layer
U1,ESP32-C3-MINI-1,MINI-1,7.60mm,-8.30mm,0,top
U2,TPS62840,SOT-563,21.00mm,-16.50mm,270,top
U3,MCP73831,SOT-23-5,26.00mm,-22.00mm,180,top
U4,SHT40,DFN-4-1EP,2.50mm,-22.50mm,0,top
D1,WS2812B-2020,LED_WS2812B-2020,30.20mm,-11.40mm,90,top
J2,JST-PH-2,B2B-PH-K-S,32.00mm,-21.75mm,0,top

Six columns, five of which are geometry that any tool computes correctly. The sixth is Rotation, and it is a translation between two conventions: your footprint's orientation as drawn, and the assembler's zero-degree reference for that package. Assemblers publish correction tables for common packages precisely because the disagreement is routine. The highlighted line is Beacon's LED, and the number in it is correct in KiCad and wrong on the machine — a defect that exists only in the gap between two conventions and is visible in exactly one place: the rendered preview the order page shows before you confirm.

💡 Read the engineering query, do not click approve

Low-cost fabs run an automated DFM pass and email you an engineering query for anything they cannot resolve — a hole they want to change, a mask opening they intend to merge, a part they are out of. The email usually arrives with a large "Confirm" button, and the fastest path is to press it. Read it instead. Every query is the factory telling you something specific about your board that no tool on your desk noticed, and half of them are describing a change they will otherwise make silently next time.

BEACONBeacon Rev A ordered: five boards, assembled

The Stage 5 milestone ends here: a reviewed schematic, a four-layer layout passing DRC against house rules, correct RF keep-out, a BOM and a placement file, Gerbers generated, and five assembled boards ordered. The order itself is a series of small decisions worth writing down.

Order optionBeacon Rev AReason
Layers / thickness4 layers, 1.6 mm, JLC04161H-7628Fixed in Lesson 5.4; the stackup is named on the order so the fab builds the one the design assumed
Surface finishENIGFlat coplanar pads for the module's castellations and the leadless parts; worth the upcharge on a 5-board run
Controlled impedanceNoNo 50 Ω feed line, and the USB pair is electrically short (Lesson 5.4). Recorded as a refusal with the condition that reverses it
Via processThrough only, no fillingBlind and buried vias would move the order into HDI pricing for no HDI need
Quantity5 boards, all assembledTwo for bring-up and destructive testing, one for the jig, two spare. Enough to find defects, few enough that finding them is cheap
AssemblyTop side onlyEvery part is on the top side by design, which halves the assembly setup and removes a whole class of second-reflow problems

What five boards cost against twenty-five

R5 caps the unit BOM at IDR 150,000 — around USD 9.5 — at 25 units excluding the enclosure. The five-board run will come in far above that, and the reason is arithmetic rather than economics.

🧪 Illustrative: the shape of the cost, not a quote

Assume fixed costs of about USD 60 for the run — stencil, assembly setup, and per-unique-part feeder charges — plus a PCB cost and a parts cost per unit. Get real numbers from a live quote; these are placeholders chosen to show the structure.

5 units25 units
Fixed cost per unit60 / 5 = USD 12.0060 / 25 = USD 2.40
Bare PCBUSD 2.00USD 1.50
PartsUSD 6.00USD 5.50
Per unitUSD 20.00USD 9.40

Same board, same parts, half the price — entirely because the fixed costs divide by five times as many units. Two consequences follow. First, a five-board prototype price tells you nothing about whether R5 is met; only the 25-unit quote does, which is why R5 is written at 25. Second, the number of unique parts is a real cost lever, because feeder setup is charged per line item: consolidating resistor and capacitor values across the design reduces the fixed cost that hurts most at low volume. Stage 6's cost lesson takes this from 25 to 25,000, where the curve changes shape again.

🧪 The pre-order checklist Beacon actually runs

Six items, ten minutes, run immediately before the upload: DRC clean against house rules with every exclusion carrying a written reason; layer 2 viewed alone and confirmed continuous; the antenna keep-out zone present on all four layers; the Gerber set opened in an independent viewer and compared layer by layer against the layout; the BOM checked for do-not-populate lines and supplier part numbers; and the assembler's rendered preview inspected part by part for every polarised component. The Lesson 5.9 review signs the first five. The sixth is the one Rev A skips.

WEAKNESSWhere manufacturing bites

✗ Copying the fab's minimums into Board Setup and calling it configured

It feels rigorous and it removes your only margin. Their minimum is the edge of the process with all the tolerance already spent, so a board designed at that edge is a board whose yield depends on luck. Worse, DRC then stays silent through the entire design, which trains you to trust a checker that has been configured not to speak. Design above the floor, use the floor deliberately in the few places that need it, and record each of those places as an exclusion with a reason.

✗ Never opening the Gerbers in an independent viewer

The plot dialog has a lot of checkboxes and some of them silently omit things: the board outline plotted on the wrong layer, an inner layer left unselected, negative-plane polarity, a drill origin that does not match. KiCad's own viewer is a good check and an unrelated viewer is a better one, because it exercises the files rather than the project. Five minutes, layer by layer, against the layout on the other screen. This is the cheapest gate in the whole stage and the most frequently skipped.

✗ Treating the assembler's preview as a formality

It is a rendering of what their machine will actually do, generated from your placement file after their rotation corrections. It is the only artefact in the entire flow that shows the intersection of your data and their conventions, it is free, and it is the last gate before a physical object exists. A rotated LED, a connector facing inwards and a diode placed backwards are all visible in it, in colour, in seconds. Rev A ships with a rotated LED on twenty-five boards because this step was skipped under schedule pressure, which is exactly when it is most needed.

KEY INSIGHTHow this connects

The outputs are generated and the order is ready to place. One thing remains before money is spent: a review that makes the board defend itself.

GLOSSARYKey terms introduced

Capability sheet
A fab's published limits — minimum trace, space, drill, annular ring, mask web — and the price tiers at which they change. Current practice, not physics; re-read before each design.
Solder-mask web
The strip of mask between two adjacent pad openings. Below the fab's minimum it cannot be printed, so the openings are merged and the pads share bare copper.
Gerber X2
Gerber with embedded attributes identifying each file's layer function and each pad's net, so the fab's CAM interprets the data rather than inferring it from file names.
CPL / POS file
The placement file: designator, value, package, centroid coordinates, rotation and side for every placed part. The rotation column is the field with no checker.
Fiducial
A bare copper dot with a mask opening used by assembly machines to locate the board optically; global fiducials on the panel, local ones beside fine-pitch parts.
Panelization
Arranging small boards on a larger panel with rails for assembly. V-scoring for straight edges, tab routing with mouse-bites for shaped ones; both stress the board when snapped.
Engineering query (EQ)
The fab's message asking you to approve a change they intend to make. The half you do not answer is the half they make silently on the next order.
Do not populate (DNP)
A BOM field marking a footprint that is deliberately left empty. A field, not a comment — comments are not read by the machine that loads feeders.

ACTIVE RECALLCheck your understanding

Answer in your own words first, then reveal.

1Why is setting your design rules to the fab's published minimums a mistake, and what should the numbers be instead?›

Because the published minimum is the edge of their process with all the manufacturing tolerance already consumed — etch undercut, drill wander, layer-to-layer registration. A board designed at that edge has zero margin against normal variation, so yield falls and the good boards are the lucky ones. It also silences DRC across the entire design, which trains you to trust a checker configured not to object. The rules should sit comfortably above the floor: on Beacon, 0.15 mm trace and space against a 0.09 mm capability and a 0.25 mm drill against 0.15 mm, with the tighter numbers used deliberately in the module fan-out and recorded as exclusions carrying a written reason.

2Name three defect classes that a fully clean DRC run is compatible with, and say which gate catches each.›

Any three of: a solder-mask web below the fab's minimum, which the fab removes and which KiCad only checks if you enable the constraint and enter their number; an unfilled via inside a solder pad, which no rule checks and which the fab's DFM pass usually queries; a component too close to a V-groove edge, which is caught by an edge keep-out you have to draw or by the fab's DFM; silkscreen crossing a pad, which the fab clips silently and which a silk-clearance rule catches if enabled; and a placement rotation that follows your tool's convention rather than the assembler's, which has no checker anywhere and is visible only in the assembler's rendered preview.

3Five assembled Beacons cost about USD 20 each and twenty-five cost about USD 9.40. Explain the difference and name the design lever it implies.›

The difference is almost entirely fixed cost divided by more units. A run carries setup charges — stencil, assembly programming, and a feeder charge per unique part — that do not change with quantity; at five units those spread to about USD 12 per board and at twenty-five to about USD 2.40. The variable parts, bare PCB and components, barely move. Two consequences: a five-board prototype price says nothing about whether R5 is met, which is why R5 is stated at 25 units; and the number of unique line items is a genuine cost lever at low volume, so consolidating resistor and capacitor values across the design reduces the fixed cost that dominates a small run.

4Your rotation for a part is correct in KiCad and wrong on the assembler's machine. Why does no checker catch this, and what is the only gate that does?›

Because there is nothing to check against. Rotation in the placement file is a number expressed in your tool's convention for that package; the machine reads it in the assembler's convention. Both are internally consistent, both files are valid, and no rule in your project encodes what the other party means by zero degrees. DRC checks geometry against your rules, and the fab's DFM pass checks manufacturability of copper and holes — neither has a model of what the part will look like once placed. The gate that catches it is the assembler's rendered preview: a picture generated from your placement file after their rotation corrections, showing what their machine will actually do. It is free, it takes three minutes, and skipping it under schedule pressure is precisely how Beacon Rev A ends up with twenty-five rotated LEDs.

Next: the review that makes the board defend itself →