How to export kicad PCB to gerber files

Posted by

Introduction to KiCad and Gerber Files

KiCad is a popular open-source software suite for electronic design automation (EDA). It is widely used by engineers, hobbyists, and students to design printed circuit boards (PCBs) for various electronic projects. One of the essential steps in the PCB manufacturing process is generating Gerber files from the KiCad design. Gerber files are industry-standard file formats that contain the necessary information for PCB fabrication, such as copper layers, solder mask, and silkscreen.

In this article, we will guide you through the process of exporting your KiCad PCB design to Gerber files, ensuring that your design is ready for manufacturing. We will cover the following topics:

  • Understanding the Gerber file format
  • Preparing your KiCad PCB design for export
  • Configuring the Gerber file output settings
  • Generating Gerber files using the KiCad Pcbnew module
  • Verifying and validating the exported Gerber files
  • Best practices and common pitfalls to avoid

By the end of this article, you will have a clear understanding of how to export your KiCad PCB design to Gerber files, enabling you to successfully fabricate your PCB.

Understanding the Gerber File Format

What are Gerber Files?

Gerber files are a set of standard file formats used in the PCB manufacturing industry to describe the various layers and features of a printed circuit board. These files contain the necessary information for PCB fabrication machines to accurately produce the designed PCB. Gerber files are named after the Gerber Systems Corp., the company that originally developed the format.

Gerber File Extensions and Their Meanings

Gerber files use specific file extensions to identify the different layers and aspects of the PCB design. Some of the common Gerber file extensions and their meanings are:

Extension Description
.GTL Top copper layer
.GBL Bottom copper layer
.GTS Top solder mask
.GBS Bottom solder mask
.GTO Top silkscreen
.GBO Bottom silkscreen
.GKO Board outline
.GTP Top paste mask
.GBP Bottom paste mask

Importance of Gerber Files in PCB Manufacturing

Gerber files play a crucial role in the PCB manufacturing process. They provide a standardized way to communicate the PCB design information to the fabrication house. The accuracy and completeness of Gerber files directly impact the quality and reliability of the manufactured PCB. Therefore, it is essential to ensure that the exported Gerber files are correct and adhere to the manufacturing requirements.

Preparing Your KiCad PCB Design for Export

Before generating Gerber files from your KiCad PCB design, it is important to ensure that your design is complete, error-free, and adheres to the manufacturing guidelines. Follow these steps to prepare your KiCad PCB design for export:

Design Rule Check (DRC)

Perform a Design Rule Check (DRC) on your PCB design to identify and resolve any design rule violations. The DRC helps ensure that your design meets the specified manufacturing constraints, such as minimum trace width, clearance, and hole size. To run a DRC in KiCad:

  1. Open your PCB design in the Pcbnew module of KiCad.
  2. Go to the “Tools” menu and select “DRC…”
  3. Configure the DRC settings according to your manufacturing requirements.
  4. Click “Run DRC” to perform the design rule check.
  5. Review and address any reported violations.

Copper Pour and Plane Connection

If your PCB design includes copper pour or planes, ensure that they are properly connected to the appropriate nets. Copper pour and planes help improve signal integrity, reduce electromagnetic interference (EMI), and provide better thermal dissipation. To check and connect copper pour and planes in KiCad:

  1. Select the copper pour or plane area in the Pcbnew module.
  2. Right-click on the selected area and choose “Properties…”
  3. Verify that the “Net” field is set to the correct net name.
  4. Click “OK” to apply the changes.

Silkscreen and Assembly Layer Review

Review the silkscreen and assembly layers of your PCB design to ensure that all the necessary information, such as component designators, polarity markers, and assembly instructions, are clearly visible and legible. The silkscreen layer provides important information for PCB Assembly and debugging. To review and edit the silkscreen and assembly layers in KiCad:

  1. In the Pcbnew module, select the “F.SilkS” or “B.SilkS” layer for the top or bottom silkscreen, respectively.
  2. Use the text and graphics tools to add, edit, or remove silkscreen elements.
  3. Ensure that the silkscreen elements do not overlap with pads, vias, or other critical features.

Board Outline and Dimension Check

Verify that the board outline and dimensions are correct and match your design requirements. The board outline defines the physical shape and size of your PCB. Incorrect board outline or dimensions can lead to manufacturing issues or incompatibility with enclosures. To check the board outline and dimensions in KiCad:

  1. Select the “Edge.Cuts” layer in the Pcbnew module.
  2. Use the measuring tools to verify the dimensions of the board outline.
  3. Ensure that the board outline is a closed shape and does not have any gaps or overlaps.

Drill File Generation

In addition to Gerber files, you also need to generate drill files that specify the location, size, and type of holes required for your PCB. Drill files are essential for the CNC drilling machines used in PCB fabrication. To generate drill files in KiCad:

  1. Go to the “File” menu in the Pcbnew module and select “Fabrication Outputs” > “Drill Files…”
  2. Configure the drill file settings, such as the file format (Excellon or Gerber), units (metric or imperial), and file options.
  3. Click “Generate Drill File” to create the drill files.

