Hardware

KiCAD

What is KiCAD?

KiCad is a free and open-source software suite used for electronic design automation (EDA). It allows users to create schematic diagrams and printed circuit board (PCB) layouts. It is widely used by hobbyists, engineers, and professionals for designing circuits and manufacturing PCBs.


Symbol Library


Footprint Library


Project


Schematic


PCB

PCB Outline

Here's a step-by-step guide to create a PCB board outline in KiCad:

  1. Open PCB Editor
  • Launch KiCad and open your project
  • Click on "Pcbnew" to open the PCB editor
  1. Select the Edge.Cuts Layer
  • In the layers panel (right side), click on "Edge.Cuts" layer
  • This layer defines the physical board boundary
  1. Choose Drawing Tools
  • From the right toolbar, select one of these tools:
    • Line tool - for straight edges
    • Arc tool - for curved edges
    • Circle tool - for circular boards
    • Rectangle tool - for rectangular boards
  1. Draw the Outline
  • Click to start drawing your board shape
  • For rectangles: Click and drag to define the size
  • For custom shapes: Click point by point to create the outline
  • Make sure the outline forms a closed loop
  1. Complete the Outline
  • Ensure all lines connect properly
  • The outline should be continuous with no gaps

Method 2: Import from DXF/SVG

  1. Prepare External File
  • Create your board outline in CAD software (AutoCAD, Inkscape, etc.)
  • Export as DXF or SVG format
  1. Import in KiCad
  • Go to File → Import → Graphics
  • Select your DXF/SVG file
  • Choose "Edge.Cuts" as the destination layer
  • Adjust position and scale as needed

Important Tips

  • Layer Selection : Always ensure you're drawing on the "Edge.Cuts" layer
  • Closed Loop : The outline must be completely closed for proper board manufacturing
  • Grid Alignment : Use the grid to ensure precise dimensions
  • Dimensions : Consider your manufacturer's minimum board size requirements
  • Mounting Holes : Add mounting holes if needed using the drill tool

Common Board Shapes

  • Rectangular : Use the rectangle tool for standard boards
  • Rounded Corners : Draw rectangle, then add small arcs at corners
  • Custom : Use line and arc tools to create complex shapes

Verification

  1. 3D Viewer : Use View → 3D Viewer to see your board outline in 3D
  2. DRC Check : Run Design Rules Check to ensure outline integrity
  3. Gerber Preview : Generate Gerbers and preview to verify the outline The board outline you draw will be used for manufacturing, so ensure it's accurate and meets your design requirements!

Gerber


KiCad API

Checkout latest KiCad API documentation here and there

$ conda create -n kicad python=3.9
$ pip install kicad-python

Examples

Connect to KiCad

Make sure you have KiCad open and the API is enabled in the settings.

from kipy import KiCad

if __name__=='__main__':
    try:
        kicad = KiCad()
        print(f"Connected to KiCad {kicad.get_version()}")
    except BaseException as e:
        print(f"Not connected to KiCad: {e}")

Draw a Zone

from kipy import KiCad
from kipy.board_types import (
    BoardLayer,
    Zone
)
from kipy.common_types import PolygonWithHoles
from kipy.geometry import PolyLine, PolyLineNode
from kipy.util import from_mm

if __name__=='__main__':
    kicad = KiCad()
    board = kicad.get_board()

    outline = PolyLine()
    outline.append(PolyLineNode.from_xy(from_mm(100), from_mm(100)))
    outline.append(PolyLineNode.from_xy(from_mm(110), from_mm(100)))
    outline.append(PolyLineNode.from_xy(from_mm(110), from_mm(110)))
    outline.append(PolyLineNode.from_xy(from_mm(100), from_mm(110)))
    outline.append(PolyLineNode.from_xy(from_mm(100), from_mm(100)))
    polygon = PolygonWithHoles()
    polygon.outline = outline
    zone = Zone()
    zone.layers = [BoardLayer.BL_F_Cu, BoardLayer.BL_B_Cu]
    zone.outline = polygon
    board.create_items(zone)
Previous
Jetson Nano