Skip to content

Schematic Patterns

The schematic patterns tools place common circuit building blocks — decoupling cap banks, pull resistors, crystal oscillator circuits — with a single tool call. Components, wires, labels, and power symbols are positioned using established layout conventions.

In addition, the circuit pattern recognition tools can analyze existing schematics to identify common circuit blocks automatically.

TaskExample prompt
Place decoupling capsPlace a decoupling bank with 100nF and 10uF on the 3V3 rail at position (150, 100)
Place pull resistorAdd a 4.7k pull-up resistor to the I2C_SDA signal on U1 pin 5, pulled to 3V3
Place crystal circuitPlace a 16MHz crystal with 22pF load caps at position (200, 150)
Identify patternsIdentify circuit patterns in my schematic at /path/to/schematic.kicad_sch
Find specific patternsFind all power supply circuits in my schematic

place_decoupling_bank_pattern places a set of bypass capacitors with power and ground connections:

Place a decoupling bank with 100nF,10uF on +3V3 rail at x=150 y=100 in my schematic

The tool creates capacitors in a vertical column, each with a power symbol on the positive pin and GND on the negative pin, plus wire stubs connecting everything.

place_pull_resistor_pattern adds a pull-up or pull-down resistor connected to an existing signal pin:

Add a 10k pull-up resistor to signal SDA on U1 pin 15, pulled to +3V3

The tool positions the resistor, connects one end to the specified signal pin, and connects the other end to the specified power rail.

place_crystal_pattern places a crystal with its load capacitors:

Place a 12MHz crystal with 18pF load caps at x=200 y=150

This creates the crystal symbol and two load capacitors in the standard configuration, with GND connections on the cap ground pins.

The pattern recognition system analyzes existing schematics to identify common circuit blocks. It works by matching component values, reference designators, and library IDs against known patterns.

Identify circuit patterns in my schematic at /path/to/schematic.kicad_sch

This parses the schematic, applies pattern recognition, and generates a report of all identified circuits with their components and characteristics.

Power supply circuits — Linear voltage regulators (78xx/79xx, LDOs), switching regulators (buck, boost, buck-boost).

Amplifier circuits — Operational amplifiers, transistor amplifiers (BJT, FET), audio amplifier ICs.

Filter circuits — Passive RC filters (low-pass/high-pass), active filters (op-amp based), crystal and ceramic filters.

Oscillator circuits — Crystal oscillators, oscillator ICs, RC oscillators (555 timer).

Digital interface circuits — I2C, SPI, UART, USB, Ethernet interfaces.

Microcontroller circuits — AVR, STM32, PIC, ESP, and other MCU families; development board modules.

Sensor interfaces — Temperature, humidity, pressure, motion, light, and other sensor types.

Find all power supply circuits in my schematic at /path/to/schematic.kicad_sch
Show me the microcontroller circuits in my KiCad project at /path/to/project.kicad_pro

Pattern recognition works well alongside other mckicad features:

  1. DRC + patterns — find design issues in specific circuit blocks

    Find DRC issues affecting the power supply circuits in my schematic
  2. BOM + patterns — analyze component usage by circuit type

    Show me the BOM breakdown for the digital interface circuits in my design
  3. Connectivity + patterns — understand connections within specific blocks

    Analyze the connections between the microcontroller and sensor interfaces

The pattern recognition system is based on regex matching of component values and library IDs, defined in utils/pattern_recognition.py.

To add support for a new component family:

mcu_patterns = {
"AVR": r"ATMEGA\d+|ATTINY\d+|AT90\w+",
"STM32": r"STM32\w+",
# Add your pattern
"Renesas": r"R[A-Z]\d+|RL78|RX\d+",
}

See Adding Tools for the general process of contributing new functionality.

  1. Check component naming — pattern recognition relies on standard reference designators (R, C, U, etc.)
  2. Check component values — values must be in standard formats
  3. Check library IDs — using standard KiCad libraries improves recognition
  4. Inspect the patterns file — review utils/pattern_recognition.py to see what patterns are defined
  1. Verify the schematic file exists with a .kicad_sch extension
  2. Confirm it is a valid KiCad 6+ format schematic
  3. Check file permissions
  4. Try a simpler schematic first to isolate the issue