- Add root README.md and AGENTS.md for hardware repo - Fix cross-repo and internal broken links - Document hardware/common/scripts - Populate v2.9 placeholder READMEs - Update replica-omnisciente central brain pointer
2.3 KiB
Hardware Automation Scripts
WHY
The Savearth hardware repo contains many PCB versions and manufacturing exports. Manual BOM extraction and library conversion is error-prone and not reproducible. These scripts turn the EDA source into structured JSON, JLCPCB CSVs, and KiCad libraries in a repeatable way.
HOW
All scripts are Python 3 and read from/write to the per-version directories under hardware/. They share a common version list (2_3 through 2_8) and use the file naming convention bom_v{version}.json.
Run each script with --help for full argument lists.
WHAT
extract_bom.py
Extract component data from EasyEDA Pro .epro archives.
python3 hardware/common/scripts/extract_bom.py \
--epro-dir hardware/v2.8/easyeda \
--output-dir hardware/v2.8/bom
Outputs:
bom_v2_8.json— structured BOM with LCSC, manufacturer, footprint, value, category- Updates
hardware/savearth_hw_knowledge.jsonwith cross-version data
generate_jlcpcb_bom.py
Generate a JLCPCB-compatible CSV from a JSON BOM produced by extract_bom.py.
python3 hardware/common/scripts/generate_jlcpcb_bom.py \
--bom-dir hardware/v2.8/bom \
--version 2_8
Output: hardware/v2.8/bom/bom_v2_8_jlcpcb.csv
convert_to_kicad.py
Convert LCSC parts to KiCad symbol/footprint/3D libraries via easyeda2kicad.
python3 hardware/common/scripts/convert_to_kicad.py \
--bom-dir hardware/v2.8/bom \
--kicad-lib-dir hardware/common/kicad_libs
Requires easyeda2kicad to be installed (pip install easyeda2kicad).
extract_easyeda_db.py
Parse the SQLite-backed .eprj project directly to raw JSON schematics, netlists, and BOMs.
python3 hardware/common/scripts/extract_easyeda_db.py \
--db-path hardware/v2.8/easyeda/Savearth\ GBT.eprj \
--output-dir hardware/v2.8/parsed_data
Useful when you have the binary .eprj but no manual .epro export.
Typical workflow
- Export or locate the EasyEDA Pro source (
.eproor.eprj). - Run
extract_bom.py(orextract_easyeda_db.pyfor.eprj) to refreshbom_v2_8.json. - Run
generate_jlcpcb_bom.pyto refresh the assembly CSV. - Run
convert_to_kicad.pyif the KiCad library needs updating. - Commit the generated files and update any affected docs.