How to generate Gerber and Drill files in KiCad 5

When you finished your design in KiCad, the last step before sending it off to the fab house is to generate the Gerber and Drill files. PCB fab houses will use these files to make your boards. Basically 3 sets of files need to be generated:

  • Gerber files

  • Drill files

  • Drill map files

The demo project kit-dev-coldfire-xilinx_5213 is used in this article. All the steps are tested in KiCad 5.1.9, there may be some minor differences if you use other KiCad versions.

Generate Gerbers

It’s strongly recommended to run DRC check before plotting the Gerbers.

Select File → Plot from the menu to open the Gerber generation dialog.

Figure 1. The Plot Menu Item

But to order PCBs from JLCPCB, the default settings CAN NOT be used directly, some fine-tunings are needed.

Select the Target Folder

At the top of the plot window, you can click the browse icon to select/create the target directory or just type the folder name you want. For example, in this tutorial we just type "project-name-gerbers" to replace the default "plots" (use other more meaningful names to replace "project-name"), when KiCad generates Gerbers, the folder will be created automatically.

It’s a good practice to output Gerbers into a separate folder, otherwise, they’ll mess the design files up and you need to pick them out manually.

Figure 2. Select the Target Folder

Select the Layers

On the left side, you’ll see which layers from our board design we want to turn into Gerber files. The following layers should be all checked.

  • F.Cu

  • F.Paste

  • F.Silks

  • F.Mask

  • B.Cu

  • B.Paste

  • B.Silks

  • B.Mask

  • Edge.Cuts which contains the board outline/cutouts.

  • In1.Cu, In2.Cu … are also needed for 4/6 layer designs.

In KiCad, layers that have a front and back version start with F. (for Front) and B. (for Back), but please note copper layer names can be changed in File → Board Setup. The function of each layer can be found in What is the meaning of the layers in pcb_new and in the footprint editor? (KiCad 5 and earlier)

General Options and Gerber Options

  • Check Plot footprint references, otherwise designators will not appear on silkscreen layers.

  • Check Exclude PCB edge layer from other layers, so the contents on Edge.Cuts won’t appear in other layers.

  • Check Exclude pads from silkscreen

  • Check Check zone fills before plotting

  • Check Use Protel filename extensions, this is recommended as JLCPCB prefers Protel filename extensions.

  • Check Subtract soldermask from silkscreen, this ensures no silkscreen on pads.

  • Use extended X2 format, don't care

So, this is the final settings we get:

Figure 3. Gerber Options

Now, click the Plot button at the bottom of the window. All generated Gerbers will be put in the target folder you specified before.

If the zone fills are out of date and you forgot to refill them, when Check zone fills before plotting is ticked, KiCad will ask you to confirm, just click Refill, then the file generation will continue.

Figure 4. Refill Zone

To order PCBs, the drill files are also needed.

Generate Drill Files

In the same dialog for Gerber files, click the Generate Drill Files button at bottom right, this will open the dialog for drill files.

You don’t need to change the Output folder because KiCad will automatically use the same folder for Gerbers.

Check these options:

  • Check Use alternate drill mode for "Oval Holes Drill Mode".

  • Check Absolute for "Drill Origin".

  • Check Millimeters for "Drill Units".

  • Check Decimal format for "Zeros Format".

The screenshot below shows the settings:

Figure 5. Settings for Drill File

Now, click the Generate Drill File button, the drill files will be generated and stored in the output folder.

Generate Drill Map File

This is optional, but suggested.

This can be done in the same dialog for drill files. Just check Gerber for "Map File Format", then click Generate Map File button at bottom right of the dialog.

This drill map file provides additional information for drill holes, it is for human reading, it indicates which holes are plated and which are not, it also indicates total slotted holes. More information, less probability of error.

Figure 6. PTH drill map

Figure 7. NPTH drill map

Verify the Files

Before uploading your Gerber files to JLCPCB for production, it’s highly recommended to cross-check the generated files with a 3rd-party Gerber viewer.

When you are checking the file, please pay attention to the following items.

  1. Does the board outline exist?

  2. Is the board outline watertight(continuous/no gaps)?

  3. Do all inner cutouts, unplated slots, V-cut lines show in the GM1 layer correctly?

  4. Do all drilling holes shown and are aligned with other layers correctly?

  5. Are vias covered or exposed as per your design?

  6. And the Silkscreen, do they look good?

  7. etc.

If you find any issues, fix them and export the Gerber/Drill files and check them in the Gerber viewer again.

There are some nice Gerber viewers here and there, just use the one you feel handy.

If everything is OK, now you can zip the out folder and place the order.

Generate BOM and Centroid Files for SMT Service

If you also need the SMT service from JLCPCB, the BOM and centroid files need to be generated as well. Please follow How to generate the BOM and Centroid file from KiCAD for how to do it.

Still need help? Contact Us Contact Us