Understanding Gerber Files and Ordering PCBs from a Fab House
What Gerber layers are, how to check Gerber files before sending them out, and the general process for ordering PCBs from a fab house — illustrated with a Gerber set exported from an ESP32 + DHT22 circuit.
This guide explains what each layer in a Gerber file set exported from KiCad means, how to check them with a Gerber viewer before sending them out, and the general process of ordering PCBs from a fab house — using the Gerber set for an ESP32 DevKit V4 + DHT22 circuit as a working example.
Detailed guide
What Gerber layers are (F.Cu, B.Cu, silkscreen, soldermask, Edge.Cuts, drill), how to check them with a Gerber viewer, and the general process for ordering PCBs from a fab house.
1. Introduction
Gerber is the industry-standard file format that virtually every PCB fab in the world can read — it describes the geometry of each layer on the board (copper, soldermask, silkscreen, board outline, etc.) as 2D vectors, along with a separate drill file for pad/via holes. Understanding what each Gerber layer means lets you check your own design before sending it out, avoiding a botched order from a missing layer or a wrong hole size. This guide explains the common Gerber layers, how to review them with a Gerber viewer, and the general PCB fab ordering process — using the Gerber set exported from an ESP32 DevKit V4 + DHT22 circuit as the running example throughout.
2. Components Needed (the circuit used to export the example Gerbers)
| Component | Qty | Notes |
|---|---|---|
| ESP32 DevKit V4 | 1 | The main control board |
| DHT22 (AM2302) | 1 | The example sensor, shown on the PCB layout |
3. Wiring Diagram
| DHT22 | ESP32 DevKit V4 |
|---|---|
| VCC | 3V3 |
| GND | GND |
| DATA | GPIO4 |
4. Gerber Layers You Should Know
| Layer | Meaning |
|---|---|
| F.Cu / B.Cu | The front copper (F.Cu) and back copper (B.Cu) layers — where the actual conductive traces and pads live |
| F.Mask / B.Mask | The soldermask layer — areas NOT covered by insulating paint, exposing bare copper for soldering; everywhere else is coated (usually green) to protect the copper from oxidation/shorts |
| F.SilkS / B.SilkS | The silkscreen layer — text, symbols, and component outlines printed on the board surface to help whoever assembles it identify component placement and pinout |
| F.Paste / B.Paste | The solder paste layer — only needed when making a stencil for SMD reflow soldering, not required for a simple hand-soldered board |
| Edge.Cuts | The board outline — defines the PCB's final physical shape and dimensions |
| Drill File (Excellon) | Not strictly a Gerber file, but always included — a list of coordinates and diameters for every drilled hole (through-hole pads, vias, mounting holes) |
For the ESP32 + DHT22 circuit in this guide, the PCB needs at minimum: F.Cu (copper connecting the VCC/GND/DATA signals), F.Mask, F.SilkS (printing component names/pins), Edge.Cuts, and a drill file for the through-hole pads on the ESP32 header and the DHT22.
5. Checking Gerbers with a Viewer Before Sending Them Out
After exporting Gerbers from KiCad (File → Fabrication Outputs → Gerbers, along with Generate Drill Files), always reopen the full set in a Gerber viewer (built into KiCad, or your fab's online viewer) to cross-check before sending:
- Toggle each layer on and off individually to make sure nothing is missing (especially Edge.Cuts — without it, the fab has no idea what shape to cut the board into).
- Check that traces and pads appear in the same positions as in the PCB Editor — a mismatch usually means the wrong unit (mm/inch) or the wrong coordinate origin was used on export.
- Check that the silkscreen doesn't overlap bare copper pads — this causes printed text to disappear or pads to get obscured, making soldering harder.
- Cross-check the number of holes in the drill file against the actual number of through-hole pads — a missing hole means that component simply won't fit.
6. The General PCB Fab Ordering Process
Most PCB fabs follow a fairly similar ordering process:
- Zip the files: bundle all the Gerber and drill files into a single .zip archive.
- Upload to the ordering system: most fabs automatically parse the Gerbers and show a 2D/3D preview for you to confirm before ordering.
- Choose manufacturing options: number of copper layers, board dimensions, board thickness (usually 1.6mm by default), soldermask color, surface finish (HASL, ENIG, etc.), and order quantity.
- Confirm the preview and pay: fabs typically run their own internal DRC based on their manufacturing capabilities — if they spot a problem (too-thin traces, too-tight spacing), they'll flag it before production.
- Production and shipping: standard (non-expedited) production usually takes a few business days, plus shipping time depending on your location.
Actual pricing depends on layer count, dimensions, quantity, and the fab itself — this guide only describes the general process and doesn't name a specific price or vendor, since the market changes constantly.
7. ESP32 + DHT22 Sample Code (the circuit used to export the example Gerbers)
#include <DHT.h>
#define DHTPIN 4
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
const unsigned long TELEMETRY_INTERVAL_MS = 2000;
unsigned long lastTelemetryAt = 0;
void setup() {
Serial.begin(115200);
delay(200);
Serial.println();
Serial.println(F("=== ESP32 + DHT22 - Vi du minh hoa cho bai viet KiCad/PCB ==="));
Serial.println(F("Boot OK. Khoi tao cam bien DHT22..."));
dht.begin();
Serial.println(F("San sang doc du lieu."));
}
void loop() {
unsigned long now = millis();
if (now - lastTelemetryAt >= TELEMETRY_INTERVAL_MS) {
lastTelemetryAt = now;
float humidity = dht.readHumidity();
float temperatureC = dht.readTemperature();
Serial.print(F("{\"temperature_c\":"));
if (isnan(temperatureC)) {
Serial.print(F("null"));
} else {
Serial.print(temperatureC, 1);
}
Serial.print(F(",\"humidity_pct\":"));
if (isnan(humidity)) {
Serial.print(F("null"));
} else {
Serial.print(humidity, 1);
}
Serial.print(F(",\"uptime_ms\":"));
Serial.print(now);
Serial.println(F("}"));
if (isnan(humidity) || isnan(temperatureC)) {
Serial.println(F("[WARN] Doc cam bien DHT22 that bai - kiem tra day noi hoac dien tro keo len DATA."));
}
}
}
8. Common Issues
| Issue | Cause | Fix |
|---|---|---|
| Fab reports "missing outline layer" | Forgot to enable Edge.Cuts when exporting Fabrication Outputs | Re-export the Gerbers, making sure Edge.Cuts is selected in the layer list |
| The board arrives at the wrong size | Wrong unit or scale used in the Plot dialog when exporting Gerbers | Double-check the unit (mm) and confirm via a Gerber viewer before sending, comparing the displayed dimensions against the original design |
| Holes are missing or misplaced | Forgot to check "Generate Drill Files", or used a drill format the fab doesn't support | Re-export the drill file in Excellon format, and check that the hole count matches the number of through-hole pads |
| Silkscreen text is faint or missing on the physical board | Silkscreen overlapped a bare copper pad and got automatically trimmed by the fab to prevent solder bridging | Check it in a Gerber viewer and move the silkscreen text off the pad area before re-exporting |
9. Summary
A complete Gerber set includes the copper layers (F.Cu/B.Cu), soldermask (Mask), silkscreen (SilkS), board outline (Edge.Cuts), and an accompanying drill file. Before sending it to a fab, always reopen it in a Gerber viewer to check that every layer is present, dimensions are correct, and there's nothing rendering unexpectedly. Most fabs follow the same ordering flow: zip the files → upload → confirm the preview → pay → manufacture → ship. Understanding this flow lets you confidently order your first PCB without depending on any one specific vendor.