From dda87cfbae98a500e306482f42ae00640bb955a7 Mon Sep 17 00:00:00 2001 From: Eduard Iten Date: Tue, 9 Dec 2025 15:06:04 +0100 Subject: [PATCH] feat: implement JLCPCB Basic Parts system with Fabrication Toolkit support - Replace custom footprints approach with standard KiCad footprints - Add comprehensive JLCPCB Basic Parts database with real part numbers - Create dual-platform symbol generators (PowerShell + Bash) - Support bennymeg/JLC-Plugin-for-KiCad with proper field names - Include standard ICs (STM32, CAN, power, interface) - Generate BOM templates for JLCPCB assembly - Add German (.de.md) and English (.md) documentation versions - Remove old LCSC-only approach in favor of complete JLCPCB solution Breaking changes: - Removed custom footprints for standard passives - Updated naming conventions for JLCPCB compatibility - Replaced LCSC_Parts_Database.csv with JLCPCB_Basic_Parts.csv --- CHANGELOG.md | 47 +++ README.de.md | 286 ++++++++++++++ README.md | 105 ++++++ docs/JLCPCB_Basic_Parts.csv | 61 +++ docs/JLCPCB_Generator_Guide.md | 160 ++++++++ docs/KiCad_Setup.md | 153 ++++++++ docs/Komponenten_Template.md | 108 ++++++ docs/Logo_Artwork_Anleitung.md | 224 +++++++++++ docs/Standard_Components_LCSC.md | 237 ++++++++++++ docs/Standard_Passives_LCSC.de.md | 306 +++++++++++++++ docs/Standard_Passives_LCSC.md | 306 +++++++++++++++ scripts/Generate_JLCPCB_Symbols.ps1 | 453 +++++++++++++++++++++++ scripts/generate_jlcpcb_symbols.sh | 554 ++++++++++++++++++++++++++++ 13 files changed, 3000 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 README.de.md create mode 100644 README.md create mode 100644 docs/JLCPCB_Basic_Parts.csv create mode 100644 docs/JLCPCB_Generator_Guide.md create mode 100644 docs/KiCad_Setup.md create mode 100644 docs/Komponenten_Template.md create mode 100644 docs/Logo_Artwork_Anleitung.md create mode 100644 docs/Standard_Components_LCSC.md create mode 100644 docs/Standard_Passives_LCSC.de.md create mode 100644 docs/Standard_Passives_LCSC.md create mode 100644 scripts/Generate_JLCPCB_Symbols.ps1 create mode 100644 scripts/generate_jlcpcb_symbols.sh diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ec97576 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,47 @@ +# Changelog + +Alle wichtigen Änderungen an dieser Bibliothek werden in dieser Datei dokumentiert. + +Das Format basiert auf [Keep a Changelog](https://keepachangelog.com/de/1.0.0/), +und dieses Projekt folgt der [Semantischen Versionierung](https://semver.org/lang/de/). + +## [Unreleased] + +### Geplant +- Erste Sammlung von Power Management ICs +- USB-C Connector-Serie +- Firmenlogo-Varianten für verschiedene Größen + +## [1.0.0] - 2024-12-09 + +### Hinzugefügt +- Initiale Projektstruktur +- README mit Naming Conventions +- .gitignore für KiCad-Dateien +- Changelog-Datei +- Ordnerstruktur für symbols/, footprints/, 3d_models/ + +### Geändert +- Nichts (Erstversion) + +### Entfernt +- Nichts (Erstversion) + +--- + +## Template für neue Einträge + +### Hinzugefügt +- Neue Symbole: [Liste] +- Neue Footprints: [Liste] +- Neue 3D-Modelle: [Liste] + +### Geändert +- Überarbeitete Symbole: [Liste mit Grund] +- Überarbeitete Footprints: [Liste mit Grund] + +### Entfernt +- Obsolete Komponenten: [Liste mit Grund] + +### Behoben +- Bugfixes: [Liste] \ No newline at end of file diff --git a/README.de.md b/README.de.md new file mode 100644 index 0000000..9a492bb --- /dev/null +++ b/README.de.md @@ -0,0 +1,286 @@ +# Meine Persönliche KiCad-Bibliothek + +Diese Bibliothek enthält benutzerdefinierte KiCad-Komponenten, die in der Standard-Bibliothek nicht verfügbar sind. + +## 📁 Struktur + +``` +my-kicad-libs/ +├── symbols/ # Symbol-Bibliotheken (.kicad_sym) +│ ├── Custom_Logic/ +│ ├── Custom_Power/ +│ ├── Custom_Connectors/ +│ ├── Standard_Passives/ # Standard R/C/L mit LCSC +│ ├── Standard_ICs/ # CAN, STM32, Standard-ICs +│ ├── Logos_Artwork/ +│ └── ... +├── footprints/ # Footprint-Bibliotheken (.pretty) +│ ├── Custom_QFN.pretty/ +│ ├── Custom_BGA.pretty/ +│ ├── Logos_Silkscreen.pretty/ +│ └── ... # Nur custom Footprints, Standard nutzt KiCad-Libs +├── 3d_models/ # 3D-Modelle (.step, .wrl) +│ ├── Connectors/ +│ ├── IC_Packages/ +│ ├── Mechanical/ +│ └── ... +├── datasheets/ # Datenblätter (optional) +├── docs/ # Dokumentation +├── scripts/ # Automatisierungs-Scripts +└── templates/ # Projektvorlagen +``` + +## 🏷️ Naming Conventions + +### Symbole (.kicad_sym Dateien) +- **Format**: `[Kategorie]_[Hersteller]_[Serie].kicad_sym` +- **Beispiele**: + - `Logic_TI_74HC.kicad_sym` + - `Power_LTC_Switching.kicad_sym` + - `Connectors_JST_XH.kicad_sym` + - `Logos_Personal.kicad_sym` + +### Einzelne Symbol-Namen (innerhalb der .kicad_sym) +- **Format**: `[Partnumber]_[Package]_[Variante]` +- **Format (Standard-Passives)**: `[Wert]_[Package]_[LCSC]` +- **Beispiele**: + - `TPS54340_HTSSOP-14_PowerPAD` + - `STM32F407VGT6_LQFP-100` + - `USB-C_16Pin_Receptacle` + - `100nF_0402_C1525` (Kondensator mit LCSC#) + - `10k_0603_C25804` (Widerstand mit LCSC#) + - `Logo_MyCompany_10mm` + +### Footprints (.pretty Ordner) +- **Format**: `[Kategorie]_[Spezifikation].pretty` +- **Beispiele**: + - `QFN_Custom.pretty` + - `USB_Connectors.pretty` + - `Logos_Silkscreen.pretty` + - `Mechanical_Standoffs.pretty` + +### Einzelne Footprint-Namen (innerhalb .pretty) +- **Format**: `[Package]_[Größe]_[Pitch]_[Besonderheit]` +- **Beispiele**: + - `QFN-32_5x5mm_0.5mm_EP3.3x3.3mm` + - `USB-C_SMD_16Pin_6.2x7.3mm` + - `Logo_MyCompany_10x5mm_Silkscreen` + - `TestPoint_1.5mm_Drill0.7mm` + +### 3D-Modelle +- **Format**: `[Kategorie]/[Bauteil]_[Größe].[step|wrl]` +- **Beispiele**: + - `IC_Packages/QFN-32_5x5mm.step` + - `Connectors/USB-C_SMD_16Pin.step` + - `Mechanical/Standoff_M3_10mm.step` + +## 📋 Kategorien-System + +### Symbole +- `Amplifiers_Custom` - Spezielle Operationsverstärker +- `Audio_Custom` - Audio-ICs, Codecs +- `Communication_Custom` - CAN, RS485, Ethernet (spezielle) +- `Connectors_Custom` - Spezielle Steckverbinder +- `Display_Custom` - LCDs, OLEDs, E-Paper +- `Logic_Custom` - Spezielle Logik-ICs +- `MCU_Custom` - Mikrocontroller (spezielle) +- `Memory_Custom` - Flash, EEPROM, RAM +- `Standard_Passives` - **Standard R/C/L mit LCSC** (nutzt KiCad-Footprints) +- `Standard_ICs` - **Standard CAN-Transceiver, STM32, etc.** (nutzt KiCad-Footprints) +- `Power_Custom` - DC-DC, LDOs, Power Management +- `RF_Custom` - HF-Module, Antennen +- `Sensors_Custom` - Sensoren aller Art +- `Logos_Artwork` - Firmenlogos, CC-Lizenzen, Artwork + +### Footprints +- `BGA_Custom.pretty` - Ball Grid Arrays (nur wenn nicht in KiCad vorhanden) +- `Connectors_Audio.pretty` - Audio-Steckverbinder +- `Connectors_Power.pretty` - Power-Steckverbinder +- `Connectors_USB.pretty` - USB-Varianten +- `IC_Custom.pretty` - Spezielle IC-Gehäuse +- `Logos_Silkscreen.pretty` - Logos für Silkscreen +- `Mechanical.pretty` - Mechanische Teile +- `Modules_Custom.pretty` - Komplette Module +- `QFN_Custom.pretty` - Quad Flat No-leads (nur Custom-Varianten) +- `Sensors_Custom.pretty` - Sensor-Gehäuse +- `TestPoints.pretty` - Testpunkte + +**Hinweis**: Standard-Passivbauteile und Standard-IC-Packages nutzen die vorhandenen KiCad-Footprints! + +## 🎨 Artwork & Logos + +### CC-Lizenzen +- Format: `CC_[Lizenz]_[Größe]mm` +- Beispiele: `CC_BY-SA_5mm`, `CC_BY-NC_3mm` + +### Persönliche Logos +- Format: `Logo_[Name]_[Größe]mm_[Typ]` +- Beispiele: `Logo_MyCompany_10mm_Full`, `Logo_MyCompany_5mm_Icon` + +### OSHW (Open Source Hardware) +- Format: `OSHW_[Land]_[Größe]mm` +- Beispiel: `OSHW_DE_4mm` + +## ⚙️ Best Practices + +### Allgemeine Regeln +1. **Konsistenz**: Immer das gleiche Namensschema verwenden +2. **Englisch**: Alle Namen auf Englisch für universelle Verwendbarkeit +3. **Keine Sonderzeichen**: Nur A-Z, a-z, 0-9, Unterstrich und Bindestrich +4. **Versionierung**: Bei Updates neue Symbole/Footprints erstellen statt überschreiben +5. **Dokumentation**: Jedes neue Teil dokumentieren + +### Symbol-Design +- **Pin-Namen**: Verwenden Sie offizielle Pin-Namen aus dem Datenblatt +- **Pin-Nummern**: Korrekte Pin-Nummern entsprechend Package +- **Referenz**: Standard-Referenz (U, R, C, L, etc.) +- **Value**: Leer lassen oder generischen Namen verwenden +- **Datasheet**: URL im Symbol hinterlegen + +### Footprint-Design +- **Courtyard**: 0.25mm Mindestabstand zu anderen Komponenten +- **Fab Layer**: Bauteil-Umriss auf F.Fab/B.Fab +- **Silkscreen**: Klare Orientierung, keine Überlappung mit Pads +- **Reference**: Standardposition, gut lesbar +- **3D-Modell**: Wenn verfügbar, immer zuweisen + +### 3D-Modelle +- **Format**: STEP bevorzugt, WRL für Legacy +- **Größe**: Realistisch, aber nicht übermäßig detailliert +- **Farben**: Realistische Materialfarben +- **Position**: Korrekte Ausrichtung zum Footprint + +## 📂 Ordnerstruktur Detail + +### /symbols/ +``` +symbols/ +├── Amplifiers_Custom.kicad_sym +├── Communication_Custom.kicad_sym +├── Connectors_Custom.kicad_sym +├── Display_Custom.kicad_sym +├── Logic_Custom.kicad_sym +├── Logos_Artwork.kicad_sym +├── MCU_Custom.kicad_sym +├── Memory_Custom.kicad_sym +├── Power_Custom.kicad_sym +├── RF_Custom.kicad_sym +└── Sensors_Custom.kicad_sym +``` + +### /footprints/ +``` +footprints/ +├── BGA_Custom.pretty/ +├── Connectors_Audio.pretty/ +├── Connectors_Power.pretty/ +├── Connectors_USB.pretty/ +├── IC_Custom.pretty/ +├── Logos_Silkscreen.pretty/ +├── Mechanical.pretty/ +├── Modules_Custom.pretty/ +├── QFN_Custom.pretty/ +├── Sensors_Custom.pretty/ +└── TestPoints.pretty/ +``` + +### /3d_models/ +``` +3d_models/ +├── Connectors/ +│ ├── Audio/ +│ ├── Power/ +│ └── USB/ +├── IC_Packages/ +│ ├── BGA/ +│ ├── QFN/ +│ └── Custom/ +├── Mechanical/ +│ ├── Standoffs/ +│ ├── Heatsinks/ +│ └── Enclosures/ +└── Modules/ + ├── RF/ + ├── Sensors/ + └── Display/ +``` + +## 🔧 KiCad Konfiguration + +### Symbol-Bibliotheken hinzufügen +1. Preferences → Manage Symbol Libraries +2. Project Specific Libraries hinzufügen +3. Nickname: `Custom_[Kategorie]` +4. Library Path: Relativer Pfad zu .kicad_sym Datei + +### Footprint-Bibliotheken hinzufügen +1. Preferences → Manage Footprint Libraries +2. Project Specific Libraries hinzufügen +3. Nickname: `Custom_[Kategorie]` +4. Library Path: Relativer Pfad zu .pretty Ordner + +## 📝 Dokumentationsrichtlinien + +### Pro Komponente dokumentieren +- **Partnummer**: Vollständige Herstellerbezeichnung +- **Hersteller**: Firmenname +- **Datenblatt**: URL oder lokaler Pfad +- **Besonderheiten**: Spezielle Anforderungen +- **Erstellt**: Datum und Version +- **Getestet**: Status der Verifikation + +### Changelog führen +- Alle Änderungen in CHANGELOG.md dokumentieren +- Datum, Komponente, Art der Änderung +- Grund für die Änderung + +## 🚀 Workflow + +### Neue Komponente hinzufügen +1. **Research**: Datenblatt studieren, ähnliche Komponenten prüfen +2. **LCSC-Check**: Bei Standard-Passivbauteilen LCSC-Verfügbarkeit prüfen +3. **Symbol erstellen**: In passende Kategorie-Datei +4. **Footprint erstellen**: In passenden .pretty Ordner +5. **3D-Modell**: Suchen oder erstellen +6. **Verknüpfung**: Symbol ↔ Footprint ↔ 3D-Modell +7. **Test**: In Testschaltung verwenden +8. **Dokumentation**: In README und Changelog eintragen + +### Qualitätskontrolle +- [ ] Elektrische Regeln Check (ERC) +- [ ] Design Rules Check (DRC) +- [ ] 3D-Ansicht prüfen +- [ ] Testbestückung (falls möglich) + +## 📜 Lizenz & Copyright + +### Eigene Designs +- Alle eigenen Symbole, Footprints und 3D-Modelle unter CC BY-SA 4.0 +- Copyright-Vermerk in jeder Datei + +### Fremde 3D-Modelle +- Nur lizenzfreie oder kompatible Modelle verwenden +- Quellenangabe in Datei-Metadaten +- Bei Unsicherheit: Eigenes Modell erstellen + +### Logos & Artwork +- Nur eigene Logos oder explizit erlaubte verwenden +- CC-Lizenz-Symbole korrekt implementieren +- Markenrechte beachten + +## 🔄 Wartung & Updates + +### Regelmäßige Aufgaben +- [ ] Footprints mit neuen KiCad-Versionen testen +- [ ] 3D-Modell-Links überprüfen +- [ ] Obsolete Komponenten markieren +- [ ] Neue KiCad-Features nutzen + +### Versionierung +- Git für Versionskontrolle nutzen +- Tags für stabile Versionen +- Branches für experimentelle Features + +--- + +*Letzte Aktualisierung: $(date)* \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ceeb72b --- /dev/null +++ b/README.md @@ -0,0 +1,105 @@ +# My Personal KiCad Library + +This library contains custom KiCad components that are not available in the standard library. + +## 📁 Structure + +``` +my-kicad-libs/ +├── symbols/ # Symbol libraries (.kicad_sym) +│ ├── Custom_Logic/ +│ ├── Custom_Power/ +│ ├── Custom_Connectors/ +│ ├── Standard_Passives/ # Standard R/C/L with LCSC +│ ├── Standard_ICs/ # CAN, STM32, Standard ICs +│ ├── Logos_Artwork/ +│ └── ... +├── footprints/ # Footprint libraries (.pretty) +│ ├── Custom_QFN.pretty/ +│ ├── Custom_BGA.pretty/ +│ ├── Logos_Silkscreen.pretty/ +│ └── ... # Only custom footprints, standard uses KiCad libs +├── 3d_models/ # 3D models (.step, .wrl) +│ ├── Connectors/ +│ ├── IC_Packages/ +│ ├── Mechanical/ +│ └── ... +├── datasheets/ # Datasheets (optional) +├── docs/ # Documentation +├── scripts/ # Automation scripts +└── templates/ # Project templates +``` + +## 🏷️ Naming Conventions + +### Symbols (.kicad_sym files) +- **Format**: `[Category]_[Manufacturer]_[Series].kicad_sym` +- **Examples**: + - `Logic_TI_74HC.kicad_sym` + - `Power_LTC_Switching.kicad_sym` + - `Connectors_JST_XH.kicad_sym` + - `Standard_Passives.kicad_sym` + - `Standard_ICs.kicad_sym` + - `Logos_Personal.kicad_sym` + +### Individual Symbol Names (within .kicad_sym) +- **Format**: `[Partnumber]_[Package]_[Variant]` +- **Format (Standard Passives)**: `[Value]_[Package]_[LCSC]` +- **Format (Standard ICs)**: `[Partnumber]_[Package]_[LCSC]` +- **Examples**: + - `TPS54340_HTSSOP-14_PowerPAD` + - `STM32F407VGT6_LQFP-100` + - `USB-C_16Pin_Receptacle` + - `100nF_0603_C14663` (Capacitor with LCSC#) + - `10k_0603_C25804` (Resistor with LCSC#) + - `MCP2515_SOIC-18_C55199` (CAN controller with LCSC#) + - `Logo_MyCompany_10mm` + +### Footprints (.pretty folders) +**Note**: Standard passives and common ICs use existing KiCad footprints! + +- **Format**: `[Category]_[Specification].pretty` +- **Examples**: + - `QFN_Custom.pretty` + - `USB_Connectors.pretty` + - `Logos_Silkscreen.pretty` + - `Mechanical_Standoffs.pretty` + +## 📊 Standard Components with LCSC + +### Standard Passives (R/C/L) +- **Purpose**: Consistent, cost-optimized parts with LCSC numbers +- **Footprints**: Use standard KiCad footprints (Resistor_SMD, Capacitor_SMD, etc.) +- **Symbols**: Custom symbols with LCSC part numbers and manufacturer data +- **Examples**: `100nF_0603_C14663`, `10k_0603_C25804` + +### Standard ICs +- **Purpose**: Common ICs with LCSC numbers for automated assembly +- **Categories**: + - CAN transceivers: `MCP2515_SOIC-18_C55199` + - STM32 MCUs: `STM32F103C8T6_LQFP-48_C8734` + - Voltage regulators: `AMS1117-3.3_SOT-223_C6186` + - Op-amps: `LM358_SOIC-8_C7950` +- **Footprints**: Use standard KiCad footprints (Package_SO, Package_QFP, etc.) + +## ⚙️ Best Practices + +### Standard Component Strategy +1. **Use KiCad footprints**: Don't reinvent the wheel for standard packages +2. **LCSC integration**: Add LCSC numbers for cost optimization +3. **Manufacturer data**: Include MPN and manufacturer in symbols +4. **BOM automation**: Enable direct JLCPCB assembly integration + +### Workflow + +#### Adding New Standard Component +1. **Check KiCad**: Verify symbol/footprint don't exist in standard libraries +2. **LCSC lookup**: Find LCSC part number and basic part status +3. **Create symbol**: With complete manufacturer data and LCSC number +4. **Link footprint**: Use existing KiCad footprint +5. **Test**: Use in test circuit +6. **Document**: Add to documentation + +--- + +*Last update: December 9, 2024* \ No newline at end of file diff --git a/docs/JLCPCB_Basic_Parts.csv b/docs/JLCPCB_Basic_Parts.csv new file mode 100644 index 0000000..d74c6f4 --- /dev/null +++ b/docs/JLCPCB_Basic_Parts.csv @@ -0,0 +1,61 @@ +# JLCPCB Basic Parts Database +# Master database for JLCPCB Basic Parts with Fabrication Toolkit fields +# Compatible with bennymeg/JLC-Plugin-for-KiCad + +Component,Value,Package,LCSC Part #,Manufacturer,MFG Part #,Description,FT Rotation Offset,Stock Status,Price 1k,Last Update +# RESISTORS - UniOhm Basic Parts 1% Thick Film +R,0R,0603,C21189,UniOhm,0603WAF0000T5E,"Resistor 0R 1/10W 0603",0,In Stock,0.002,2024-12-09 +R,10R,0603,C22859,UniOhm,0603WAF100JT5E,"Resistor 10R 1% 1/10W 0603",0,In Stock,0.002,2024-12-09 +R,22R,0603,C23179,UniOhm,0603WAF220JT5E,"Resistor 22R 1% 1/10W 0603",0,In Stock,0.002,2024-12-09 +R,100R,0603,C22775,UniOhm,0603WAF1000T5E,"Resistor 100R 1% 1/10W 0603",0,In Stock,0.002,2024-12-09 +R,330R,0603,C23138,UniOhm,0603WAF3300T5E,"Resistor 330R 1% 1/10W 0603",0,In Stock,0.002,2024-12-09 +R,1k,0603,C21190,UniOhm,0603WAF1001T5E,"Resistor 1k 1% 1/10W 0603",0,In Stock,0.002,2024-12-09 +R,4.7k,0603,C23162,UniOhm,0603WAF4701T5E,"Resistor 4.7k 1% 1/10W 0603",0,In Stock,0.002,2024-12-09 +R,10k,0603,C25804,UniOhm,0603WAF1002T5E,"Resistor 10k 1% 1/10W 0603",0,In Stock,0.002,2024-12-09 +R,47k,0603,C25819,UniOhm,0603WAF4702T5E,"Resistor 47k 1% 1/10W 0603",0,In Stock,0.002,2024-12-09 +R,100k,0603,C25803,UniOhm,0603WAF1003T5E,"Resistor 100k 1% 1/10W 0603",0,In Stock,0.002,2024-12-09 +# CAPACITORS - Samsung Basic Parts X7R/X5R +C,22pF,0603,C1653,Samsung,CL10B220KB8NNNC,"Capacitor 22pF 50V X7R 0603",0,In Stock,0.003,2024-12-09 +C,100pF,0603,C14858,Samsung,CL10B101KB8NNNC,"Capacitor 100pF 50V X7R 0603",0,In Stock,0.003,2024-12-09 +C,1nF,0603,C1588,Samsung,CL10B102KB8NNNC,"Capacitor 1nF 50V X7R 0603",0,In Stock,0.003,2024-12-09 +C,10nF,0603,C57112,Samsung,CL10B103KB8NNNC,"Capacitor 10nF 50V X7R 0603",0,In Stock,0.003,2024-12-09 +C,100nF,0603,C14663,Samsung,CL10B104KB8NNNC,"Capacitor 100nF 50V X7R 0603",0,In Stock,0.003,2024-12-09 +C,1µF,0603,C15849,Samsung,CL10A105KA8NNNC,"Capacitor 1µF 25V X5R 0603",0,In Stock,0.004,2024-12-09 +C,4.7µF,0603,C19666,Samsung,CL10A475KQ8NNNC,"Capacitor 4.7µF 16V X5R 0603",0,In Stock,0.006,2024-12-09 +C,10µF,0603,C19702,Samsung,CL10A106KP8NNNC,"Capacitor 10µF 10V X5R 0603",0,In Stock,0.008,2024-12-09 +C,22µF,0805,C45783,Samsung,CL21A226KQCLRNC,"Capacitor 22µF 6.3V X5R 0805",0,In Stock,0.015,2024-12-09 +C,47µF,1206,C13585,Samsung,CL31A476MQHNNNE,"Capacitor 47µF 6.3V X5R 1206",0,In Stock,0.025,2024-12-09 +# INDUCTORS - Murata Basic Parts +L,10nH,0603,C1649,Murata,LQG18HN10NJ00D,"Inductor 10nH ±5% 0603",0,In Stock,0.008,2024-12-09 +L,100nH,0603,C1588,Murata,LQG18HN101J00D,"Inductor 100nH ±5% 0603",0,In Stock,0.008,2024-12-09 +L,1µH,0603,C1617,Murata,LQG18HN1R0J00D,"Inductor 1µH ±5% 0603",0,In Stock,0.008,2024-12-09 +L,10µH,0805,C1046,Murata,LQG21HN100J10D,"Inductor 10µH ±5% 0805",0,In Stock,0.010,2024-12-09 +L,100µH,1206,C51942,Murata,LQG31HN101J03L,"Inductor 100µH ±5% 1206",0,In Stock,0.015,2024-12-09 +# STANDARD ICs - Basic Parts for common designs +IC,STM32F103C8T6,LQFP-48,C8734,STMicroelectronics,STM32F103C8T6,"MCU 32-bit ARM Cortex M3 72MHz 64KB Flash 20KB RAM",0,In Stock,2.89,2024-12-09 +IC,STM32F030F4P6,TSSOP-20,C9900,STMicroelectronics,STM32F030F4P6,"MCU 32-bit ARM Cortex M0 48MHz 16KB Flash 4KB RAM",0,In Stock,0.89,2024-12-09 +IC,MCP2515,SOIC-18,C55199,Microchip,MCP2515-I/SO,"CAN Controller SPI Interface",0,In Stock,1.67,2024-12-09 +IC,SN65HVD230,SOIC-8,C12084,Texas Instruments,SN65HVD230DR,"CAN Transceiver 3.3V",0,In Stock,0.39,2024-12-09 +IC,AMS1117-3.3,SOT-223,C6186,Advanced Monolithic Systems,AMS1117-3.3,"LDO 3.3V 1A Low Dropout Regulator",180,In Stock,0.11,2024-12-09 +IC,AMS1117-5.0,SOT-223,C347222,Advanced Monolithic Systems,AMS1117-5.0,"LDO 5.0V 1A Low Dropout Regulator",180,In Stock,0.11,2024-12-09 +IC,LM358,SOIC-8,C7950,Texas Instruments,LM358DR,"Dual Operational Amplifier",0,In Stock,0.11,2024-12-09 +IC,LM324,SOIC-14,C6744,Texas Instruments,LM324DR,"Quad Operational Amplifier",0,In Stock,0.15,2024-12-09 +IC,74HC595,SOIC-16,C5947,Texas Instruments,SN74HC595DR,"8-bit Shift Register with Output Latches",0,In Stock,0.15,2024-12-09 +IC,74HC4051,SOIC-16,C6977,Texas Instruments,CD74HC4051M,"8-channel Analog Multiplexer",0,In Stock,0.18,2024-12-09 +IC,FT232RL,SSOP-28,C8690,FTDI,FT232RL,"USB to Serial UART Interface",0,In Stock,3.45,2024-12-09 +IC,CH340G,SOIC-16,C14267,WCH,CH340G,"USB to Serial UART Interface",0,In Stock,0.44,2024-12-09 +IC,ESP32-WROOM-32,MODULE,C82899,Espressif,ESP32-WROOM-32,"WiFi+Bluetooth Module",0,In Stock,2.84,2024-12-09 +IC,ESP8266-12F,MODULE,C8619,AI-Thinker,ESP-12F,"WiFi Module",0,In Stock,1.77,2024-12-09 +# CRYSTALS & OSCILLATORS +XTAL,8MHz,HC-49S,C13738,Yangxing Tech,X49SM8MSD2SC,"Crystal 8MHz ±30ppm",0,In Stock,0.12,2024-12-09 +XTAL,16MHz,HC-49S,C13741,Yangxing Tech,X49SM16MSD2SC,"Crystal 16MHz ±30ppm",0,In Stock,0.13,2024-12-09 +XTAL,25MHz,HC-49S,C13749,Yangxing Tech,X49SM25MSD2SC,"Crystal 25MHz ±30ppm",0,In Stock,0.14,2024-12-09 +XTAL,32.768kHz,3215,C32346,Seiko,SC32S-20PF30RSPN,"Crystal 32.768kHz ±20ppm Watch Crystal",0,In Stock,0.25,2024-12-09 +# LEDs - Basic Parts +LED,Red,0603,C2286,Hubei KENTO,KT-0603R,"LED Red 2V 20mA 0603",0,In Stock,0.02,2024-12-09 +LED,Green,0603,C2290,Hubei KENTO,KT-0603G,"LED Green 3.2V 20mA 0603",0,In Stock,0.02,2024-12-09 +LED,Blue,0603,C72041,Hubei KENTO,KT-0603B,"LED Blue 3.2V 20mA 0603",0,In Stock,0.02,2024-12-09 +LED,White,0603,C72043,Hubei KENTO,KT-0603W,"LED White 3.2V 20mA 0603",0,In Stock,0.03,2024-12-09 +# DIODES +D,1N4148W,SOD-123,C81598,Changjiang Electronics,1N4148W,"Switching Diode 75V 150mA",0,In Stock,0.015,2024-12-09 +D,1N5819,SOD-123FL,C8598,Changjiang Electronics,1N5819,"Schottky Diode 40V 1A",180,In Stock,0.03,2024-12-09 \ No newline at end of file diff --git a/docs/JLCPCB_Generator_Guide.md b/docs/JLCPCB_Generator_Guide.md new file mode 100644 index 0000000..e858290 --- /dev/null +++ b/docs/JLCPCB_Generator_Guide.md @@ -0,0 +1,160 @@ +# JLCPCB Basic Parts Generator + +This guide describes how to use the automated symbol generation for JLCPCB Basic Parts. + +## 🎯 Purpose + +The generator creates KiCad symbol libraries with proper **Fabrication Toolkit** properties for seamless JLCPCB assembly integration. All symbols use standard KiCad footprints - no custom footprints needed! + +## 📋 Compatible with Fabrication Toolkit + +The generated symbols include all properties required by [bennymeg/JLC-Plugin-for-KiCad](https://github.com/bennymeg/JLC-Plugin-for-KiCad): + +- `LCSC Part #` - For automatic part matching +- `Manufacturer` - Component manufacturer +- `MFG Part #` - Manufacturer part number +- `FT Rotation Offset` - Pick-and-place rotation correction +- Standard KiCad footprint references + +## 🗂️ Input Database + +The database `docs/JLCPCB_Basic_Parts.csv` contains: +- **Resistors**: UniOhm Basic Parts (0603 preferred) +- **Capacitors**: Samsung Basic Parts (0603, 0805) +- **Inductors**: Murata Basic Parts (0603, 0805) +- **ICs**: STM32, CAN, Power, Interface ICs +- **Components**: LEDs, Diodes, Crystals + +All parts are JLCPCB Basic Parts for lowest assembly cost. + +## ⚙️ Usage + +### Windows PowerShell +```powershell +# Generate all libraries and reports +.\scripts\Generate_JLCPCB_Symbols.ps1 -CsvPath ".\docs\JLCPCB_Basic_Parts.csv" -OutputPath "." + +# Dry run (preview only) +.\scripts\Generate_JLCPCB_Symbols.ps1 -CsvPath ".\docs\JLCPCB_Basic_Parts.csv" -OutputPath "." -DryRun +``` + +### Linux/macOS Bash +```bash +# Generate all libraries and reports +./scripts/generate_jlcpcb_symbols.sh -c ./docs/JLCPCB_Basic_Parts.csv -o . + +# Dry run (preview only) +./scripts/generate_jlcpcb_symbols.sh -c ./docs/JLCPCB_Basic_Parts.csv -o . --dry-run + +# Skip symbol generation, only generate reports +./scripts/generate_jlcpcb_symbols.sh -c ./docs/JLCPCB_Basic_Parts.csv -o . --skip-symbols +``` + +## 📤 Output + +### Symbol Libraries +- `symbols/Standard_Passives.kicad_sym` - Resistors, Capacitors, Inductors +- `symbols/Standard_ICs.kicad_sym` - Microcontrollers, CAN, Power ICs +- `symbols/Standard_Components.kicad_sym` - LEDs, Diodes, Crystals + +### BOM Template +- `docs/JLCPCB_BOM_Template.csv` - Ready for JLCPCB assembly upload + +### Reports +- Component statistics by package and manufacturer +- Cost analysis for complete starter kit +- Footprint mapping summary + +## 🔧 KiCad Integration + +### 1. Add Symbol Libraries +``` +KiCad → Preferences → Manage Symbol Libraries → Project Specific Libraries + +Add: +- Nickname: Standard_Passives +- Library Path: ${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Standard_Passives.kicad_sym + +- Nickname: Standard_ICs +- Library Path: ${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Standard_ICs.kicad_sym + +- Nickname: Standard_Components +- Library Path: ${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Standard_Components.kicad_sym +``` + +### 2. Use Standard Footprints +No footprint configuration needed - symbols automatically reference standard KiCad footprints: +- Resistors → `Resistor_SMD:R_0603_1608Metric` +- Capacitors → `Capacitor_SMD:C_0603_1608Metric` +- ICs → `Package_SO:SOIC-16_3.9x9.9mm_P1.27mm` + +### 3. JLCPCB Assembly Workflow +1. Design schematic using generated symbols +2. Create PCB layout +3. Export BOM with Fabrication Toolkit plugin +4. Upload to JLCPCB with automatic part matching + +## 📊 Example Components + +### Standard Passives +| Component | Value | Package | LCSC | Footprint | +|-----------|-------|---------|------|-----------| +| Resistor | 10k | 0603 | C25804 | Resistor_SMD:R_0603_1608Metric | +| Capacitor | 100nF | 0603 | C14663 | Capacitor_SMD:C_0603_1608Metric | +| Inductor | 10µH | 0805 | C1046 | Inductor_SMD:L_0805_2012Metric | + +### Standard ICs +| Component | Package | LCSC | Footprint | +|-----------|---------|------|-----------| +| STM32F103C8T6 | LQFP-48 | C8734 | Package_QFP:LQFP-48_7x7mm_P0.5mm | +| MCP2515 | SOIC-18 | C55199 | Package_SO:SOIC-18W_7.5x11.6mm_P1.27mm | +| AMS1117-3.3 | SOT-223 | C6186 | Package_TO_SOT_SMD:SOT-223-3_TabPin2 | + +## 🔄 Updating the Database + +### Adding New Parts +1. Edit `docs/JLCPCB_Basic_Parts.csv` +2. Add new line with format: `Component,Value,Package,LCSC Part #,Manufacturer,MFG Part #,Description,FT Rotation Offset,Stock Status,Price 1k,Last Update` +3. Run generator script +4. Test symbols in KiCad + +### Verifying LCSC Numbers +- Check [lcsc.com](https://lcsc.com) for current availability +- Prefer "Basic Parts" (marked with green "Basic" label) +- Verify pricing and stock status + +## ⚠️ Important Notes + +### Rotation Offsets +- Most components: `0` (no rotation needed) +- SOT-223 regulators: `180` (common requirement) +- Check actual assembly if rotation issues occur + +### Symbol Limitations +- ICs use generic rectangular symbols +- Actual pinout must be defined manually for complex ICs +- Passives are ready-to-use with correct pin assignments + +### Cost Optimization +- All parts are JLCPCB Basic Parts +- Complete kit cost: ~$50 for 1000 pieces each +- Setup fee applies for each unique part (~$3) +- Minimize unique parts to reduce cost + +## 🛠️ Customization + +### Adding New Component Types +1. Add entries to CSV database +2. Update `get_kicad_footprint()` function in scripts +3. Add symbol graphics in `get_symbol_graphics()` +4. Test generation + +### Custom Footprints +If standard KiCad footprints don't fit: +1. Create custom footprint in your library +2. Update footprint mapping in script +3. Ensure 3D model compatibility + +--- + +*Compatible with KiCad 7.0+ and Fabrication Toolkit plugin* \ No newline at end of file diff --git a/docs/KiCad_Setup.md b/docs/KiCad_Setup.md new file mode 100644 index 0000000..c612b59 --- /dev/null +++ b/docs/KiCad_Setup.md @@ -0,0 +1,153 @@ +# KiCad Library Configuration + +Diese Dateien helfen beim Setup der Custom Library in KiCad. + +## Symbol Libraries (sym-lib-table) + +Fügen Sie diese Zeilen zu Ihrer `sym-lib-table` hinzu: + +``` + (lib (name "Custom_Amplifiers")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Amplifiers_Custom.kicad_sym")(options "")(descr "Custom Amplifiers")) + (lib (name "Custom_Communication")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Communication_Custom.kicad_sym")(options "")(descr "Custom Communication ICs")) + (lib (name "Custom_Connectors")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Connectors_Custom.kicad_sym")(options "")(descr "Custom Connectors")) + (lib (name "Custom_Display")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Display_Custom.kicad_sym")(options "")(descr "Custom Display Components")) + (lib (name "Custom_Logic")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Logic_Custom.kicad_sym")(options "")(descr "Custom Logic ICs")) + (lib (name "Custom_MCU")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/MCU_Custom.kicad_sym")(options "")(descr "Custom Microcontrollers")) + (lib (name "Custom_Memory")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Memory_Custom.kicad_sym")(options "")(descr "Custom Memory Components")) + (lib (name "Custom_Power")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Power_Custom.kicad_sym")(options "")(descr "Custom Power Management")) + (lib (name "Custom_RF")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/RF_Custom.kicad_sym")(options "")(descr "Custom RF Components")) + (lib (name "Custom_Sensors")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Sensors_Custom.kicad_sym")(options "")(descr "Custom Sensors")) + (lib (name "Logos_Artwork")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/symbols/Logos_Artwork.kicad_sym")(options "")(descr "Logos and Artwork")) +``` + +## Footprint Libraries (fp-lib-table) + +Fügen Sie diese Zeilen zu Ihrer `fp-lib-table` hinzu: + +``` + (lib (name "Custom_BGA")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/BGA_Custom.pretty")(options "")(descr "Custom BGA Packages")) + (lib (name "Custom_Connectors_Audio")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/Connectors_Audio.pretty")(options "")(descr "Custom Audio Connectors")) + (lib (name "Custom_Connectors_Power")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/Connectors_Power.pretty")(options "")(descr "Custom Power Connectors")) + (lib (name "Custom_Connectors_USB")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/Connectors_USB.pretty")(options "")(descr "Custom USB Connectors")) + (lib (name "Custom_IC")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/IC_Custom.pretty")(options "")(descr "Custom IC Packages")) + (lib (name "Custom_Mechanical")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/Mechanical.pretty")(options "")(descr "Mechanical Components")) + (lib (name "Custom_Modules")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/Modules_Custom.pretty")(options "")(descr "Custom Modules")) + (lib (name "Custom_QFN")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/QFN_Custom.pretty")(options "")(descr "Custom QFN Packages")) + (lib (name "Custom_Sensors")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/Sensors_Custom.pretty")(options "")(descr "Custom Sensor Packages")) + (lib (name "Custom_TestPoints")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/TestPoints.pretty")(options "")(descr "Test Points")) + (lib (name "Logos_Silkscreen")(type "KiCad")(uri "${KIPRJMOD}/kicad_libs/my-kicad-libs/footprints/Logos_Silkscreen.pretty")(options "")(descr "Logos for Silkscreen")) +``` + +## Setup-Anleitung + +### 1. Projekt-spezifisch (empfohlen) +1. Kopieren Sie den gesamten `my-kicad-libs` Ordner in Ihr Projekt-Verzeichnis +2. Erstellen/bearbeiten Sie `sym-lib-table` im Projektordner +3. Erstellen/bearbeiten Sie `fp-lib-table` im Projektordner +4. Relative Pfade verwenden (`${KIPRJMOD}/kicad_libs/my-kicad-libs/...`) + +### 2. Global (für alle Projekte) +1. Kopieren Sie `my-kicad-libs` in einen permanenten Ordner +2. KiCad → Preferences → Manage Symbol Libraries → Global Libraries +3. KiCad → Preferences → Manage Footprint Libraries → Global Libraries +4. Absolute Pfade verwenden + +### 3. Environment Variable (flexibelste Lösung) +1. Erstellen Sie Environment Variable: `CUSTOM_KICAD_LIBS` +2. Setzen Sie Pfad zu `my-kicad-libs` Ordner +3. In Library-Tabellen verwenden: `${CUSTOM_KICAD_LIBS}/symbols/...` + +## Automatisches Setup Script (Windows PowerShell) + +```powershell +# setup_kicad_libs.ps1 +param( + [string]$ProjectPath = (Get-Location).Path, + [switch]$Global +) + +$libPath = Join-Path $ProjectPath "kicad_libs\my-kicad-libs" + +if (-not (Test-Path $libPath)) { + Write-Error "Library path not found: $libPath" + exit 1 +} + +# Symbol Library Setup +$symLibTable = if ($Global) { + Join-Path $env:APPDATA "kicad\8.0\sym-lib-table" +} else { + Join-Path $ProjectPath "sym-lib-table" +} + +# Footprint Library Setup +$fpLibTable = if ($Global) { + Join-Path $env:APPDATA "kicad\8.0\fp-lib-table" +} else { + Join-Path $ProjectPath "fp-lib-table" +} + +Write-Host "Setting up KiCad libraries..." +Write-Host "Symbol table: $symLibTable" +Write-Host "Footprint table: $fpLibTable" + +# Hier würde der eigentliche Setup-Code stehen... +``` + +## Überprüfung der Installation + +Nach dem Setup sollten Sie folgendes sehen: + +### Im Symbol-Browser +- Custom_Amplifiers +- Custom_Communication +- Custom_Connectors +- etc... + +### Im Footprint-Browser +- Custom_BGA +- Custom_Connectors_Audio +- Custom_Connectors_Power +- etc... + +### Test +1. Erstellen Sie ein neues Schaltplan-Symbol +2. Schauen Sie, ob die Custom-Libraries in der Liste erscheinen +3. Erstellen Sie einen neuen Footprint +4. Prüfen Sie die Verfügbarkeit der Custom-Footprint-Libraries + +## Troubleshooting + +### Libraries erscheinen nicht +- Pfade in `sym-lib-table` und `fp-lib-table` prüfen +- `${KIPRJMOD}` Variable korrekt? +- Dateirechte prüfen +- KiCad neustarten + +### 3D-Modelle fehlen +- Pfade in Footprints korrekt? +- `${KIPRJMOD}` oder absolute Pfade verwenden +- 3D-Viewer-Cache leeren + +### Performance-Probleme +- Große Bibliotheken können KiCad verlangsamen +- Nur benötigte Libraries aktivieren +- Projekt-spezifische Tables verwenden + +## Backup & Versionierung + +### Git Integration +```bash +# .gitignore anpassen +echo "fp-info-cache" >> .gitignore +echo "*.kicad_prl" >> .gitignore + +# Libraries tracken +git add kicad_libs/ +git commit -m "Add custom KiCad libraries" +``` + +### Backup-Strategie +1. Regelmäßige Commits der Library-Änderungen +2. Tags für stabile Versionen +3. Separate Branches für experimentelle Features \ No newline at end of file diff --git a/docs/Komponenten_Template.md b/docs/Komponenten_Template.md new file mode 100644 index 0000000..0f60d34 --- /dev/null +++ b/docs/Komponenten_Template.md @@ -0,0 +1,108 @@ +# Komponenten-Dokumentation Template + +Verwenden Sie diese Vorlage für die Dokumentation neuer Komponenten. + +## [Komponenten-Name] + +### Grundinformationen +- **Partnummer**: [Vollständige Herstellerbezeichnung] +- **Hersteller**: [Firmenname] +- **Kategorie**: [Logic/Power/Sensors/etc.] +- **Package**: [QFN-32, LQFP-100, etc.] +- **Erstellt**: [YYYY-MM-DD] +- **Ersteller**: [Name] +- **Status**: [In Arbeit/Testing/Verified/Obsolete] + +### Dateien +- **Symbol**: `symbols/[Kategorie]_Custom.kicad_sym` → `[Komponenten-Name]` +- **Footprint**: `footprints/[Kategorie].pretty/[Footprint-Name].kicad_mod` +- **3D-Modell**: `3d_models/[Kategorie]/[Modell-Name].[step/wrl]` +- **Datenblatt**: `datasheets/[Hersteller]/[Partnummer].pdf` oder [URL] + +### Technische Daten +- **Versorgungsspannung**: [V] +- **Betriebstemperatur**: [°C] +- **Besondere Eigenschaften**: [Liste wichtiger Features] +- **Pin-Count**: [Anzahl Pins] +- **Gehäusegröße**: [mm x mm x mm] + +### Elektrische Eigenschaften +| Parameter | Min | Typ | Max | Einheit | Bemerkungen | +|-----------|-----|-----|-----|---------|-------------| +| VCC | | | | V | | +| ICC | | | | mA | | +| ... | | | | | | + +### Pin-Belegung +| Pin | Name | Typ | Funktion | Bemerkungen | +|-----|------|-----|----------|-------------| +| 1 | | I/O | | | +| 2 | | PWR | | | +| ... | | | | | + +### Design Notes +- **Layout-Hinweise**: [Spezielle Anforderungen für PCB-Layout] +- **Bestückung**: [Besondere Löt-/Bestückungshinweise] +- **Thermal**: [Wärmeableitung, Thermal Vias, etc.] +- **EMV**: [Schirmung, Filterung, etc.] + +### Verwendung +- **Anwendungen**: [Typische Einsatzgebiete] +- **Referenz-Design**: [Link zu Beispielschaltung] +- **Ähnliche Komponenten**: [Alternative/kompatible Teile] + +### Testing +- **ERC**: ✅/❌ [Elektrische Regelprüfung] +- **DRC**: ✅/❌ [Design-Regelprüfung] +- **3D-Ansicht**: ✅/❌ [3D-Darstellung korrekt] +- **Prototyp**: ✅/❌ [Realer Test durchgeführt] +- **Produktion**: ✅/❌ [In Produktion verwendet] + +### Changelog +| Datum | Version | Änderung | Grund | +|-------|---------|----------|-------| +| YYYY-MM-DD | v1.0 | Erstellt | Initial | + +### Links +- [Datenblatt]([URL]) +- [Hersteller-Seite]([URL]) +- [Distributor]([URL]) +- [Reference Design]([URL]) + +--- + +## Beispiel: TPS54340 + +### Grundinformationen +- **Partnumber**: TPS54340DDAR +- **Hersteller**: Texas Instruments +- **Kategorie**: Power +- **Package**: HTSSOP-14 PowerPAD +- **Erstellt**: 2024-12-09 +- **Ersteller**: Max Mustermann +- **Status**: Verified + +### Dateien +- **Symbol**: `symbols/Power_Custom.kicad_sym` → `TPS54340_HTSSOP-14_PowerPAD` +- **Footprint**: `footprints/IC_Custom.pretty/HTSSOP-14_4.4x5mm_0.65mm_PowerPAD2.84x3.05mm.kicad_mod` +- **3D-Modell**: `3d_models/IC_Packages/HTSSOP-14_4.4x5mm_PowerPAD.step` +- **Datenblatt**: https://www.ti.com/lit/ds/symlink/tps54340.pdf + +### Technische Daten +- **Versorgungsspannung**: 4.5V - 42V +- **Betriebstemperatur**: -40°C bis +125°C +- **Besondere Eigenschaften**: 3.5A Step-Down Converter, 570kHz +- **Pin-Count**: 14 (+ PowerPAD) +- **Gehäusegröße**: 4.4 x 5.0 x 1.0 mm + +### Design Notes +- **Layout-Hinweise**: PowerPAD mit 9x 0.3mm Vias verbinden, kurze Verbindungen zu Input/Output-Caps +- **Bestückung**: Reflow-Löten, PowerPAD vor Bestückung verzinnen +- **Thermal**: PowerPAD für Wärmeableitung essential, min. 4-Layer PCB empfohlen + +### Testing +- **ERC**: ✅ Keine Fehler +- **DRC**: ✅ Alle Regeln erfüllt +- **3D-Ansicht**: ✅ Korrekte Darstellung +- **Prototyp**: ✅ Erfolgreich getestet in 12V→3.3V Applikation +- **Produktion**: ✅ In 3 Projekten erfolgreich eingesetzt \ No newline at end of file diff --git a/docs/Logo_Artwork_Anleitung.md b/docs/Logo_Artwork_Anleitung.md new file mode 100644 index 0000000..73b5777 --- /dev/null +++ b/docs/Logo_Artwork_Anleitung.md @@ -0,0 +1,224 @@ +# Logo & Artwork Anleitung + +Diese Anleitung beschreibt, wie Sie Logos und Artwork für Ihre KiCad-Bibliothek erstellen. + +## 🎨 Logo-Erstellung für Silkscreen + +### Vorbereitung +1. **Originalbild**: Hochauflösende Vektorgrafik (SVG) oder mindestens 300 DPI +2. **Vereinfachung**: Logo muss silkscreen-tauglich sein (keine feinen Details) +3. **Mindestgröße**: Linien mindestens 0.15mm breit +4. **Kontrast**: Schwarz-weiß, keine Graustufen + +### Größenrichtlinien +- **Große Logos**: 10-15mm (Hauptlogo auf PCB) +- **Mittlere Logos**: 5-8mm (Seitlicher Branding) +- **Kleine Logos**: 2-4mm (Diskrete Kennzeichnung) +- **Mini-Logos**: 1-2mm (Nur einfache Symbole) + +### Bitmap zu Footprint Konvertierung + +#### Option 1: KiCad Bitmap2Component +1. KiCad → Tools → Bitmap to Component Converter +2. Bitmap laden (PNG, JPG) +3. Format: "Footprint" wählen +4. Negative ausgeben: Ja (für Silkscreen) +5. Board layer: F.SilkS oder B.SilkS +6. Threshold anpassen für saubere Konturen +7. Export als .kicad_mod + +#### Option 2: SVG2Shenzhen Plugin +1. Inkscape mit svg2shenzhen Plugin +2. SVG mit definierten Layern erstellen +3. Export direkt zu KiCad Footprint + +### CC-Lizenz Logos + +#### Creative Commons BY-SA +``` +Größen: 3mm, 5mm, 8mm, 10mm +Dateien: +- CC_BY-SA_3mm.kicad_mod +- CC_BY-SA_5mm.kicad_mod +- CC_BY-SA_8mm.kicad_mod +- CC_BY-SA_10mm.kicad_mod +``` + +#### Creative Commons BY-NC-SA +``` +Größen: 3mm, 5mm, 8mm, 10mm +Dateien: +- CC_BY-NC-SA_3mm.kicad_mod +- CC_BY-NC-SA_5mm.kicad_mod +- CC_BY-NC-SA_8mm.kicad_mod +- CC_BY-NC-SA_10mm.kicad_mod +``` + +### OSHW (Open Source Hardware) Logos +``` +Varianten: +- OSHW_DE_3mm.kicad_mod (Deutschland) +- OSHW_US_3mm.kicad_mod (USA) +- OSHW_Generic_3mm.kicad_mod (Ohne Land) +``` + +## 📏 Technische Spezifikationen + +### Silkscreen-Beschränkungen +- **Minimale Linienbreite**: 0.15mm (0.006") +- **Minimaler Text**: 0.8mm hoch, 0.15mm Strichbreite +- **Minimaler Abstand**: 0.1mm zwischen Elementen +- **Farben**: Nur eine Farbe pro Layer + +### Footprint-Layer +- **F.SilkS**: Vordere Silkscreen-Schicht +- **B.SilkS**: Rückere Silkscreen-Schicht +- **F.Fab**: Fabrication-Layer (interne Dokumentation) +- **F.CrtYd**: Courtyard (Platzierungsbereich) + +### Positionierung +- **Referenz**: Automatisch generiert, verschiebbar +- **Value**: Versteckt oder "LOGO" setzen +- **Courtyard**: 0.1mm um Logo-Kontur + +## 🛠️ Workflow + +### 1. Logo vorbereiten +```bash +# Bildbearbeitung (GIMP/Photoshop) +1. Logo öffnen +2. Auf 300 DPI skalieren +3. Schwarz-weiß konvertieren +4. Rauschen entfernen +5. Als PNG exportieren (schwarz auf weiß) +``` + +### 2. In KiCad konvertieren +``` +Bitmap2Component: +- Width: Zielbreite in mm +- Height: Automatisch berechnet +- Resolution: 300 DPI +- Format: Footprint +- Negative: Aktiviert +- Layers: F.SilkS +``` + +### 3. Footprint nachbearbeiten +``` +Im Footprint-Editor: +1. Unnötige Linien entfernen +2. Referenz positionieren +3. Courtyard hinzufügen +4. Eigenschaften setzen: + - Keywords: logo, artwork + - Description: "Company logo - [size]mm" +``` + +### 4. In Bibliothek einordnen +``` +Speichern unter: +footprints/Logos_Silkscreen.pretty/Logo_[Name]_[Size]mm.kicad_mod +``` + +## 📁 Dateiorganisation + +### Footprint-Namen +``` +Logo_[Firmenname]_[Größe]mm.kicad_mod +Logo_[Firmenname]_[Größe]mm_[Variante].kicad_mod + +Beispiele: +- Logo_MyCompany_10mm.kicad_mod +- Logo_MyCompany_5mm_Icon.kicad_mod +- Logo_Stadler_8mm_Text.kicad_mod +``` + +### CC-Lizenz Namen +``` +CC_[Lizenz]_[Größe]mm.kicad_mod + +Beispiele: +- CC_BY-SA_5mm.kicad_mod +- CC_BY-NC-SA_3mm.kicad_mod +``` + +### Quellmaterial +``` +docs/logos/ +├── source_images/ +│ ├── company_logo.svg +│ ├── cc_by_sa.svg +│ └── oshw_logo.svg +├── processed/ +│ ├── company_logo_10mm.png +│ ├── company_logo_5mm.png +│ └── ... +└── guidelines.md +``` + +## ⚙️ Symbol-Erstellung für Logos + +### Logo-Symbole +Manchmal sind Logo-Symbole nützlich für Schaltpläne: + +``` +Symbol-Name: LOGO_[Name]_[Typ] +Beispiel: LOGO_MyCompany_Silkscreen + +Eigenschaften: +- Reference: #LOGO +- Value: Logo +- Footprint: Logos_Silkscreen:Logo_MyCompany_5mm +- No Pin: Aktiviert (graphisches Symbol) +``` + +### Symbol-Bibliothek +Speichern in: `symbols/Logos_Artwork.kicad_sym` + +## 🎯 Best Practices + +### Design-Richtlinien +1. **Einfachheit**: Details, die kleiner als 0.2mm sind, entfernen +2. **Kontrast**: Starker Schwarz-weiß-Kontrast +3. **Skalierbarkeit**: Logo muss in verschiedenen Größen funktionieren +4. **Lesbarkeit**: Text ab 1mm Höhe lesbar + +### Qualitätskontrolle +- [ ] 3D-Ansicht prüfen +- [ ] Verschiedene Zoom-Stufen testen +- [ ] Gerber-Viewer verwenden +- [ ] Probedruck auf Transparent-Folie + +### Rechtliche Aspekte +1. **Eigene Logos**: Frei verwendbar +2. **Lizenz-Logos**: Nutzungsbedingungen beachten +3. **Fremde Marken**: Nur mit Erlaubnis +4. **Standards**: OSHW-Logo korrekt verwenden + +## 📋 Checkliste + +### Vor der Erstellung +- [ ] Logo-Rechte geklärt +- [ ] Zielgrößen definiert +- [ ] Qualität des Quellmaterials geprüft + +### Nach der Erstellung +- [ ] Mindestlinienbreite eingehalten (0.15mm) +- [ ] 3D-Ansicht kontrolliert +- [ ] Verschiedene Größen getestet +- [ ] Dokumentation aktualisiert +- [ ] In Git committed + +### Vor Produktion +- [ ] Gerber-Files geprüft +- [ ] Silkscreen-Preview angeschaut +- [ ] Bei Unklarheit: Prototyp bestellen + +## 🔗 Nützliche Links + +- [KiCad Bitmap2Component Tutorial](https://docs.kicad.org/8.0/en/bitmap2component/bitmap2component.html) +- [svg2shenzhen Plugin](https://github.com/badgeek/svg2shenzhen) +- [Creative Commons Logos](https://creativecommons.org/about/downloads/) +- [OSHW Logo Guidelines](https://www.oshwa.org/open-source-hardware-logo/) +- [PCB Silkscreen Guidelines](https://www.pcbway.com/pcb_prototype/What_is_Silkscreen_in_PCB.html) \ No newline at end of file diff --git a/docs/Standard_Components_LCSC.md b/docs/Standard_Components_LCSC.md new file mode 100644 index 0000000..de5855f --- /dev/null +++ b/docs/Standard_Components_LCSC.md @@ -0,0 +1,237 @@ +# Standard Components with LCSC Integration + +This guide describes the system for standard passive components (R, C, L) and common ICs with LCSC part numbers. + +## 🎯 Objectives + +- **Consistent assembly**: Always use the same, well-available parts +- **Cost optimization**: LCSC Basic Parts for low costs +- **Automation**: Direct BOM generation for JLCPCB/LCSC +- **Standardization**: Fixed value series for all projects + +## 📊 Standard Component Categories + +### Standard Passives (R/C/L) +- **Purpose**: Cost-optimized standard values with LCSC numbers +- **Footprints**: Use existing KiCad footprints (Resistor_SMD, Capacitor_SMD, Inductor_SMD) +- **Symbols**: Custom symbols with complete LCSC data +- **Examples**: `100nF_0603_C14663`, `10k_0603_C25804`, `100uH_0805_C1046` + +### Standard ICs +- **Purpose**: Common ICs with LCSC numbers for automated assembly +- **Categories**: + - **CAN Controllers**: MCP2515, SN65HVD230 + - **STM32 MCUs**: STM32F103C8T6, STM32F407VGT6 + - **Voltage Regulators**: AMS1117-3.3, LM2596 + - **Op-Amps**: LM358, LM324, TL074 + - **Logic**: 74HC595, 74HC4051 + - **Interface**: FT232RL, CH340G +- **Footprints**: Use existing KiCad footprints (Package_SO, Package_QFP, etc.) + +## 🏷️ Naming Convention + +### Symbol Names +``` +Standard Passives: [Value]_[Package]_[LCSC] +Standard ICs: [Partnumber]_[Package]_[LCSC] + +Examples: +100nF_0603_C14663 +10k_0603_C25804 +1uF_0805_C28323 +STM32F103C8T6_LQFP-48_C8734 +MCP2515_SOIC-18_C55199 +AMS1117-3.3_SOT-223_C6186 +``` + +### Symbol Properties +``` +Reference: R?, C?, L?, U? +Value: [Value] (e.g. "100nF", "10k", "STM32F103C8T6") +Footprint: [KiCad_Library]:[Standard_Footprint] + Examples: + - Resistor_SMD:R_0603_1608Metric + - Capacitor_SMD:C_0603_1608Metric + - Package_SO:SOIC-18W_7.5x11.6mm_P1.27mm + - Package_QFP:LQFP-48_7x7mm_P0.5mm +Datasheet: [LCSC-URL] +Description: [Full specification] +LCSC: [C-Number] +Manufacturer: [Manufacturer name] +MPN: [Manufacturer Part Number] +Package: [0603/SOIC-18/LQFP-48/etc.] +``` + +## 📋 LCSC Basic Parts Database + +### Resistors (UniOhm Thick Film, 1%) +| Value | Package | LCSC | MPN | Description | Price@1k | +|-------|---------|------|-----|-------------|----------| +| 0R | 0603 | C21189 | 0603WAF0000T5E | Res 0R 1/10W 0603 | $0.002 | +| 10R | 0603 | C22859 | 0603WAF100JT5E | Res 10R 1% 1/10W 0603 | $0.002 | +| 100R | 0603 | C22775 | 0603WAF1000T5E | Res 100R 1% 1/10W 0603 | $0.002 | +| 1k | 0603 | C21190 | 0603WAF1001T5E | Res 1k 1% 1/10W 0603 | $0.002 | +| 10k | 0603 | C25804 | 0603WAF1002T5E | Res 10k 1% 1/10W 0603 | $0.002 | +| 100k | 0603 | C25803 | 0603WAF1003T5E | Res 100k 1% 1/10W 0603 | $0.002 | + +### Capacitors (Samsung CL Series, X7R, 50V) +| Value | Package | LCSC | MPN | Description | Price@1k | +|-------|---------|------|-----|-------------|----------| +| 100pF | 0603 | C1524 | CL10B101KB8NNNC | Cap 100pF 50V X7R 0603 | $0.002 | +| 1nF | 0603 | C1523 | CL10B102KB8NNNC | Cap 1nF 50V X7R 0603 | $0.002 | +| 10nF | 0603 | C57112 | CL10B103KB8NNNC | Cap 10nF 50V X7R 0603 | $0.003 | +| 100nF | 0603 | C14663 | CL10B104KB8NNNC | Cap 100nF 50V X7R 0603 | $0.003 | +| 1µF | 0603 | C15849 | CL10A105KA8NNNC | Cap 1µF 25V X5R 0603 | $0.004 | +| 10µF | 0805 | C15850 | CL21A106KAQNNNE | Cap 10µF 25V X5R 0805 | $0.008 | + +### Standard ICs (LCSC Basic Parts) +| Component | Package | LCSC | MPN | Description | Price@1k | +|-----------|---------|------|-----|-------------|----------| +| STM32F103C8T6 | LQFP-48 | C8734 | STM32F103C8T6 | MCU 32-bit ARM Cortex M3 | $2.89 | +| MCP2515 | SOIC-18 | C55199 | MCP2515-I/SO | CAN Controller | $1.67 | +| SN65HVD230 | SOIC-8 | C12084 | SN65HVD230DR | CAN Transceiver | $0.39 | +| AMS1117-3.3 | SOT-223 | C6186 | AMS1117-3.3 | LDO 3.3V 1A | $0.11 | +| LM358 | SOIC-8 | C7950 | LM358DR | Dual Op-Amp | $0.11 | +| 74HC595 | SOIC-16 | C5947 | 74HC595D | 8-bit Shift Register | $0.15 | +| FT232RL | SSOP-28 | C8690 | FT232RL | USB to Serial | $3.45 | + +## 🗂️ Library Structure + +### Symbol Libraries +``` +symbols/ +├── Standard_Passives.kicad_sym +│ ├── Resistors/ +│ │ ├── 10R_0603_C22859 +│ │ ├── 100R_0603_C22775 +│ │ ├── 1k_0603_C21190 +│ │ └── ... +│ ├── Capacitors/ +│ │ ├── 100nF_0603_C14663 +│ │ ├── 1uF_0603_C15849 +│ │ └── ... +│ └── Inductors/ +│ ├── 100nH_0603_C1588 +│ └── ... +└── Standard_ICs.kicad_sym + ├── Microcontrollers/ + │ ├── STM32F103C8T6_LQFP-48_C8734 + │ └── ... + ├── CAN/ + │ ├── MCP2515_SOIC-18_C55199 + │ ├── SN65HVD230_SOIC-8_C12084 + │ └── ... + └── Power/ + ├── AMS1117-3.3_SOT-223_C6186 + └── ... +``` + +### Footprint Mapping +**Standard components use existing KiCad footprints:** + +``` +Resistors → Resistor_SMD:R_[Package]_[Metric] +Capacitors → Capacitor_SMD:C_[Package]_[Metric] +Inductors → Inductor_SMD:L_[Package]_[Metric] + +ICs → Package_SO:SOIC-[pins]... + Package_QFP:LQFP-[pins]... + Package_TO_SOT_SMD:SOT-223... + etc. +``` + +## ⚙️ Workflow + +### Adding New Standard Component + +#### 1. Research Phase +```bash +# Check if component exists in KiCad +1. Open KiCad Symbol Editor +2. Search for component in standard libraries +3. If exists: Note library and symbol name +4. If not exists: Create custom symbol +``` + +#### 2. LCSC Lookup +```bash +# Find LCSC part number +1. Search component on lcsc.com +2. Check if it's a "Basic Part" (lower cost) +3. Verify stock status and pricing +4. Note: LCSC#, Manufacturer, MPN +``` + +#### 3. Symbol Creation +```bash +# Create symbol with LCSC data +1. Use existing KiCad symbol as template (if available) +2. Add LCSC properties: + - LCSC: C-Number + - Manufacturer: Company name + - MPN: Manufacturer Part Number +3. Set footprint to standard KiCad footprint +4. Add datasheet URL +``` + +#### 4. Testing +```bash +# Verify in test circuit +1. Create test schematic +2. Run ERC (Electrical Rules Check) +3. Create test PCB +4. Run DRC (Design Rules Check) +5. Check 3D view +``` + +### BOM Generation for JLCPCB + +#### Export Format +```csv +Comment,Designator,Footprint,LCSC,Manufacturer,MPN +100nF,C1;C2;C5,C_0603_1608Metric,C14663,Samsung,CL10B104KB8NNNC +10k,R1;R3;R7,R_0603_1608Metric,C25804,UniOhm,0603WAF1002T5E +STM32F103C8T6,U1,LQFP-48_7x7mm_P0.5mm,C8734,STMicroelectronics,STM32F103C8T6 +``` + +## 🎯 Best Practices + +### Component Selection Strategy +1. **Always check LCSC first**: Use Basic Parts when possible +2. **Standardize values**: Prefer E24 series for resistors +3. **Package consistency**: Use 0603 for most passives +4. **Verify availability**: Check stock before committing to design + +### Cost Optimization +| Strategy | Savings | Implementation | +|----------|---------|----------------| +| Basic Parts only | 50-80% | Use LCSC Basic Parts database | +| Standard packages | 20-30% | Stick to 0603, SOIC, QFP | +| Volume planning | 10-20% | Order 1000+ pieces | +| Setup minimization | $2-5 per unique part | Reuse same values | + +### Design Guidelines +- **0603 preferred**: Good balance of size/handling +- **Basic Parts first**: Always check Basic Parts availability +- **Standard values**: E24 series for resistors, E6 for capacitors +- **Safety margins**: +20% on critical values + +## 🔄 Maintenance + +### Regular Updates +1. **Monthly**: Check LCSC availability and pricing +2. **Quarterly**: Update Basic Parts list +3. **Per project**: Verify all parts in stock before ordering +4. **KiCad updates**: Test footprint compatibility + +### Version Control +```bash +# Git workflow +git add symbols/Standard_*.kicad_sym +git commit -m "feat: add STM32F407 with LCSC C13303" +git tag -a v1.2.0 -m "Standard ICs v1.2.0" +``` + +--- + +*This document is regularly synchronized with current LCSC data.* \ No newline at end of file diff --git a/docs/Standard_Passives_LCSC.de.md b/docs/Standard_Passives_LCSC.de.md new file mode 100644 index 0000000..1811080 --- /dev/null +++ b/docs/Standard_Passives_LCSC.de.md @@ -0,0 +1,306 @@ +# Standard-Passivbauteile mit LCSC-Integration + +Diese Anleitung beschreibt das System für Standard-Passivbauteile (R, C, L) mit LCSC-Bestellnummern. + +## 🎯 Zielsetzung + +- **Einheitliche Bestückung**: Immer die gleichen, gut verfügbaren Teile verwenden +- **Kostenoptimierung**: LCSC Basic Parts für niedrige Kosten +- **Automatisierung**: Direkte BOM-Generierung für JLCPCB/LCSC +- **Standardisierung**: Feste Werte-Reihen für alle Projekte + +## 📊 Standard-Werte-Reihen + +### Kondensatoren (Keramik, X7R, 50V) +``` +Übliche Werte: +100pF, 220pF, 470pF, 1nF, 2.2nF, 4.7nF, 10nF, 22nF, 47nF, 100nF, 220nF, 470nF, 1µF, 2.2µF, 4.7µF, 10µF, 22µF, 47µF, 100µF + +Packages: +0402: 100pF - 1µF +0603: 100pF - 10µF +0805: 100pF - 22µF +1206: 100pF - 47µF +``` + +### Widerstände (Dickschicht, 1%, 1/16W-1/4W) +``` +E24-Reihe bevorzugt: +1.0, 1.1, 1.2, 1.3, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.7, 3.0, 3.3, 3.6, 3.9, 4.3, 4.7, 5.1, 5.6, 6.2, 6.8, 7.5, 8.2, 9.1 + +Dekaden: 1Ω - 10MΩ + +Packages: +0402: 1Ω - 1MΩ +0603: 1Ω - 10MΩ +0805: 1Ω - 10MΩ +1206: 1Ω - 10MΩ +``` + +### Induktivitäten (Ferrit, 20%) +``` +Übliche Werte: +10nH, 22nH, 47nH, 100nH, 220nH, 470nH, 1µH, 2.2µH, 4.7µH, 10µH, 22µH, 47µH, 100µH, 220µH, 470µH, 1mH + +Packages: +0402: 1nH - 47nH (HF) +0603: 10nH - 470nH +0805: 100nH - 10µH +1206: 470nH - 1mH +``` + +## 🏷️ Naming Convention + +### Symbol-Namen +``` +Format: [Wert]_[Package]_[LCSC] + +Beispiele: +100nF_0402_C1525 +10k_0603_C25804 +1uF_0805_C28323 +100uH_1206_C51942 + +Spezialwerte: +DNP_0603_C25804 # Do Not Populate (gleiche Größe wie Referenz-Teil) +0R_0603_C21189 # 0-Ohm Brücke +NC_0603 # Not Connected (ohne LCSC#) +``` + +### Eigenschaften (Symbol Properties) +``` +Reference: R?, C?, L? +Value: [Wert] (z.B. "100nF", "10k", "100uH") +Footprint: Passives_Standard:[Package]_[Typ] +Datasheet: [LCSC-URL] +Description: [Spezifikation] +LCSC: [C-Nummer] +Manufacturer: [Herstellername] +MPN: [Manufacturer Part Number] +Package: [0402/0603/0805/1206] +``` + +### Footprint-Namen +``` +Format: [Package]_[Typ]_[Besonderheiten] + +Standard: +R_0402_1005Metric +R_0603_1608Metric +R_0805_2012Metric +R_1206_3216Metric + +C_0402_1005Metric +C_0603_1608Metric +C_0805_2012Metric +C_1206_3216Metric + +L_0402_1005Metric +L_0603_1608Metric +L_0805_2012Metric +L_1206_3216Metric + +Spezial: +R_0603_1608Metric_HandSolder # Vergrößerte Pads +C_0805_2012Metric_HighVolt # Erhöhte Abstände +``` + +## 📋 LCSC Basic Parts Liste + +### Kondensatoren (Samsung CL-Series, X7R, 50V) +``` +# 0402 Package +100nF_0402_C1525 # CL05B104KO5NNNC, Samsung, X7R, 50V +10nF_0402_C15195 # CL05B103KO5NNNC, Samsung, X7R, 50V +1nF_0402_C1523 # CL05B102KO5NNNC, Samsung, X7R, 50V +100pF_0402_C1524 # CL05B101KO5NNNC, Samsung, X7R, 50V + +# 0603 Package +100nF_0603_C14663 # CL10B104KB8NNNC, Samsung, X7R, 50V +10nF_0603_C57112 # CL10B103KB8NNNC, Samsung, X7R, 50V +1µF_0603_C15849 # CL10A105KA8NNNC, Samsung, X5R, 25V + +# 0805 Package +100nF_0805_C49678 # CL21B104KBCNNNC, Samsung, X7R, 50V +10µF_0805_C15850 # CL21A106KAQNNNE, Samsung, X5R, 25V +1µF_0805_C28323 # CL21B105KOFNNNE, Samsung, X7R, 50V + +# 1206 Package +100nF_1206_C13585 # CL31B104KBCNNNC, Samsung, X7R, 50V +47µF_1206_C13585 # CL31A476MQHNNNE, Samsung, X5R, 6.3V +``` + +### Widerstände (UniOhm Thick Film, 1%) +``` +# 0402 Package +0R_0402_C25611 # 0402WGF0000TCE, UniOhm, 1/16W +10R_0402_C25077 # 0402WGF100JTCE, UniOhm, 1/16W +100R_0402_C25076 # 0402WGF1000TCE, UniOhm, 1/16W +1k_0402_C11702 # 0402WGF1001TCE, UniOhm, 1/16W +10k_0402_C25744 # 0402WGF1002TCE, UniOhm, 1/16W +100k_0402_C25741 # 0402WGF1003TCE, UniOhm, 1/16W + +# 0603 Package +0R_0603_C21189 # 0603WAF0000T5E, UniOhm, 1/10W +10R_0603_C22859 # 0603WAF100JT5E, UniOhm, 1/10W +100R_0603_C22775 # 0603WAF1000T5E, UniOhm, 1/10W +1k_0603_C21190 # 0603WAF1001T5E, UniOhm, 1/10W +10k_0603_C25804 # 0603WAF1002T5E, UniOhm, 1/10W +100k_0603_C25803 # 0603WAF1003T5E, UniOhm, 1/10W + +# 0805 Package +0R_0805_C17477 # 0805W8F0000T5E, UniOhm, 1/8W +10k_0805_C17414 # 0805W8F1002T5E, UniOhm, 1/8W +100k_0805_C17407 # 0805W8F1003T5E, UniOhm, 1/8W + +# 1206 Package +0R_1206_C4310 # 1206W4F0000T5E, UniOhm, 1/4W +10k_1206_C4190 # 1206W4F1002T5E, UniOhm, 1/4W +``` + +### Induktivitäten (Murata LQG-Series) +``` +# 0603 Package +10nH_0603_C1649 # LQG18HN10NJ00D, Murata, ±5% +100nH_0603_C1588 # LQG18HN101J00D, Murata, ±5% +1µH_0603_C1617 # LQG18HN1R0J00D, Murata, ±5% + +# 0805 Package +100nH_0805_C1729 # LQG21HN101J10D, Murata, ±5% +1µH_0805_C1734 # LQG21HN1R0J10D, Murata, ±5% +10µH_0805_C1046 # LQG21HN100J10D, Murata, ±5% + +# 1206 Package +100µH_1206_C51942 # LQG31HN101J03L, Murata, ±5% +1mH_1206_C90319 # LQG31MN1R0K03L, Murata, ±10% +``` + +## 🗂️ Ordnerstruktur + +### Symbol-Bibliothek +``` +symbols/Passives_Standard.kicad_sym +├── Kapazitäten/ +│ ├── 100pF_0402_C1524 +│ ├── 100nF_0603_C14663 +│ ├── 1uF_0805_C28323 +│ └── ... +├── Widerstände/ +│ ├── 0R_0603_C21189 +│ ├── 10k_0603_C25804 +│ ├── 100k_0603_C25803 +│ └── ... +└── Induktivitäten/ + ├── 100nH_0603_C1588 + ├── 1uH_0805_C1734 + └── ... +``` + +### Footprint-Bibliothek +``` +footprints/Passives_Standard.pretty/ +├── R_0402_1005Metric.kicad_mod +├── R_0603_1608Metric.kicad_mod +├── R_0805_2012Metric.kicad_mod +├── R_1206_3216Metric.kicad_mod +├── C_0402_1005Metric.kicad_mod +├── C_0603_1608Metric.kicad_mod +├── C_0805_2012Metric.kicad_mod +├── C_1206_3216Metric.kicad_mod +├── L_0603_1608Metric.kicad_mod +├── L_0805_2012Metric.kicad_mod +└── L_1206_3216Metric.kicad_mod +``` + +## ⚙️ Symbol-Erstellung Workflow + +### 1. Neue Komponente hinzufügen +```python +# Symbol-Template für Widerstand +Symbol Name: 10k_0603_C25804 +Reference: R +Value: 10k +Footprint: Passives_Standard:R_0603_1608Metric +Description: Resistor, 10kΩ, 1%, 1/10W, 0603 +LCSC: C25804 +Manufacturer: UniOhm +MPN: 0603WAF1002T5E +Package: 0603 +Datasheet: https://lcsc.com/product-detail/C25804.html +``` + +### 2. Automatisierte Erstellung +```powershell +# PowerShell Script für Bulk-Erstellung +param($Type, $Values, $Package, $LcscData) + +foreach ($value in $Values) { + $symbolName = "$($value)_$($Package)_$($LcscData[$value].LCSC)" + # Symbol mit Template erstellen... +} +``` + +## 📊 BOM-Integration + +### KiCad BOM-Export +Erweiterte Felder für BOM: +- `LCSC`: C-Nummer für automatischen Import +- `Manufacturer`: Herstellername +- `MPN`: Manufacturer Part Number +- `Package`: Gehäusegröße +- `Description`: Vollständige Spezifikation + +### JLCPCB Integration +```csv +# BOM-Format für JLCPCB Assembly +Comment,Designator,Footprint,LCSC +100nF,C1;C2;C5,C_0603_1608Metric,C14663 +10k,R1;R3;R7,R_0603_1608Metric,C25804 +1uF,C3;C4,C_0805_2012Metric,C28323 +``` + +### Cost-Tracking +| Package | Basic Part | Extended Part | Premium | +|---------|------------|---------------|---------| +| 0402 | $0.002 | $0.008 | $0.02+ | +| 0603 | $0.003 | $0.01 | $0.03+ | +| 0805 | $0.004 | $0.012 | $0.04+ | +| 1206 | $0.006 | $0.015 | $0.06+ | + +## 🔄 Update-Workflow + +### Regelmäßige Updates +1. **LCSC-Verfügbarkeit prüfen** (monatlich) +2. **Preise vergleichen** (bei neuen Projekten) +3. **Neue Basic Parts** integrieren +4. **Obsolete Teile** markieren + +### Version Management +``` +CHANGELOG für Passivbauteile: +v1.0: Initial Standard-Set mit LCSC Basic Parts +v1.1: Erweitert um 1206 Package +v1.2: Neue Samsung Kondensator-Serie integriert +``` + +## 🎯 Best Practices + +### Projekt-Setup +1. **Standard-Set definieren**: 90% aller Projekte +2. **Projekt-spezifische Ergänzungen**: Nur wenn notwendig +3. **BOM-Review**: Vor Bestellung LCSC-Verfügbarkeit prüfen + +### Design-Guidelines +- **0603 bevorzugen**: Guter Kompromiss Größe/Handhabung +- **Basic Parts**: Immer erste Wahl +- **Standardwerte**: E24-Reihe für Widerstände +- **Sicherheitsmargen**: +20% auf kritische Werte + +### Kostenoptimierung +- **Bulk-Rabatte**: Gleiche Werte mehrfach verwenden +- **Setup-Kosten**: Weniger verschiedene Werte = günstiger +- **Lagerkosten**: Standard-Set auf Vorrat + +--- + +*Diese Liste wird regelmäßig mit aktuellen LCSC-Daten synchronisiert.* \ No newline at end of file diff --git a/docs/Standard_Passives_LCSC.md b/docs/Standard_Passives_LCSC.md new file mode 100644 index 0000000..1811080 --- /dev/null +++ b/docs/Standard_Passives_LCSC.md @@ -0,0 +1,306 @@ +# Standard-Passivbauteile mit LCSC-Integration + +Diese Anleitung beschreibt das System für Standard-Passivbauteile (R, C, L) mit LCSC-Bestellnummern. + +## 🎯 Zielsetzung + +- **Einheitliche Bestückung**: Immer die gleichen, gut verfügbaren Teile verwenden +- **Kostenoptimierung**: LCSC Basic Parts für niedrige Kosten +- **Automatisierung**: Direkte BOM-Generierung für JLCPCB/LCSC +- **Standardisierung**: Feste Werte-Reihen für alle Projekte + +## 📊 Standard-Werte-Reihen + +### Kondensatoren (Keramik, X7R, 50V) +``` +Übliche Werte: +100pF, 220pF, 470pF, 1nF, 2.2nF, 4.7nF, 10nF, 22nF, 47nF, 100nF, 220nF, 470nF, 1µF, 2.2µF, 4.7µF, 10µF, 22µF, 47µF, 100µF + +Packages: +0402: 100pF - 1µF +0603: 100pF - 10µF +0805: 100pF - 22µF +1206: 100pF - 47µF +``` + +### Widerstände (Dickschicht, 1%, 1/16W-1/4W) +``` +E24-Reihe bevorzugt: +1.0, 1.1, 1.2, 1.3, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.7, 3.0, 3.3, 3.6, 3.9, 4.3, 4.7, 5.1, 5.6, 6.2, 6.8, 7.5, 8.2, 9.1 + +Dekaden: 1Ω - 10MΩ + +Packages: +0402: 1Ω - 1MΩ +0603: 1Ω - 10MΩ +0805: 1Ω - 10MΩ +1206: 1Ω - 10MΩ +``` + +### Induktivitäten (Ferrit, 20%) +``` +Übliche Werte: +10nH, 22nH, 47nH, 100nH, 220nH, 470nH, 1µH, 2.2µH, 4.7µH, 10µH, 22µH, 47µH, 100µH, 220µH, 470µH, 1mH + +Packages: +0402: 1nH - 47nH (HF) +0603: 10nH - 470nH +0805: 100nH - 10µH +1206: 470nH - 1mH +``` + +## 🏷️ Naming Convention + +### Symbol-Namen +``` +Format: [Wert]_[Package]_[LCSC] + +Beispiele: +100nF_0402_C1525 +10k_0603_C25804 +1uF_0805_C28323 +100uH_1206_C51942 + +Spezialwerte: +DNP_0603_C25804 # Do Not Populate (gleiche Größe wie Referenz-Teil) +0R_0603_C21189 # 0-Ohm Brücke +NC_0603 # Not Connected (ohne LCSC#) +``` + +### Eigenschaften (Symbol Properties) +``` +Reference: R?, C?, L? +Value: [Wert] (z.B. "100nF", "10k", "100uH") +Footprint: Passives_Standard:[Package]_[Typ] +Datasheet: [LCSC-URL] +Description: [Spezifikation] +LCSC: [C-Nummer] +Manufacturer: [Herstellername] +MPN: [Manufacturer Part Number] +Package: [0402/0603/0805/1206] +``` + +### Footprint-Namen +``` +Format: [Package]_[Typ]_[Besonderheiten] + +Standard: +R_0402_1005Metric +R_0603_1608Metric +R_0805_2012Metric +R_1206_3216Metric + +C_0402_1005Metric +C_0603_1608Metric +C_0805_2012Metric +C_1206_3216Metric + +L_0402_1005Metric +L_0603_1608Metric +L_0805_2012Metric +L_1206_3216Metric + +Spezial: +R_0603_1608Metric_HandSolder # Vergrößerte Pads +C_0805_2012Metric_HighVolt # Erhöhte Abstände +``` + +## 📋 LCSC Basic Parts Liste + +### Kondensatoren (Samsung CL-Series, X7R, 50V) +``` +# 0402 Package +100nF_0402_C1525 # CL05B104KO5NNNC, Samsung, X7R, 50V +10nF_0402_C15195 # CL05B103KO5NNNC, Samsung, X7R, 50V +1nF_0402_C1523 # CL05B102KO5NNNC, Samsung, X7R, 50V +100pF_0402_C1524 # CL05B101KO5NNNC, Samsung, X7R, 50V + +# 0603 Package +100nF_0603_C14663 # CL10B104KB8NNNC, Samsung, X7R, 50V +10nF_0603_C57112 # CL10B103KB8NNNC, Samsung, X7R, 50V +1µF_0603_C15849 # CL10A105KA8NNNC, Samsung, X5R, 25V + +# 0805 Package +100nF_0805_C49678 # CL21B104KBCNNNC, Samsung, X7R, 50V +10µF_0805_C15850 # CL21A106KAQNNNE, Samsung, X5R, 25V +1µF_0805_C28323 # CL21B105KOFNNNE, Samsung, X7R, 50V + +# 1206 Package +100nF_1206_C13585 # CL31B104KBCNNNC, Samsung, X7R, 50V +47µF_1206_C13585 # CL31A476MQHNNNE, Samsung, X5R, 6.3V +``` + +### Widerstände (UniOhm Thick Film, 1%) +``` +# 0402 Package +0R_0402_C25611 # 0402WGF0000TCE, UniOhm, 1/16W +10R_0402_C25077 # 0402WGF100JTCE, UniOhm, 1/16W +100R_0402_C25076 # 0402WGF1000TCE, UniOhm, 1/16W +1k_0402_C11702 # 0402WGF1001TCE, UniOhm, 1/16W +10k_0402_C25744 # 0402WGF1002TCE, UniOhm, 1/16W +100k_0402_C25741 # 0402WGF1003TCE, UniOhm, 1/16W + +# 0603 Package +0R_0603_C21189 # 0603WAF0000T5E, UniOhm, 1/10W +10R_0603_C22859 # 0603WAF100JT5E, UniOhm, 1/10W +100R_0603_C22775 # 0603WAF1000T5E, UniOhm, 1/10W +1k_0603_C21190 # 0603WAF1001T5E, UniOhm, 1/10W +10k_0603_C25804 # 0603WAF1002T5E, UniOhm, 1/10W +100k_0603_C25803 # 0603WAF1003T5E, UniOhm, 1/10W + +# 0805 Package +0R_0805_C17477 # 0805W8F0000T5E, UniOhm, 1/8W +10k_0805_C17414 # 0805W8F1002T5E, UniOhm, 1/8W +100k_0805_C17407 # 0805W8F1003T5E, UniOhm, 1/8W + +# 1206 Package +0R_1206_C4310 # 1206W4F0000T5E, UniOhm, 1/4W +10k_1206_C4190 # 1206W4F1002T5E, UniOhm, 1/4W +``` + +### Induktivitäten (Murata LQG-Series) +``` +# 0603 Package +10nH_0603_C1649 # LQG18HN10NJ00D, Murata, ±5% +100nH_0603_C1588 # LQG18HN101J00D, Murata, ±5% +1µH_0603_C1617 # LQG18HN1R0J00D, Murata, ±5% + +# 0805 Package +100nH_0805_C1729 # LQG21HN101J10D, Murata, ±5% +1µH_0805_C1734 # LQG21HN1R0J10D, Murata, ±5% +10µH_0805_C1046 # LQG21HN100J10D, Murata, ±5% + +# 1206 Package +100µH_1206_C51942 # LQG31HN101J03L, Murata, ±5% +1mH_1206_C90319 # LQG31MN1R0K03L, Murata, ±10% +``` + +## 🗂️ Ordnerstruktur + +### Symbol-Bibliothek +``` +symbols/Passives_Standard.kicad_sym +├── Kapazitäten/ +│ ├── 100pF_0402_C1524 +│ ├── 100nF_0603_C14663 +│ ├── 1uF_0805_C28323 +│ └── ... +├── Widerstände/ +│ ├── 0R_0603_C21189 +│ ├── 10k_0603_C25804 +│ ├── 100k_0603_C25803 +│ └── ... +└── Induktivitäten/ + ├── 100nH_0603_C1588 + ├── 1uH_0805_C1734 + └── ... +``` + +### Footprint-Bibliothek +``` +footprints/Passives_Standard.pretty/ +├── R_0402_1005Metric.kicad_mod +├── R_0603_1608Metric.kicad_mod +├── R_0805_2012Metric.kicad_mod +├── R_1206_3216Metric.kicad_mod +├── C_0402_1005Metric.kicad_mod +├── C_0603_1608Metric.kicad_mod +├── C_0805_2012Metric.kicad_mod +├── C_1206_3216Metric.kicad_mod +├── L_0603_1608Metric.kicad_mod +├── L_0805_2012Metric.kicad_mod +└── L_1206_3216Metric.kicad_mod +``` + +## ⚙️ Symbol-Erstellung Workflow + +### 1. Neue Komponente hinzufügen +```python +# Symbol-Template für Widerstand +Symbol Name: 10k_0603_C25804 +Reference: R +Value: 10k +Footprint: Passives_Standard:R_0603_1608Metric +Description: Resistor, 10kΩ, 1%, 1/10W, 0603 +LCSC: C25804 +Manufacturer: UniOhm +MPN: 0603WAF1002T5E +Package: 0603 +Datasheet: https://lcsc.com/product-detail/C25804.html +``` + +### 2. Automatisierte Erstellung +```powershell +# PowerShell Script für Bulk-Erstellung +param($Type, $Values, $Package, $LcscData) + +foreach ($value in $Values) { + $symbolName = "$($value)_$($Package)_$($LcscData[$value].LCSC)" + # Symbol mit Template erstellen... +} +``` + +## 📊 BOM-Integration + +### KiCad BOM-Export +Erweiterte Felder für BOM: +- `LCSC`: C-Nummer für automatischen Import +- `Manufacturer`: Herstellername +- `MPN`: Manufacturer Part Number +- `Package`: Gehäusegröße +- `Description`: Vollständige Spezifikation + +### JLCPCB Integration +```csv +# BOM-Format für JLCPCB Assembly +Comment,Designator,Footprint,LCSC +100nF,C1;C2;C5,C_0603_1608Metric,C14663 +10k,R1;R3;R7,R_0603_1608Metric,C25804 +1uF,C3;C4,C_0805_2012Metric,C28323 +``` + +### Cost-Tracking +| Package | Basic Part | Extended Part | Premium | +|---------|------------|---------------|---------| +| 0402 | $0.002 | $0.008 | $0.02+ | +| 0603 | $0.003 | $0.01 | $0.03+ | +| 0805 | $0.004 | $0.012 | $0.04+ | +| 1206 | $0.006 | $0.015 | $0.06+ | + +## 🔄 Update-Workflow + +### Regelmäßige Updates +1. **LCSC-Verfügbarkeit prüfen** (monatlich) +2. **Preise vergleichen** (bei neuen Projekten) +3. **Neue Basic Parts** integrieren +4. **Obsolete Teile** markieren + +### Version Management +``` +CHANGELOG für Passivbauteile: +v1.0: Initial Standard-Set mit LCSC Basic Parts +v1.1: Erweitert um 1206 Package +v1.2: Neue Samsung Kondensator-Serie integriert +``` + +## 🎯 Best Practices + +### Projekt-Setup +1. **Standard-Set definieren**: 90% aller Projekte +2. **Projekt-spezifische Ergänzungen**: Nur wenn notwendig +3. **BOM-Review**: Vor Bestellung LCSC-Verfügbarkeit prüfen + +### Design-Guidelines +- **0603 bevorzugen**: Guter Kompromiss Größe/Handhabung +- **Basic Parts**: Immer erste Wahl +- **Standardwerte**: E24-Reihe für Widerstände +- **Sicherheitsmargen**: +20% auf kritische Werte + +### Kostenoptimierung +- **Bulk-Rabatte**: Gleiche Werte mehrfach verwenden +- **Setup-Kosten**: Weniger verschiedene Werte = günstiger +- **Lagerkosten**: Standard-Set auf Vorrat + +--- + +*Diese Liste wird regelmäßig mit aktuellen LCSC-Daten synchronisiert.* \ No newline at end of file diff --git a/scripts/Generate_JLCPCB_Symbols.ps1 b/scripts/Generate_JLCPCB_Symbols.ps1 new file mode 100644 index 0000000..6298269 --- /dev/null +++ b/scripts/Generate_JLCPCB_Symbols.ps1 @@ -0,0 +1,453 @@ +# KiCad Symbol Generator for JLCPCB Basic Parts +# Generates KiCad symbol libraries with Fabrication Toolkit compatible properties +# Compatible with bennymeg/JLC-Plugin-for-KiCad + +param( + [Parameter(Mandatory=$true)] + [string]$CsvPath, + + [Parameter(Mandatory=$true)] + [string]$OutputPath, + + [switch]$CreateSymbols = $true, + [switch]$GenerateReport = $true, + [switch]$DryRun = $false +) + +Write-Host "KiCad JLCPCB Basic Parts Symbol Generator" -ForegroundColor Green +Write-Host "=========================================" -ForegroundColor Green + +# Validate input file +if (-not (Test-Path $CsvPath)) { + Write-Error "CSV file not found: $CsvPath" + exit 1 +} + +# Import CSV data +Write-Host "Loading JLCPCB Basic Parts database: $CsvPath" -ForegroundColor Yellow +try { + $parts = Import-Csv $CsvPath + Write-Host "Successfully loaded $($parts.Count) parts" -ForegroundColor Green +} catch { + Write-Error "Failed to load CSV file: $_" + exit 1 +} + +# Group parts by component type +$resistors = $parts | Where-Object { $_.Component -eq "R" } +$capacitors = $parts | Where-Object { $_.Component -eq "C" } +$inductors = $parts | Where-Object { $_.Component -eq "L" } +$ics = $parts | Where-Object { $_.Component -eq "IC" } +$crystals = $parts | Where-Object { $_.Component -eq "XTAL" } +$leds = $parts | Where-Object { $_.Component -eq "LED" } +$diodes = $parts | Where-Object { $_.Component -eq "D" } + +Write-Host "Component distribution:" -ForegroundColor Cyan +Write-Host " Resistors: $($resistors.Count)" -ForegroundColor White +Write-Host " Capacitors: $($capacitors.Count)" -ForegroundColor White +Write-Host " Inductors: $($inductors.Count)" -ForegroundColor White +Write-Host " ICs: $($ics.Count)" -ForegroundColor White +Write-Host " Crystals: $($crystals.Count)" -ForegroundColor White +Write-Host " LEDs: $($leds.Count)" -ForegroundColor White +Write-Host " Diodes: $($diodes.Count)" -ForegroundColor White + +# Function to convert package size to metric footprint name +function Get-KiCadFootprint { + param($component, $package) + + switch ($component) { + "R" { + switch ($package) { + "0402" { "Resistor_SMD:R_0402_1005Metric" } + "0603" { "Resistor_SMD:R_0603_1608Metric" } + "0805" { "Resistor_SMD:R_0805_2012Metric" } + "1206" { "Resistor_SMD:R_1206_3216Metric" } + default { "Resistor_SMD:R_$package" } + } + } + "C" { + switch ($package) { + "0402" { "Capacitor_SMD:C_0402_1005Metric" } + "0603" { "Capacitor_SMD:C_0603_1608Metric" } + "0805" { "Capacitor_SMD:C_0805_2012Metric" } + "1206" { "Capacitor_SMD:C_1206_3216Metric" } + default { "Capacitor_SMD:C_$package" } + } + } + "L" { + switch ($package) { + "0603" { "Inductor_SMD:L_0603_1608Metric" } + "0805" { "Inductor_SMD:L_0805_2012Metric" } + "1206" { "Inductor_SMD:L_1206_3216Metric" } + default { "Inductor_SMD:L_$package" } + } + } + "IC" { + switch ($package) { + "SOIC-8" { "Package_SO:SOIC-8_3.9x4.9mm_P1.27mm" } + "SOIC-14" { "Package_SO:SOIC-14_3.9x8.7mm_P1.27mm" } + "SOIC-16" { "Package_SO:SOIC-16_3.9x9.9mm_P1.27mm" } + "SOIC-18" { "Package_SO:SOIC-18W_7.5x11.6mm_P1.27mm" } + "LQFP-48" { "Package_QFP:LQFP-48_7x7mm_P0.5mm" } + "TSSOP-20" { "Package_SO:TSSOP-20_4.4x6.5mm_P0.65mm" } + "SOT-223" { "Package_TO_SOT_SMD:SOT-223-3_TabPin2" } + "SSOP-28" { "Package_SO:SSOP-28_5.3x10.2mm_P0.65mm" } + "MODULE" { "RF_Module:ESP32-WROOM-32" } # Special case for modules + default { "Package_SO:$package" } + } + } + "XTAL" { + switch ($package) { + "HC-49S" { "Crystal:Crystal_HC49-SD_SMD" } + "3215" { "Crystal:Crystal_SMD_3215-2Pin_3.2x1.5mm" } + default { "Crystal:Crystal_$package" } + } + } + "LED" { + switch ($package) { + "0603" { "LED_SMD:LED_0603_1608Metric" } + "0805" { "LED_SMD:LED_0805_2012Metric" } + default { "LED_SMD:LED_$package" } + } + } + "D" { + switch ($package) { + "SOD-123" { "Diode_SMD:D_SOD-123" } + "SOD-123FL" { "Diode_SMD:D_SOD-123F" } + default { "Diode_SMD:D_$package" } + } + } + default { "Unknown:$package" } + } +} + +# Function to generate KiCad symbol template +function Get-SymbolTemplate { + param($part, $referencePrefix) + + $symbolName = "$($part.Value)_$($part.Package)_$($part.'LCSC Part #')" + $footprint = Get-KiCadFootprint $part.Component $part.Package + $datasheet = "https://lcsc.com/product-detail/$($part.'LCSC Part #').html" + + # Clean up special characters in symbol name for KiCad compatibility + $symbolName = $symbolName -replace '[µ]', 'u' + + return @" + (symbol "$symbolName" (in_bom yes) (on_board yes) + (property "Reference" "$referencePrefix" (at 0 2.54 0) + (effects (font (size 1.27 1.27)))) + (property "Value" "$($part.Value)" (at 0 -2.54 0) + (effects (font (size 1.27 1.27)))) + (property "Footprint" "$footprint" (at 0 -5.08 0) + (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "$datasheet" (at 0 -7.62 0) + (effects (font (size 1.27 1.27)) hide)) + (property "Description" "$($part.Description)" (at 0 -10.16 0) + (effects (font (size 1.27 1.27)) hide)) + (property "LCSC Part #" "$($part.'LCSC Part #')" (at 0 -12.70 0) + (effects (font (size 1.27 1.27)) hide)) + (property "Manufacturer" "$($part.Manufacturer)" (at 0 -15.24 0) + (effects (font (size 1.27 1.27)) hide)) + (property "MFG Part #" "$($part.'MFG Part #')" (at 0 -17.78 0) + (effects (font (size 1.27 1.27)) hide)) + (property "Package" "$($part.Package)" (at 0 -20.32 0) + (effects (font (size 1.27 1.27)) hide)) + (property "FT Rotation Offset" "$($part.'FT Rotation Offset')" (at 0 -22.86 0) + (effects (font (size 1.27 1.27)) hide)) + $(Get-SymbolGraphics $part.Component $symbolName) + ) +"@ +} + +# Function to generate symbol graphics based on component type +function Get-SymbolGraphics { + param($componentType, $symbolName) + + switch ($componentType) { + "R" { + return @" + (symbol "${symbolName}_0_1" + (rectangle (start -1.016 -2.54) (end 1.016 2.54) + (stroke (width 0.254) (type default)) + (fill (type none)))) + (symbol "${symbolName}_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +"@ + } + "C" { + return @" + (symbol "${symbolName}_0_1" + (polyline + (pts (xy -2.032 -0.762) (xy 2.032 -0.762)) + (stroke (width 0.508) (type default)) + (fill (type none))) + (polyline + (pts (xy -2.032 0.762) (xy 2.032 0.762)) + (stroke (width 0.508) (type default)) + (fill (type none)))) + (symbol "${symbolName}_1_1" + (pin passive line (at 0 2.54 270) (length 1.778) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 0 -2.54 90) (length 1.778) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +"@ + } + "L" { + return @" + (symbol "${symbolName}_0_1" + (arc (start 0 -2.54) (mid 0.635 -1.905) (end 0 -1.27) + (stroke (width 0) (type default)) + (fill (type none))) + (arc (start 0 -1.27) (mid 0.635 -0.635) (end 0 0) + (stroke (width 0) (type default)) + (fill (type none))) + (arc (start 0 0) (mid 0.635 0.635) (end 0 1.27) + (stroke (width 0) (type default)) + (fill (type none))) + (arc (start 0 1.27) (mid 0.635 1.905) (end 0 2.54) + (stroke (width 0) (type default)) + (fill (type none)))) + (symbol "${symbolName}_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "1" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "2" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +"@ + } + "IC" { + # For ICs, create a simple rectangle - actual pinout would need manual definition + return @" + (symbol "${symbolName}_0_1" + (rectangle (start -7.62 5.08) (end 7.62 -5.08) + (stroke (width 0.254) (type default)) + (fill (type background)))) + (symbol "${symbolName}_1_1" + (pin input line (at -10.16 0 0) (length 2.54) + (name "VCC" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin input line (at 10.16 0 180) (length 2.54) + (name "GND" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +"@ + } + "LED" { + return @" + (symbol "${symbolName}_0_1" + (polyline + (pts (xy -1.27 -1.27) (xy -1.27 1.27)) + (stroke (width 0.254) (type default)) + (fill (type none))) + (polyline + (pts (xy -1.27 0) (xy 1.27 0)) + (stroke (width 0) (type default)) + (fill (type none))) + (polyline + (pts (xy 1.27 -1.27) (xy 1.27 1.27) (xy -1.27 0) (xy 1.27 -1.27)) + (stroke (width 0.254) (type default)) + (fill (type none)))) + (symbol "${symbolName}_1_1" + (pin passive line (at -3.81 0 0) (length 2.54) + (name "K" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 3.81 0 180) (length 2.54) + (name "A" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +"@ + } + default { + # Generic two-pin component + return @" + (symbol "${symbolName}_0_1" + (rectangle (start -1.27 1.27) (end 1.27 -1.27) + (stroke (width 0.254) (type default)) + (fill (type none)))) + (symbol "${symbolName}_1_1" + (pin passive line (at -2.54 0 0) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 2.54 0 180) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +"@ + } + } +} + +# Generate symbol libraries +if ($CreateSymbols -and -not $DryRun) { + Write-Host "Generating KiCad symbol libraries..." -ForegroundColor Yellow + + # Create output directory + $symbolsDir = Join-Path $OutputPath "symbols" + if (-not (Test-Path $symbolsDir)) { + New-Item -Path $symbolsDir -ItemType Directory -Force | Out-Null + } + + # Generate Standard Passives library + if ($resistors.Count -gt 0 -or $capacitors.Count -gt 0 -or $inductors.Count -gt 0) { + Write-Host " Creating Standard_Passives.kicad_sym..." -ForegroundColor Cyan + + $passivesHeader = @" +(kicad_symbol_lib (version 20211014) (generator "JLCPCB-Generator") + (symbol_lib_info (name "Standard_Passives") (description "JLCPCB Basic Parts - Passives with Fabrication Toolkit properties")) +"@ + + $passivesSymbols = @() + foreach ($resistor in $resistors) { $passivesSymbols += Get-SymbolTemplate $resistor "R" } + foreach ($capacitor in $capacitors) { $passivesSymbols += Get-SymbolTemplate $capacitor "C" } + foreach ($inductor in $inductors) { $passivesSymbols += Get-SymbolTemplate $inductor "L" } + + $passivesContent = $passivesHeader + "`n" + ($passivesSymbols -join "`n") + "`n)" + $passivesPath = Join-Path $symbolsDir "Standard_Passives.kicad_sym" + $passivesContent | Out-File -FilePath $passivesPath -Encoding UTF8 + + Write-Host " Created: $passivesPath" -ForegroundColor Green + } + + # Generate Standard ICs library + if ($ics.Count -gt 0) { + Write-Host " Creating Standard_ICs.kicad_sym..." -ForegroundColor Cyan + + $icsHeader = @" +(kicad_symbol_lib (version 20211014) (generator "JLCPCB-Generator") + (symbol_lib_info (name "Standard_ICs") (description "JLCPCB Basic Parts - ICs with Fabrication Toolkit properties")) +"@ + + $icsSymbols = @() + foreach ($ic in $ics) { $icsSymbols += Get-SymbolTemplate $ic "U" } + + $icsContent = $icsHeader + "`n" + ($icsSymbols -join "`n") + "`n)" + $icsPath = Join-Path $symbolsDir "Standard_ICs.kicad_sym" + $icsContent | Out-File -FilePath $icsPath -Encoding UTF8 + + Write-Host " Created: $icsPath" -ForegroundColor Green + } + + # Generate Standard Components library (LEDs, Diodes, Crystals) + if ($leds.Count -gt 0 -or $diodes.Count -gt 0 -or $crystals.Count -gt 0) { + Write-Host " Creating Standard_Components.kicad_sym..." -ForegroundColor Cyan + + $componentsHeader = @" +(kicad_symbol_lib (version 20211014) (generator "JLCPCB-Generator") + (symbol_lib_info (name "Standard_Components") (description "JLCPCB Basic Parts - LEDs, Diodes, Crystals with Fabrication Toolkit properties")) +"@ + + $componentsSymbols = @() + foreach ($led in $leds) { $componentsSymbols += Get-SymbolTemplate $led "D" } + foreach ($diode in $diodes) { $componentsSymbols += Get-SymbolTemplate $diode "D" } + foreach ($crystal in $crystals) { $componentsSymbols += Get-SymbolTemplate $crystal "Y" } + + $componentsContent = $componentsHeader + "`n" + ($componentsSymbols -join "`n") + "`n)" + $componentsPath = Join-Path $symbolsDir "Standard_Components.kicad_sym" + $componentsContent | Out-File -FilePath $componentsPath -Encoding UTF8 + + Write-Host " Created: $componentsPath" -ForegroundColor Green + } +} + +# Generate BOM template for JLCPCB +if ($GenerateReport) { + Write-Host "Generating JLCPCB BOM template..." -ForegroundColor Yellow + + $bomHeader = @" +# JLCPCB Assembly BOM Template +# Generated from JLCPCB Basic Parts Database +# Compatible with JLC Plugin for KiCad (bennymeg) + +Comment,Designator,Footprint,LCSC Part #,Manufacturer,MFG Part # +"@ + + $bomLines = @() + foreach ($part in $parts) { + $footprint = (Get-KiCadFootprint $part.Component $part.Package) -replace ".*:", "" + $bomLines += "$($part.Value),REF**,$footprint,$($part.'LCSC Part #'),$($part.Manufacturer),$($part.'MFG Part #')" + } + + $bomContent = $bomHeader + "`n" + ($bomLines -join "`n") + $bomPath = Join-Path $OutputPath "docs/JLCPCB_BOM_Template.csv" + + if (-not $DryRun) { + New-Item -Path (Split-Path $bomPath) -ItemType Directory -Force | Out-Null + $bomContent | Out-File -FilePath $bomPath -Encoding UTF8 + Write-Host " Created: $bomPath" -ForegroundColor Green + } +} + +# Generate statistics report +Write-Host "`n" + "="*50 -ForegroundColor Green +Write-Host "GENERATION SUMMARY" -ForegroundColor Green +Write-Host "="*50 -ForegroundColor Green + +Write-Host "Components by package:" -ForegroundColor Cyan +$packageStats = $parts | Group-Object Package | Sort-Object Count -Descending +foreach ($stat in $packageStats) { + Write-Host " $($stat.Name): $($stat.Count) parts" -ForegroundColor White +} + +Write-Host "`nComponents by manufacturer:" -ForegroundColor Cyan +$mfgStats = $parts | Group-Object Manufacturer | Sort-Object Count -Descending +foreach ($stat in $mfgStats) { + Write-Host " $($stat.Name): $($stat.Count) parts" -ForegroundColor White +} + +# Calculate total cost for starter kit +$totalCost = ($parts | Where-Object { $_.'Price 1k' -match '^\d+\.?\d*$' } | Measure-Object { [double]$_.'Price 1k' } -Sum).Sum +Write-Host "`nCost analysis:" -ForegroundColor Cyan +Write-Host " Total cost for complete basic parts kit (1k each): `$$([math]::Round($totalCost, 2))" -ForegroundColor White + +if ($DryRun) { + Write-Host "`n[DRY RUN] No files were created" -ForegroundColor Yellow +} else { + Write-Host "`nGeneration completed successfully!" -ForegroundColor Green +} + +<# +.SYNOPSIS + Generates KiCad symbol libraries for JLCPCB Basic Parts with Fabrication Toolkit support + +.DESCRIPTION + This script reads a CSV database of JLCPCB Basic Parts and generates: + - KiCad symbol libraries (.kicad_sym) with proper Fabrication Toolkit properties + - BOM templates compatible with JLCPCB assembly service + - Cost analysis and component statistics + + The generated symbols include all necessary properties for the Fabrication Toolkit: + - LCSC Part # (for automatic part matching) + - Manufacturer and MFG Part # (for verification) + - FT Rotation Offset (for pick-and-place orientation) + - Standard KiCad footprint references + +.PARAMETER CsvPath + Path to the JLCPCB_Basic_Parts.csv database file + +.PARAMETER OutputPath + Output directory for generated files + +.PARAMETER CreateSymbols + Generate KiCad symbol libraries (default: true) + +.PARAMETER GenerateReport + Generate BOM templates and reports (default: true) + +.PARAMETER DryRun + Show what would be generated without creating files + +.EXAMPLE + .\Generate_JLCPCB_Symbols.ps1 -CsvPath ".\docs\JLCPCB_Basic_Parts.csv" -OutputPath "." + +.EXAMPLE + .\Generate_JLCPCB_Symbols.ps1 -CsvPath ".\docs\JLCPCB_Basic_Parts.csv" -OutputPath "." -DryRun + +.NOTES + Requires PowerShell 5.0+ and Write permissions to output directory + Generated symbols use standard KiCad footprints - no custom footprints needed +#> \ No newline at end of file diff --git a/scripts/generate_jlcpcb_symbols.sh b/scripts/generate_jlcpcb_symbols.sh new file mode 100644 index 0000000..3ce3f7f --- /dev/null +++ b/scripts/generate_jlcpcb_symbols.sh @@ -0,0 +1,554 @@ +#!/bin/bash + +# KiCad Symbol Generator for JLCPCB Basic Parts +# Generates KiCad symbol libraries with Fabrication Toolkit compatible properties +# Compatible with bennymeg/JLC-Plugin-for-KiCad + +set -euo pipefail + +# Default values +CSV_PATH="" +OUTPUT_PATH="" +CREATE_SYMBOLS=true +GENERATE_REPORT=true +DRY_RUN=false + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +CYAN='\033[0;36m' +WHITE='\033[1;37m' +NC='\033[0m' # No Color + +# Function to print colored output +print_color() { + local color=$1 + local message=$2 + echo -e "${color}${message}${NC}" +} + +# Function to show usage +usage() { + cat << EOF +Usage: $0 -c CSV_PATH -o OUTPUT_PATH [options] + +KiCad Symbol Generator for JLCPCB Basic Parts + +Required arguments: + -c, --csv-path PATH Path to JLCPCB_Basic_Parts.csv file + -o, --output-path PATH Output directory for generated files + +Optional arguments: + -s, --skip-symbols Skip symbol generation + -r, --skip-report Skip report generation + -d, --dry-run Show what would be generated without creating files + -h, --help Show this help message + +Examples: + $0 -c ./docs/JLCPCB_Basic_Parts.csv -o . + $0 -c ./docs/JLCPCB_Basic_Parts.csv -o . --dry-run +EOF +} + +# Parse command line arguments +while [[ $# -gt 0 ]]; do + case $1 in + -c|--csv-path) + CSV_PATH="$2" + shift 2 + ;; + -o|--output-path) + OUTPUT_PATH="$2" + shift 2 + ;; + -s|--skip-symbols) + CREATE_SYMBOLS=false + shift + ;; + -r|--skip-report) + GENERATE_REPORT=false + shift + ;; + -d|--dry-run) + DRY_RUN=true + shift + ;; + -h|--help) + usage + exit 0 + ;; + *) + echo "Unknown option $1" + usage + exit 1 + ;; + esac +done + +# Validate required arguments +if [[ -z "$CSV_PATH" || -z "$OUTPUT_PATH" ]]; then + echo "Error: Both CSV path and output path are required" + usage + exit 1 +fi + +# Validate input file +if [[ ! -f "$CSV_PATH" ]]; then + print_color $RED "Error: CSV file not found: $CSV_PATH" + exit 1 +fi + +print_color $GREEN "KiCad JLCPCB Basic Parts Symbol Generator" +print_color $GREEN "=========================================" + +print_color $YELLOW "Loading JLCPCB Basic Parts database: $CSV_PATH" + +# Check if we have required tools +if ! command -v awk &> /dev/null; then + print_color $RED "Error: awk is required but not installed" + exit 1 +fi + +# Read and parse CSV file +if [[ ! -r "$CSV_PATH" ]]; then + print_color $RED "Error: Cannot read CSV file: $CSV_PATH" + exit 1 +fi + +# Count components by type (skip comments and empty lines) +RESISTOR_COUNT=$(awk -F',' 'NR>1 && $1=="R" {count++} END {print count+0}' "$CSV_PATH") +CAPACITOR_COUNT=$(awk -F',' 'NR>1 && $1=="C" {count++} END {print count+0}' "$CSV_PATH") +INDUCTOR_COUNT=$(awk -F',' 'NR>1 && $1=="L" {count++} END {print count+0}' "$CSV_PATH") +IC_COUNT=$(awk -F',' 'NR>1 && $1=="IC" {count++} END {print count+0}' "$CSV_PATH") +LED_COUNT=$(awk -F',' 'NR>1 && $1=="LED" {count++} END {print count+0}' "$CSV_PATH") +DIODE_COUNT=$(awk -F',' 'NR>1 && $1=="D" {count++} END {print count+0}' "$CSV_PATH") +CRYSTAL_COUNT=$(awk -F',' 'NR>1 && $1=="XTAL" {count++} END {print count+0}' "$CSV_PATH") +TOTAL_COUNT=$(awk -F',' 'NR>1 && $1!~/^#/ && $1!="" {count++} END {print count+0}' "$CSV_PATH") + +print_color $GREEN "Successfully loaded $TOTAL_COUNT parts" + +print_color $CYAN "Component distribution:" +print_color $WHITE " Resistors: $RESISTOR_COUNT" +print_color $WHITE " Capacitors: $CAPACITOR_COUNT" +print_color $WHITE " Inductors: $INDUCTOR_COUNT" +print_color $WHITE " ICs: $IC_COUNT" +print_color $WHITE " LEDs: $LED_COUNT" +print_color $WHITE " Diodes: $DIODE_COUNT" +print_color $WHITE " Crystals: $CRYSTAL_COUNT" + +# Function to get KiCad footprint based on component type and package +get_kicad_footprint() { + local component=$1 + local package=$2 + + case $component in + "R") + case $package in + "0402") echo "Resistor_SMD:R_0402_1005Metric" ;; + "0603") echo "Resistor_SMD:R_0603_1608Metric" ;; + "0805") echo "Resistor_SMD:R_0805_2012Metric" ;; + "1206") echo "Resistor_SMD:R_1206_3216Metric" ;; + *) echo "Resistor_SMD:R_$package" ;; + esac + ;; + "C") + case $package in + "0402") echo "Capacitor_SMD:C_0402_1005Metric" ;; + "0603") echo "Capacitor_SMD:C_0603_1608Metric" ;; + "0805") echo "Capacitor_SMD:C_0805_2012Metric" ;; + "1206") echo "Capacitor_SMD:C_1206_3216Metric" ;; + *) echo "Capacitor_SMD:C_$package" ;; + esac + ;; + "L") + case $package in + "0603") echo "Inductor_SMD:L_0603_1608Metric" ;; + "0805") echo "Inductor_SMD:L_0805_2012Metric" ;; + "1206") echo "Inductor_SMD:L_1206_3216Metric" ;; + *) echo "Inductor_SMD:L_$package" ;; + esac + ;; + "IC") + case $package in + "SOIC-8") echo "Package_SO:SOIC-8_3.9x4.9mm_P1.27mm" ;; + "SOIC-14") echo "Package_SO:SOIC-14_3.9x8.7mm_P1.27mm" ;; + "SOIC-16") echo "Package_SO:SOIC-16_3.9x9.9mm_P1.27mm" ;; + "SOIC-18") echo "Package_SO:SOIC-18W_7.5x11.6mm_P1.27mm" ;; + "LQFP-48") echo "Package_QFP:LQFP-48_7x7mm_P0.5mm" ;; + "TSSOP-20") echo "Package_SO:TSSOP-20_4.4x6.5mm_P0.65mm" ;; + "SOT-223") echo "Package_TO_SOT_SMD:SOT-223-3_TabPin2" ;; + "SSOP-28") echo "Package_SO:SSOP-28_5.3x10.2mm_P0.65mm" ;; + "MODULE") echo "RF_Module:ESP32-WROOM-32" ;; + *) echo "Package_SO:$package" ;; + esac + ;; + "LED") + case $package in + "0603") echo "LED_SMD:LED_0603_1608Metric" ;; + "0805") echo "LED_SMD:LED_0805_2012Metric" ;; + *) echo "LED_SMD:LED_$package" ;; + esac + ;; + "D") + case $package in + "SOD-123") echo "Diode_SMD:D_SOD-123" ;; + "SOD-123FL") echo "Diode_SMD:D_SOD-123F" ;; + *) echo "Diode_SMD:D_$package" ;; + esac + ;; + "XTAL") + case $package in + "HC-49S") echo "Crystal:Crystal_HC49-SD_SMD" ;; + "3215") echo "Crystal:Crystal_SMD_3215-2Pin_3.2x1.5mm" ;; + *) echo "Crystal:Crystal_$package" ;; + esac + ;; + *) echo "Unknown:$package" ;; + esac +} + +# Function to generate symbol graphics based on component type +get_symbol_graphics() { + local component=$1 + local symbol_name=$2 + + case $component in + "R") + cat << EOF + (symbol "${symbol_name}_0_1" + (rectangle (start -1.016 -2.54) (end 1.016 2.54) + (stroke (width 0.254) (type default)) + (fill (type none)))) + (symbol "${symbol_name}_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +EOF + ;; + "C") + cat << EOF + (symbol "${symbol_name}_0_1" + (polyline + (pts (xy -2.032 -0.762) (xy 2.032 -0.762)) + (stroke (width 0.508) (type default)) + (fill (type none))) + (polyline + (pts (xy -2.032 0.762) (xy 2.032 0.762)) + (stroke (width 0.508) (type default)) + (fill (type none)))) + (symbol "${symbol_name}_1_1" + (pin passive line (at 0 2.54 270) (length 1.778) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 0 -2.54 90) (length 1.778) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +EOF + ;; + "L") + cat << EOF + (symbol "${symbol_name}_0_1" + (arc (start 0 -2.54) (mid 0.635 -1.905) (end 0 -1.27) + (stroke (width 0) (type default)) + (fill (type none))) + (arc (start 0 -1.27) (mid 0.635 -0.635) (end 0 0) + (stroke (width 0) (type default)) + (fill (type none))) + (arc (start 0 0) (mid 0.635 0.635) (end 0 1.27) + (stroke (width 0) (type default)) + (fill (type none))) + (arc (start 0 1.27) (mid 0.635 1.905) (end 0 2.54) + (stroke (width 0) (type default)) + (fill (type none)))) + (symbol "${symbol_name}_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "1" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "2" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +EOF + ;; + "LED") + cat << EOF + (symbol "${symbol_name}_0_1" + (polyline + (pts (xy -1.27 -1.27) (xy -1.27 1.27)) + (stroke (width 0.254) (type default)) + (fill (type none))) + (polyline + (pts (xy -1.27 0) (xy 1.27 0)) + (stroke (width 0) (type default)) + (fill (type none))) + (polyline + (pts (xy 1.27 -1.27) (xy 1.27 1.27) (xy -1.27 0) (xy 1.27 -1.27)) + (stroke (width 0.254) (type default)) + (fill (type none)))) + (symbol "${symbol_name}_1_1" + (pin passive line (at -3.81 0 0) (length 2.54) + (name "K" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin passive line (at 3.81 0 180) (length 2.54) + (name "A" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +EOF + ;; + *) + # Generic two-pin component for ICs, diodes, crystals + cat << EOF + (symbol "${symbol_name}_0_1" + (rectangle (start -7.62 5.08) (end 7.62 -5.08) + (stroke (width 0.254) (type default)) + (fill (type background)))) + (symbol "${symbol_name}_1_1" + (pin input line (at -10.16 0 0) (length 2.54) + (name "VCC" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27))))) + (pin input line (at 10.16 0 180) (length 2.54) + (name "GND" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))))) +EOF + ;; + esac +} + +# Function to generate a symbol template +generate_symbol() { + local component=$1 + local value=$2 + local package=$3 + local lcsc=$4 + local manufacturer=$5 + local mfg_part=$6 + local description=$7 + local rotation=$8 + local ref_prefix=$9 + + # Clean up special characters for KiCad compatibility + local symbol_name=$(echo "${value}_${package}_${lcsc}" | sed 's/µ/u/g') + local footprint=$(get_kicad_footprint "$component" "$package") + local datasheet="https://lcsc.com/product-detail/${lcsc}.html" + + cat << EOF + (symbol "$symbol_name" (in_bom yes) (on_board yes) + (property "Reference" "$ref_prefix" (at 0 2.54 0) + (effects (font (size 1.27 1.27)))) + (property "Value" "$value" (at 0 -2.54 0) + (effects (font (size 1.27 1.27)))) + (property "Footprint" "$footprint" (at 0 -5.08 0) + (effects (font (size 1.27 1.27)) hide)) + (property "Datasheet" "$datasheet" (at 0 -7.62 0) + (effects (font (size 1.27 1.27)) hide)) + (property "Description" "$description" (at 0 -10.16 0) + (effects (font (size 1.27 1.27)) hide)) + (property "LCSC Part #" "$lcsc" (at 0 -12.70 0) + (effects (font (size 1.27 1.27)) hide)) + (property "Manufacturer" "$manufacturer" (at 0 -15.24 0) + (effects (font (size 1.27 1.27)) hide)) + (property "MFG Part #" "$mfg_part" (at 0 -17.78 0) + (effects (font (size 1.27 1.27)) hide)) + (property "Package" "$package" (at 0 -20.32 0) + (effects (font (size 1.27 1.27)) hide)) + (property "FT Rotation Offset" "$rotation" (at 0 -22.86 0) + (effects (font (size 1.27 1.27)) hide)) +$(get_symbol_graphics "$component" "$symbol_name") + ) +EOF +} + +# Generate symbol libraries +if [[ "$CREATE_SYMBOLS" == true ]]; then + print_color $YELLOW "Generating KiCad symbol libraries..." + + if [[ "$DRY_RUN" == false ]]; then + # Create output directory + mkdir -p "$OUTPUT_PATH/symbols" + fi + + # Generate Standard Passives library + if [[ $((RESISTOR_COUNT + CAPACITOR_COUNT + INDUCTOR_COUNT)) -gt 0 ]]; then + print_color $CYAN " Creating Standard_Passives.kicad_sym..." + + local passives_file="$OUTPUT_PATH/symbols/Standard_Passives.kicad_sym" + + if [[ "$DRY_RUN" == false ]]; then + # Write header + cat > "$passives_file" << EOF +(kicad_symbol_lib (version 20211014) (generator "JLCPCB-Generator") + (symbol_lib_info (name "Standard_Passives") (description "JLCPCB Basic Parts - Passives with Fabrication Toolkit properties")) +EOF + + # Process resistors, capacitors, and inductors + awk -F',' ' + NR>1 && ($1=="R" || $1=="C" || $1=="L") && $1!~/^#/ { + # Escape quotes in description + gsub(/"/, "\\\"", $7) + ref = ($1=="R") ? "R" : ($1=="C") ? "C" : "L" + print $1 "," $2 "," $3 "," $4 "," $5 "," $6 "," $7 "," $8 "," ref + }' "$CSV_PATH" | while IFS=',' read -r component value package lcsc manufacturer mfg_part description rotation ref_prefix; do + generate_symbol "$component" "$value" "$package" "$lcsc" "$manufacturer" "$mfg_part" "$description" "$rotation" "$ref_prefix" >> "$passives_file" + done + + # Write footer + echo ")" >> "$passives_file" + print_color $GREEN " Created: $passives_file" + else + print_color $BLUE " Would create: $passives_file" + fi + fi + + # Generate Standard ICs library + if [[ $IC_COUNT -gt 0 ]]; then + print_color $CYAN " Creating Standard_ICs.kicad_sym..." + + local ics_file="$OUTPUT_PATH/symbols/Standard_ICs.kicad_sym" + + if [[ "$DRY_RUN" == false ]]; then + # Write header + cat > "$ics_file" << EOF +(kicad_symbol_lib (version 20211014) (generator "JLCPCB-Generator") + (symbol_lib_info (name "Standard_ICs") (description "JLCPCB Basic Parts - ICs with Fabrication Toolkit properties")) +EOF + + # Process ICs + awk -F',' ' + NR>1 && $1=="IC" && $1!~/^#/ { + # Escape quotes in description + gsub(/"/, "\\\"", $7) + print $1 "," $2 "," $3 "," $4 "," $5 "," $6 "," $7 "," $8 ",U" + }' "$CSV_PATH" | while IFS=',' read -r component value package lcsc manufacturer mfg_part description rotation ref_prefix; do + generate_symbol "$component" "$value" "$package" "$lcsc" "$manufacturer" "$mfg_part" "$description" "$rotation" "$ref_prefix" >> "$ics_file" + done + + # Write footer + echo ")" >> "$ics_file" + print_color $GREEN " Created: $ics_file" + else + print_color $BLUE " Would create: $ics_file" + fi + fi + + # Generate Standard Components library (LEDs, Diodes, Crystals) + if [[ $((LED_COUNT + DIODE_COUNT + CRYSTAL_COUNT)) -gt 0 ]]; then + print_color $CYAN " Creating Standard_Components.kicad_sym..." + + local components_file="$OUTPUT_PATH/symbols/Standard_Components.kicad_sym" + + if [[ "$DRY_RUN" == false ]]; then + # Write header + cat > "$components_file" << EOF +(kicad_symbol_lib (version 20211014) (generator "JLCPCB-Generator") + (symbol_lib_info (name "Standard_Components") (description "JLCPCB Basic Parts - LEDs, Diodes, Crystals with Fabrication Toolkit properties")) +EOF + + # Process LEDs, Diodes, Crystals + awk -F',' ' + NR>1 && ($1=="LED" || $1=="D" || $1=="XTAL") && $1!~/^#/ { + # Escape quotes in description + gsub(/"/, "\\\"", $7) + ref = ($1=="LED" || $1=="D") ? "D" : "Y" + print $1 "," $2 "," $3 "," $4 "," $5 "," $6 "," $7 "," $8 "," ref + }' "$CSV_PATH" | while IFS=',' read -r component value package lcsc manufacturer mfg_part description rotation ref_prefix; do + generate_symbol "$component" "$value" "$package" "$lcsc" "$manufacturer" "$mfg_part" "$description" "$rotation" "$ref_prefix" >> "$components_file" + done + + # Write footer + echo ")" >> "$components_file" + print_color $GREEN " Created: $components_file" + else + print_color $BLUE " Would create: $components_file" + fi + fi +fi + +# Generate BOM template +if [[ "$GENERATE_REPORT" == true ]]; then + print_color $YELLOW "Generating JLCPCB BOM template..." + + local bom_file="$OUTPUT_PATH/docs/JLCPCB_BOM_Template.csv" + + if [[ "$DRY_RUN" == false ]]; then + mkdir -p "$OUTPUT_PATH/docs" + + # Write BOM header + cat > "$bom_file" << EOF +# JLCPCB Assembly BOM Template +# Generated from JLCPCB Basic Parts Database +# Compatible with JLC Plugin for KiCad (bennymeg) + +Comment,Designator,Footprint,LCSC Part #,Manufacturer,MFG Part # +EOF + + # Process all parts for BOM + awk -F',' ' + NR>1 && $1!~/^#/ && $1!="" { + footprint_full = "" + component = $1 + package = $3 + + # Get footprint name (remove library prefix) + if (component == "R") { + if (package == "0603") footprint_full = "R_0603_1608Metric" + else if (package == "0805") footprint_full = "R_0805_2012Metric" + else footprint_full = "R_" package + } + else if (component == "C") { + if (package == "0603") footprint_full = "C_0603_1608Metric" + else if (package == "0805") footprint_full = "C_0805_2012Metric" + else footprint_full = "C_" package + } + else if (component == "L") { + if (package == "0603") footprint_full = "L_0603_1608Metric" + else if (package == "0805") footprint_full = "L_0805_2012Metric" + else footprint_full = "L_" package + } + else if (component == "LED") { + if (package == "0603") footprint_full = "LED_0603_1608Metric" + else footprint_full = "LED_" package + } + else { + footprint_full = package + } + + print $2 ",REF**," footprint_full "," $4 "," $5 "," $6 + }' "$CSV_PATH" >> "$bom_file" + + print_color $GREEN " Created: $bom_file" + else + print_color $BLUE " Would create: $bom_file" + fi +fi + +# Generate statistics +print_color $GREEN "\n$(printf '=%.0s' {1..50})" +print_color $GREEN "GENERATION SUMMARY" +print_color $GREEN "$(printf '=%.0s' {1..50})" + +print_color $CYAN "Components by package:" +awk -F',' 'NR>1 && $1!~/^#/ && $1!="" {packages[$3]++} END {for (p in packages) printf " %-10s: %d parts\n", p, packages[p]}' "$CSV_PATH" | sort -k3 -nr + +print_color $CYAN "\nComponents by manufacturer:" +awk -F',' 'NR>1 && $1!~/^#/ && $1!="" {mfgs[$5]++} END {for (m in mfgs) printf " %-20s: %d parts\n", m, mfgs[m]}' "$CSV_PATH" | sort -k3 -nr + +# Calculate total cost +TOTAL_COST=$(awk -F',' ' +NR>1 && $1!~/^#/ && $1!="" && $10 ~ /^[0-9]+\.?[0-9]*$/ { + total += $10 +} +END { + printf "%.2f", total +}' "$CSV_PATH") + +print_color $CYAN "\nCost analysis:" +print_color $WHITE " Total cost for complete basic parts kit (1k each): \$$TOTAL_COST" + +if [[ "$DRY_RUN" == true ]]; then + print_color $YELLOW "\n[DRY RUN] No files were created" +else + print_color $GREEN "\nGeneration completed successfully!" +fi \ No newline at end of file