By thoroughly preparing your KiCad PCB design before exporting Gerber files, you can minimize the risk of manufacturing issues and ensure a smooth fabrication process.

Configuring the Gerber File Output Settings

KiCad provides various options to customize the Gerber file output settings according to your manufacturing requirements. Follow these steps to configure the Gerber file output settings in KiCad:

Accessing the Gerber File Output Settings

  1. Open your PCB design in the Pcbnew module of KiCad.
  2. Go to the “File” menu and select “Plot…”
  3. In the “Plot” dialog, you will find the Gerber file output settings.

Layer Selection

In the “Plot” dialog, you can select the layers that you want to include in the Gerber files. By default, KiCad plots all the visible layers. However, you may need to customize the layer selection based on your manufacturing requirements. To select the layers for Gerber file output:

  1. In the “Plot” dialog, locate the “Layers” section.
  2. Check the boxes next to the layers that you want to include in the Gerber files.
  3. Ensure that all the necessary layers, such as copper, solder mask, and silkscreen, are selected.

Plot Format and Output Directory

KiCad supports different plot formats for Gerber files, such as RS-274X and Gerber X2. Choose the appropriate plot format based on your manufacturing partner’s requirements. Additionally, specify the output directory where the generated Gerber files will be saved. To configure the plot format and output directory:

  1. In the “Plot” dialog, locate the “Plot Format” section.
  2. Select the desired plot format from the dropdown menu (e.g., “Gerber”).
  3. Specify the output directory by clicking the “Browse” button next to the “Output Directory” field.

Aperture and Pad Options

Aperture and pad options control how the Gerber files represent the pads and other features on the PCB. You can configure these options to optimize the Gerber file output for your specific manufacturing process. To set the aperture and pad options:

  1. In the “Plot” dialog, locate the “Options” section.
  2. Set the “Pad Drill Shape” to either “Oblong” or “Circular” based on your manufacturing requirements.
  3. Configure the “Plated Pad Over Drill” and “Unplated Pad Over Drill” values to control the pad size relative to the drill hole.
  4. Set the “Minimal annular ring” value to ensure a sufficient annular ring around the drill holes.

Gerber File Format Options

KiCad provides additional options to fine-tune the Gerber file format. These options include the coordinate format, zero suppression, and other advanced settings. To configure the Gerber file format options:

  1. In the “Plot” dialog, click the “Gerber Options…” button.
  2. Set the “Format” to “4.5” or “4.6” based on your manufacturing requirements.
  3. Choose the appropriate “Coordinate Format” (e.g., “4.5, unit mm”).
  4. Configure the “Suppress leading zeros” and “Suppress trailing zeros” options according to your manufacturing partner’s guidelines.
  5. Click “OK” to apply the Gerber file format options.

By carefully configuring the Gerber file output settings in KiCad, you can ensure that the generated Gerber files meet your manufacturing requirements and are compatible with your PCB fabrication process.

Generating Gerber Files using the KiCad Pcbnew Module

Once you have prepared your KiCad PCB design and configured the Gerber file output settings, you are ready to generate the Gerber files. Follow these steps to generate Gerber files using the KiCad Pcbnew module:

Plotting the Gerber Files

  1. In the Pcbnew module, go to the “File” menu and select “Plot…”
  2. Ensure that the layer selection, plot format, and output directory are set correctly in the “Plot” dialog.
  3. Click the “Plot” button to generate the Gerber files.
  4. KiCad will create the Gerber files in the specified output directory.

Generating the Drill Files

In addition to the Gerber files, you also need to generate the drill files that contain information about the holes and vias on your PCB. To generate the drill files:

  1. In the Pcbnew module, go to the “File” menu and select “Fabrication Outputs” > “Drill Files…”
  2. Configure the drill file settings, such as the file format (Excellon or Gerber), units (metric or imperial), and file options.
  3. Click “Generate Drill File” to create the drill files.
  4. KiCad will generate the drill files in the same output directory as the Gerber files.

Organizing the Gerber and Drill Files

After generating the Gerber and drill files, it is a good practice to organize them in a single folder for easy management and sharing with your manufacturing partner. Create a new folder and copy all the generated Gerber and drill files into it. Ensure that the folder contains all the necessary files, including:

  • Copper layer files (.GTL, .GBL)
  • Solder mask files (.GTS, .GBS)
  • Silkscreen files (.GTO, .GBO)
  • Board outline file (.GKO)
  • Paste mask files (.GTP, .GBP) if applicable
  • Drill files (.drl, .txt)

By organizing the Gerber and drill files in a single folder, you can easily package and send them to your PCB fabrication house for manufacturing.

Verifying and Validating the Exported Gerber Files

