KiCAD

How to install KiCAD 6.0 on Ubuntu

Run this to install KiCAD 6.0:

sudo add-apt-repository ppa:kicad/kicad-6.0-releases
sudo apt update -y
sudo apt -y install kicad

 

Posted by Uli Köhler in KiCAD, Linux

How to start KiCAD installed from flatpak

After you have installed KiCAD from Flatpak using

flatpak install --from https://flathub.org/repo/appstream/org.kicad.KiCad.flatpakref

you can run it using

flatpak run org.kicad.KiCad

You can append any arguments to KiCAD, for example open a project file directly from the command line:

flatpak run org.kicad.KiCad MyProject.pro

 

Posted by Uli Köhler in KiCAD

How to fix KiCAD Unable to add inotify watch: (error 28: No space left on device) on Linux

Problem:

When opening KiCAD on Linux, you see the error message Unable to add inotify watch: (error 28: No space left on device):

Solution:

You need to increase the number of inotify watches that can be active at once:

echo fs.inotify.max_user_watches=65536 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

and then restart KiCAD

Posted by Uli Köhler in KiCAD

Where to find DO214AC package in KiCAD?

The DO214AC package is more commonly called SMA. In KiCAD you can find it in the Diode_SMD library as D_SMA package

Posted by Uli Köhler in Electronics, KiCAD

How to draw PCIe card edge connectors in KiCAD

You can download the Connector_PCBEdge library from the KiCad website and use the footprints from there for your PCI express card. You can use one of these footprints:

  • BUS_PCIexpress_x1
  • BUS_PCIexpress_x4
  • BUS_PCIexpress_x8
  • BUS_PCIexpress_x16
Posted by Uli Köhler in KiCAD

What .gitignore to use for KiCAD projects?

KiCAD generates a lot of backup-like files, for example MyPCB.sch-bak that should be ignored by git and don’t need to be committed to the repository.

This is the .gitignore file I use to manage my KiCAD projects:

*-bak
*-backups
*-cache*
*-bak*
_autosave*
\#auto_saved_files\#

Note that TechOverflow’s KiCAD project initialization script automatically generates this.gitignore.

Posted by Uli Köhler in KiCAD

Arduino MKR Zero schematic library for KiCAD

This library provides a schematic symbol for the Arduino MKR zero’s 2.54mm (0.1″) headers. Currently I don’t have the footprint

Download KiCAD schematic library here (ArduinoMKRZero.lib)

This KiCAD library is hereby released into the public domain (CC0 1.0 Universal)

This image shows the Arduino MKR Zero schematic symbol from the library.

Posted by Uli Köhler in Arduino, Electronics, KiCAD

Reading and writing KiCAD libraries in Python

This snippet provides a parser and serializer for KiCAD schematic symbol libraries and DCM symbol documentation libraries. It will parse the KiCAD libraries into a number of records, consisting of a list of lines. An extended version of this snippet has been used in my KiCADSamacSysImporter project

__author__ = "Uli Köhler"
__license__ = "CC0 1.0 Universal"

class KiCADDocLibrary(object):
    def __init__(self, records=[]):
        self.records = records
        
    @staticmethod
    def read(file):
        # A record is everything between '$CMP ...' line and '$ENDCMP' line
        records = []
        current_record = None
        for line in file:
            line = line.strip()
            if line.startswith('$CMP '):
                current_record = []
            # Add line to record if we have any current record
            if current_record is not None:
                current_record.append(line)
            if line.startswith("$ENDCMP"):
                if current_record is not None:
                    records.append(current_record)
                    current_record = None
        return KiCADDocLibrary(records)
        
    def write(self, out):
        # Write header
        out.write("EESchema-DOCLIB  Version 2.0\n")
        # Write records
        for rec in self.records:
            out.write("#\n")
            for line in rec:
                out.write(line)
                out.write("\n")
        # Write footer
        out.write("#\n#End Doc Library\n")        

        
class KiCADSchematicSymbolLibrary(object):
    def __init__(self, records=[]):
        self.records = records
        
    @staticmethod
    def read(file):
        # A record is everything between 'DEF ...' line and 'ENDDEF' line
        records = []
        current_record = None
        current_comment_lines = [] # 
        for line in file:
            line = line.strip()
            if line.startswith("#encoding"):
                continue # Ignore - we always use #encoding utf-8
            # Comment line processing
            if line.startswith("#"):
                current_comment_lines.append(line)
            # Start of record
            if line.startswith('DEF '):
                current_record = current_comment_lines
                current_comment_lines = []
            # Add line to record if we have any current record
            if current_record is not None:
                current_record.append(line)
            if line.startswith("ENDDEF"):
                if current_record is not None:
                    records.append(current_record)
                    current_record = None
            # Clear comment lines
            # We can only do this now to avoid clearing them before
            #  they are used in the DEF clause
            if not line.startswith("#"):
                current_comment_lines = []
        return KiCADSchematicSymbolLibrary(records)
        
    def write(self, out):
        # Write header
        out.write("EESchema-LIBRARY Version 2.4\n#encoding utf-8\n")
        # Write records
        for rec in self.records:
            for line in rec:
                out.write(line)
                out.write("\n")
        # Write footer
        out.write("#\n#End Library\n")        

 

Posted by Uli Köhler in Electronics, KiCAD, Python

How to initialize your KiCAD 5 project on the command line

In case you are using KiCAD 6 (released in 2021), this is not the right post for you ! See How to initialize your KiCAD 6 project on the command line

Note: This script initializes a KiCAD project in the recommended configuration (i.e. with project-specific footprint and symbol libraries). In case you want to initialize an empty project, see How to initialize an empty KiCAD project on the command line

TL;DR:

Inside the directory where you want to create the project, run

wget -qO- https://techoverflow.net/scripts/kicad-init.sh | bash /dev/stdin MyProject

You should replace MyProject (at the end of the command) with your project name.

Note: This will initialize an empty KiCAD project without any libraries. This is equivalent to creating a new project in KiCAD itself (using the GUI).

Continue reading →

Posted by Uli Köhler in Electronics, KiCAD, Shell

What are KiCAD .lib files?

.lib files in KiCAD contain schematic symbols, for example

or

Continue reading →

Posted by Uli Köhler in KiCAD

How to initialize an empty KiCAD project on the command line

TL;DR:

Note: We recommend to use our new script to initialize a project with project-specific footprint and symbol libraries, see How to initialize your KiCAD project on the command line. The script on this page initializes an empty project without any libraries.

Inside the directory where you want to create the project, run

wget -qO- https://techoverflow.net/scripts/kicad-initialize.sh | bash /dev/stdin MyProject

You should replace MyProject (at the end of the command) with your project name.

Note: This will initialize an empty KiCAD project without any libraries. This is equivalent to creating a new project in KiCAD itself (using the GUI).

Continue reading →

Posted by Uli Köhler in Electronics, KiCAD, Shell