Skip to content
HendriXML edited this page Mar 25, 2022 · 46 revisions

Introduction

This repository is about matching schema components in KiCad with stock components in a PartKeepr database. This is realized in a few XML scripts to keep it maintainable. These scripts can be executed from within a single Windows executable developed by me. The tool also delivers the possiblity to add the components to a PartKeepr project.

The reason why I've chosen this platform is because I liked the challenge. Also all of the logic is within scripts and therefore customizable and expandable.

The total setup is about precise matching, with very little data entry burden. It is also about getting information fast and easy. Specifications in reports are enhanced with calculated information, for example the e-serie of values and what the maximum voltage or amperage a resistor can take.

I will explain how the matching is realised.

Component specifications

Different components can have different requirements that must be matched. For example:

  • a resistor has a resistance value, a minimal power rating, a footprint.
  • a capacitor has a capacitance value, a minimal voltage rating, a footprint.

These differences are implemented by the following specification classes:

  • Resistors
  • Capacitors
  • Inductors
  • Zener diodes
  • Diodes
  • Fuses
  • Connectors
  • Integrated circuits
  • Generic components

Within classes it is possible to have different component kinds, like unipolar and bipolar capacitors.

Collecting schema component specifications

The component kind (and corresponding component class) of a schema component is mostly determined by its library identifier (Device:R for example). Resistance, capacitance, inductance, zenervoltage values are parsed from the value field. Different formats are possible, values are stored and matched by binary coded decimals values. This means it doesn't matter how values are formatted. Parameters can also originate from default values, like a 250mW powerrating of normal resistors. These values can be overruled by adding them as extra fields.

Collecting stock component specifications from PartKeepr

The component kind (and corresponding component class) of a component in PartKeepr is mostly determined by the category it has been assigned to. This information must be added to the description of such a category (or one of its ancestors). For example

[Resistor]
ComponentKind=Resistor

Or a subcategory resistor

[Resistor]
PowerRating=250mW
Technology=metal film
Tolerance=2%

Resistance, capacitance, inductance, zenervoltage values are parsed from the component name. Different notations are possible, values are also stored and matched by binary coded decimals values. This means it doesn't matter how values initially where formatted when matching them. Requirements can also originate from category values, like a 250 mW powerrating of normal resistors . These values can be overruled by adding them as extra Part Parameters. Text parameters and numeric parameters are both supported. From a numeric parameter the nominal value, the prefix and the unit are used to create a text value, which is processed the standard way.

After schema component and stock component matching the stockparts and the locations where to find them are reported.

Schema components that couldn’t be matched can be added by the script automatically. Also the BOM can be transferred to a Partkeepr project.