Before sending the exported Gerber files to your PCB Manufacturer, it is crucial to verify and validate them to ensure that they accurately represent your PCB design and meet the manufacturing requirements. Follow these steps to verify and validate your Gerber files:

Visual Inspection

Perform a visual inspection of the exported Gerber files using a Gerber viewer software. There are several free and commercial Gerber viewer tools available, such as:

  • GerbView (included with KiCad)
  • ViewMate
  • CAM350
  • GC-Prevue

Open the exported Gerber files in the Gerber viewer and visually inspect each layer for any discrepancies, missing features, or errors. Check for the following:

  • Correct layer alignment and registration
  • Complete and accurate representation of pads, traces, and vias
  • Proper solder mask and silkscreen openings
  • Correct board outline and dimensions

Design Rule Check (DRC)

Perform a Design Rule Check (DRC) on the exported Gerber files to ensure that they comply with your manufacturing partner’s design rules and constraints. Many Gerber viewer tools include built-in DRC functionality. To perform a DRC on your Gerber files:

  1. Open the Gerber files in a Gerber viewer with DRC capabilities.
  2. Configure the DRC settings according to your manufacturer’s specifications, such as minimum trace width, clearance, and hole size.
  3. Run the DRC and review any reported violations or errors.
  4. Address any issues identified by the DRC by modifying your PCB design in KiCad and re-exporting the Gerber files.

Manufacturability Check

Consult with your PCB manufacturing partner to verify the manufacturability of your Gerber files. Many PCB fabrication houses offer free Gerber file review services, where they analyze your files for potential manufacturing issues or optimizations. To request a manufacturability check:

  1. Contact your PCB manufacturing partner and inquire about their Gerber file review process.
  2. Provide them with the exported Gerber files, along with any special requirements or instructions.
  3. Review the feedback provided by the manufacturer and address any identified issues or recommendations.

Gerber File Compare

If you have made changes to your PCB design and exported new Gerber files, it is important to compare them with the previous version to ensure that the changes are accurately reflected. Use a Gerber file compare tool, such as GerbDiff or DiffUtility, to identify any differences between the old and new Gerber files. To perform a Gerber file compare:

  1. Open both the old and new Gerber files in the compare tool.
  2. Configure the comparison settings, such as layer mapping and tolerance.
  3. Run the comparison and review any reported differences.
  4. Verify that the differences correspond to the intended changes in your PCB design.

By thoroughly verifying and validating your exported Gerber files, you can minimize the risk of manufacturing issues and ensure that your PCB is fabricated correctly.

Best Practices and Common Pitfalls to Avoid

When exporting KiCad PCB designs to Gerber files, there are several best practices to follow and common pitfalls to avoid. Adhering to these guidelines can help ensure a smooth and error-free PCB fabrication process.

Best Practices

  1. Follow the manufacturer’s guidelines: Consult with your PCB manufacturing partner and follow their specific guidelines for Gerber file generation, such as file naming conventions, layer requirements, and design constraints.

  2. Use a consistent coordinate system: Ensure that all the layers in your KiCad PCB design use the same coordinate system (e.g., metric or imperial) to avoid alignment issues in the exported Gerber files.

  3. Include all necessary layers: Verify that your exported Gerber files include all the required layers for PCB fabrication, such as copper layers, solder mask, silkscreen, and board outline.

  4. Provide clear instructions: Include a README file or fabrication notes with your Gerber files to provide clear instructions and specifications to your manufacturer, such as material type, thickness, surface finish, and any special requirements.

  5. Use a Gerber file viewer: Always review your exported Gerber files using a Gerber file viewer to ensure that they accurately represent your PCB design and meet the manufacturing requirements.

Common Pitfalls to Avoid

  1. Incorrect layer mapping: Ensure that the layers in your KiCad PCB design are correctly mapped to the corresponding Gerber file layers to avoid missing or misplaced features in the fabricated PCB.

  2. Incomplete or incorrect board outline: Double-check that the board outline in your Gerber files is complete, closed, and matches your intended PCB dimensions to prevent manufacturing issues or delays.

  3. Insufficient clearances and trace widths: Verify that your PCB design adheres to the minimum clearance and trace width requirements specified by your manufacturer to ensure proper fabrication and functionality.

  4. Overlapping or conflicting features: Check for any overlapping or conflicting features in your Gerber files, such as silkscreen elements overlapping with pads or vias, which can cause manufacturing problems or affect the PCB’s appearance.

  5. Incorrect file naming or organization: Follow a consistent and clear file naming convention for your exported Gerber files and organize them in a single folder to avoid confusion and ensure that your manufacturer has all the necessary files.

By following these best practices and avoiding common pitfalls, you can streamline the Gerber file export process and minimize the risk of manufacturing issues, ultimately leading to a successful PCB fabrication experience.

Frequently Asked Questions (FAQ)

  1. **What