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.
Quick reference
Section titled “Quick reference”| Task | Example prompt |
|---|---|
| Place decoupling caps | Place a decoupling bank with 100nF and 10uF on the 3V3 rail at position (150, 100) |
| Place pull resistor | Add a 4.7k pull-up resistor to the I2C_SDA signal on U1 pin 5, pulled to 3V3 |
| Place crystal circuit | Place a 16MHz crystal with 22pF load caps at position (200, 150) |
| Identify patterns | Identify circuit patterns in my schematic at /path/to/schematic.kicad_sch |
| Find specific patterns | Find all power supply circuits in my schematic |
Placement patterns
Section titled “Placement patterns”Decoupling cap bank
Section titled “Decoupling cap bank”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 schematicThe 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.
Pull resistor
Section titled “Pull resistor”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 +3V3The tool positions the resistor, connects one end to the specified signal pin, and connects the other end to the specified power rail.
Crystal oscillator
Section titled “Crystal oscillator”place_crystal_pattern places a crystal with its load capacitors:
Place a 12MHz crystal with 18pF load caps at x=200 y=150This creates the crystal symbol and two load capacitors in the standard configuration, with GND connections on the cap ground pins.
Pattern recognition
Section titled “Pattern recognition”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.
Identifying patterns
Section titled “Identifying patterns”Identify circuit patterns in my schematic at /path/to/schematic.kicad_schThis parses the schematic, applies pattern recognition, and generates a report of all identified circuits with their components and characteristics.
Supported pattern types
Section titled “Supported pattern types”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.
Searching for specific patterns
Section titled “Searching for specific patterns”Find all power supply circuits in my schematic at /path/to/schematic.kicad_schShow me the microcontroller circuits in my KiCad project at /path/to/project.kicad_proCombining with other tools
Section titled “Combining with other tools”Pattern recognition works well alongside other mckicad features:
-
DRC + patterns — find design issues in specific circuit blocks
Find DRC issues affecting the power supply circuits in my schematic -
BOM + patterns — analyze component usage by circuit type
Show me the BOM breakdown for the digital interface circuits in my design -
Connectivity + patterns — understand connections within specific blocks
Analyze the connections between the microcontroller and sensor interfaces
Extending pattern recognition
Section titled “Extending pattern recognition”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.
Troubleshooting
Section titled “Troubleshooting”Patterns not recognized
Section titled “Patterns not recognized”- Check component naming — pattern recognition relies on standard reference designators (R, C, U, etc.)
- Check component values — values must be in standard formats
- Check library IDs — using standard KiCad libraries improves recognition
- Inspect the patterns file — review
utils/pattern_recognition.pyto see what patterns are defined
Recognition fails entirely
Section titled “Recognition fails entirely”- Verify the schematic file exists with a
.kicad_schextension - Confirm it is a valid KiCad 6+ format schematic
- Check file permissions
- Try a simpler schematic first to isolate the issue