Component Search (LCSC + easyeda2kicad)
Find and add component packages to a Zener project without relying on a private registry. The pipeline is:
MPN ──► LCSC C-number ──► easyeda2kicad ──► .kicad_sym + .kicad_mod + .step ──► Zener wrapper (.zen)
Use this workflow any time you need a part that isn't already in the workspace
tree or covered by stdlib generics (
@stdlib/generics/Resistor.zen
,
,
,
, …).
Hard Stop Before Manual Creation
If LCSC has no entry for the MPN, or
fails on the resolved C-number,
don't fall back to hand-drawing a symbol/footprint silently. Report what failed, offer manual creation as an option, and get explicit user confirmation.
Search Priority
Always search in this order. Move down only when the higher tier doesn't apply.
- Workspace tree — or for the MPN. If the part is already imported, reuse it via
Module("./components/<Mfr>/<MPN>/<MPN>.zen")
.
- stdlib generics — for plain R, C, L, LED, diode, NPN/PNP, MOSFET, thermistor: use the generic, never import a vendor part.
- LCSC + easyeda2kicad — for ICs, modules, connectors, crystals, anything with a specific MPN.
Step 1 — MPN → LCSC C-number
LCSC parts have a numeric
ID. easyeda2kicad needs that ID, not the MPN. Use the agent's web tools:
web_search query="<MPN> site:lcsc.com"
read_web_page url=<top LCSC product page> objective="Find the LCSC C-number (e.g. C25804) and confirm package."
Tips:
- LCSC product URLs look like
https://www.lcsc.com/product-detail/.../C25804.html
— the trailing before is the C-number.
- The product page also lists package, datasheet, stock, and price — capture these for the user.
- Some MPNs map to multiple C-numbers (different reels, suffixes, manufacturers). Pick the one that matches the requested package and shows real stock.
- If no LCSC hit, try the base MPN family (drop , , reel/packaging suffixes).
When the user supplies a C-number directly, skip this step.
Step 2 — Import via easyeda2kicad
Resolve the manufacturer and a clean MPN slug first (no spaces, replace
with
). Pick a target package directory under
components/<Manufacturer>/<MPN>/
.
bash
mkdir -p components/<Manufacturer>/<MPN>
cd components/<Manufacturer>/<MPN>
easyeda2kicad --full --lcsc_id=Cxxxxx --output <MPN> --overwrite
This writes:
- — symbol library (single symbol)
<MPN>.pretty/<something>.kicad_mod
— footprint, inside a folder
<MPN>.3dshapes/<something>.{wrl,step}
— 3D model
Flatten the footprint so the Zener wrapper can reference it as a single file next to the
:
bash
mv <MPN>.pretty/*.kicad_mod ./<MPN>.kicad_mod
rmdir <MPN>.pretty
(Keep
as a folder —
references the 3D model by relative path inside it.)
If the user wants to skip the 3D model for size, drop
and use
. Note that
does not require a 3D model to build.
Step 3 — Generate the Zener wrapper
Use the bundled generator script to turn the imported
into a starter
:
bash
python3 <SKILL_DIR>/scripts/zener-wrap.py \
--kicad-sym components/<Manufacturer>/<MPN>/<MPN>.kicad_sym \
--footprint <MPN>.kicad_mod \
--mpn <MPN> \
--manufacturer "<Manufacturer>" \
--output components/<Manufacturer>/<MPN>/<MPN>.zen
The generator parses the
and emits a
skeleton with:
- top docstring (MPN, manufacturer, package — fill in description by hand)
- / configs
- one per pin, classified as , , or generic by name
- with the dict mapping the original KiCad pin names to those ios
After generation, read the file and clean it up by hand:
- Group related ios (split power, signal, control bundles).
- Rename ios to integrator-facing names where it improves clarity ( → ).
- Add to every io per the datasheet.
- Replace with / / typed interfaces from where appropriate.
- Remove pins from the dict — leave them out, don't expose as ios.
- Drop the auto-generated docstring and replace with a short, integrator-facing one (one paragraph: what it is, where it's used, key constraint).
See
for the full style rules. See
if you want to grow the wrapper into a richer reusable design with surrounding circuitry.
Step 4 — Workspace manifest
The new component package needs a
so the workspace can resolve it. Create:
toml
# components/<Manufacturer>/<MPN>/pcb.toml
[package]
name = "<MPN>"
description = "<one-line description>"
If the workspace
declares
members = [..., "components/*", ...]
(most do), the package is auto-discovered. Verify with:
bash
pcb build components/<Manufacturer>/<MPN>
Fix any errors before instantiating from a board.
Step 5 — Use it
python
MyPart = Module("./components/<Manufacturer>/<MPN>/<MPN>.zen")
MyPart(
name="U1",
VDD=vdd_3v3,
GND=gnd,
# ...
)
Verifying Sourcing with
Once the part is wired into a board, sanity-check sourcing:
bash
pcb bom boards/<Board>/<Board>.zen -f json
For an easyeda2kicad-imported part, the BOM will pick up the MPN you set in the wrapper (
config default). LCSC stock is the same source easyeda2kicad pulled from, so the
you used is your sourcing record — capture it in the docstring or a
comment for traceability.
Generator Script
Path:
<SKILL_DIR>/scripts/zener-wrap.py
Usage:
bash
python3 zener-wrap.py \
--kicad-sym path/to/<MPN>.kicad_sym \
--footprint <MPN>.kicad_mod \
--mpn <MPN> \
--manufacturer "<Manufacturer>" \
--output path/to/<MPN>.zen \
[--datasheet docs/<MPN>.pdf] # optional
Pin classification rules:
- , , , , , →
- , , , , , , , , , →
- everything else →
The script never throws on unusual pin names — it sanitizes any string into a valid Zener identifier and falls back to
for unnamed pins.
Common Issues
- easyeda2kicad: HTTP 404 on C-number — wrong C-number, or the part has been delisted. Re-search LCSC or pick the alternate-source listing.
- Pin names look like (with overbar markup) — KiCad wraps inverted pin names in . The generator strips the markup for the io identifier but preserves the original string in the dict so the symbol still matches.
- Footprint references a 3D model that wasn't downloaded — happens with only. Either re-run with , or edit the to remove the block.
- Symbol uses / / spaces in pin names — the generator handles these. If the resulting Zener identifier is awkward, rename the io by hand and update the mapping to keep the original KiCad name on the right.