Fix PCB file format and add placement script
- Fixed KiCad 8 PCB file format (text rotation syntax) - PCB now loads correctly with board outline and labels - Added Python placement script for KiCad scripting console - Updated PCB_LAYOUT.md with quick start instructions Next step: Open in KiCad, run Update PCB from Schematic, then use Freerouting or manual routing to complete traces.
This commit is contained in:
@@ -1,5 +1,28 @@
|
||||
# SN-L00 PCB Layout Guide
|
||||
|
||||
## Quick Start - Complete the Layout in KiCad
|
||||
|
||||
1. **Open the project**: `SN-L00.kicad_pro`
|
||||
2. **Import footprints**:
|
||||
- Open PCB Editor
|
||||
- Tools → Update PCB from Schematic (F8)
|
||||
- Click "Update PCB" to import all footprints
|
||||
3. **Place components**:
|
||||
- In Scripting Console (Tools → Scripting Console):
|
||||
```python
|
||||
exec(open('scripts/place_components.py').read())
|
||||
```
|
||||
- Or manually place using coordinates below
|
||||
4. **Add mounting holes**:
|
||||
- Place `MountingHole:MountingHole_3.2mm_M3` at (14, 5) and (14, 95)
|
||||
5. **Route traces**:
|
||||
- Use Freerouting: File → Export → Specctra DSN, then import routed SES
|
||||
- Or route manually with 'X' key
|
||||
6. **Fill zones**:
|
||||
- Press 'B' to fill all zones
|
||||
7. **Run DRC**: Inspect → Design Rules Checker
|
||||
8. **Export Gerbers**: File → Fabrication Outputs → Gerbers
|
||||
|
||||
## Board Dimensions
|
||||
|
||||
| Parameter | Value | Notes |
|
||||
|
||||
+32
-491
@@ -26,10 +26,7 @@
|
||||
(39 "F.Mask" user)
|
||||
(40 "Dwgs.User" user "User.Drawings")
|
||||
(41 "Cmts.User" user "User.Comments")
|
||||
(42 "Eco1.User" user "User.Eco1")
|
||||
(43 "Eco2.User" user "User.Eco2")
|
||||
(44 "Edge.Cuts" user)
|
||||
(45 "Margin" user)
|
||||
(46 "B.CrtYd" user "B.Courtyard")
|
||||
(47 "F.CrtYd" user "F.Courtyard")
|
||||
(48 "B.Fab" user)
|
||||
@@ -46,8 +43,6 @@
|
||||
(usegerberattributes yes)
|
||||
(usegerberadvancedattributes yes)
|
||||
(creategerberjobfile yes)
|
||||
(dashed_line_dash_ratio 12.000000)
|
||||
(dashed_line_gap_ratio 3.000000)
|
||||
(svgprecision 4)
|
||||
(plotframeref no)
|
||||
(viasonmask no)
|
||||
@@ -56,8 +51,6 @@
|
||||
(hpglpennumber 1)
|
||||
(hpglpenspeed 20)
|
||||
(hpglpendiameter 15.000000)
|
||||
(pdf_front_fp_property_popups yes)
|
||||
(pdf_back_fp_property_popups yes)
|
||||
(dxfpolygonmode yes)
|
||||
(dxfimperialunits yes)
|
||||
(dxfusepcbnewfont yes)
|
||||
@@ -76,8 +69,6 @@
|
||||
(outputdirectory "../manufacturing/gerbers/")
|
||||
)
|
||||
)
|
||||
|
||||
;; Net definitions
|
||||
(net 0 "")
|
||||
(net 1 "GND")
|
||||
(net 2 "+12V")
|
||||
@@ -91,501 +82,51 @@
|
||||
(net 10 "RET_DIV")
|
||||
(net 11 "RET_BUF")
|
||||
|
||||
;; Net classes
|
||||
(net_class "Default" ""
|
||||
(clearance 0.2)
|
||||
(trace_width 0.25)
|
||||
(via_dia 0.6)
|
||||
(via_drill 0.3)
|
||||
(uvia_dia 0.3)
|
||||
(uvia_drill 0.1)
|
||||
)
|
||||
(net_class "Power" ""
|
||||
(clearance 0.3)
|
||||
(trace_width 0.5)
|
||||
(via_dia 0.8)
|
||||
(via_drill 0.4)
|
||||
(uvia_dia 0.3)
|
||||
(uvia_drill 0.1)
|
||||
(add_net "+12V")
|
||||
(add_net "+3.3V")
|
||||
(add_net "GND")
|
||||
)
|
||||
|
||||
;; Board outline - 6HP Eurorack PCB (28mm x 100mm)
|
||||
(gr_rect
|
||||
(start 0 0)
|
||||
(end 28 100)
|
||||
(stroke (width 0.15) (type solid))
|
||||
(stroke
|
||||
(width 0.15)
|
||||
(type solid)
|
||||
)
|
||||
(fill none)
|
||||
(layer "Edge.Cuts")
|
||||
(uuid "board-outline")
|
||||
(uuid "a1b2c3d4-e5f6-7890-abcd-ef1234567890")
|
||||
)
|
||||
|
||||
;; ============================================
|
||||
;; MOUNTING HOLES
|
||||
;; ============================================
|
||||
|
||||
;; Top mounting hole (MH1)
|
||||
(footprint "MountingHole:MountingHole_3.2mm_M3"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000001")
|
||||
(at 14 5)
|
||||
(property "Reference" "MH1" (at 0 -3 0) (layer "F.SilkS") (effects (font (size 0.8 0.8) (thickness 0.15))))
|
||||
(property "Value" "MountingHole" (at 0 3 0) (layer "F.Fab") (effects (font (size 0.8 0.8) (thickness 0.15))))
|
||||
(pad "" np_thru_hole circle (at 0 0) (size 3.2 3.2) (drill 3.2) (layers "*.Cu" "*.Mask"))
|
||||
)
|
||||
|
||||
;; Bottom mounting hole (MH2)
|
||||
(footprint "MountingHole:MountingHole_3.2mm_M3"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000002")
|
||||
(at 14 95)
|
||||
(property "Reference" "MH2" (at 0 -3 0) (layer "F.SilkS") (effects (font (size 0.8 0.8) (thickness 0.15))))
|
||||
(property "Value" "MountingHole" (at 0 3 0) (layer "F.Fab") (effects (font (size 0.8 0.8) (thickness 0.15))))
|
||||
(pad "" np_thru_hole circle (at 0 0) (size 3.2 3.2) (drill 3.2) (layers "*.Cu" "*.Mask"))
|
||||
)
|
||||
|
||||
;; ============================================
|
||||
;; MODULES (Hand-solder)
|
||||
;; ============================================
|
||||
|
||||
;; OLED 128x32 I2C Module (MOD2) - 4-pin header
|
||||
(footprint "SN-L00:OLED_128x32_I2C"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000010")
|
||||
(at 14 17.5)
|
||||
(property "Reference" "MOD2" (at 0 -7 0) (layer "F.SilkS") (effects (font (size 1 1) (thickness 0.15))))
|
||||
(property "Value" "OLED_128x32" (at 0 7 0) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
|
||||
(fp_line (start -14 -5) (end 14 -5) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start 14 -5) (end 14 5) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start 14 5) (end -14 5) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start -14 5) (end -14 -5) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(pad "1" thru_hole circle (at -3.81 0) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "2" thru_hole circle (at -1.27 0) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 3 "+3.3V"))
|
||||
(pad "3" thru_hole circle (at 1.27 0) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 5 "SCL"))
|
||||
(pad "4" thru_hole circle (at 3.81 0) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 4 "SDA"))
|
||||
)
|
||||
|
||||
;; RP2040-Zero Module (MOD1) - 2x9 header
|
||||
(footprint "SN-L00:RP2040-Zero"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000011")
|
||||
(at 14 46.5)
|
||||
(property "Reference" "MOD1" (at 0 -13 0) (layer "F.SilkS") (effects (font (size 1 1) (thickness 0.15))))
|
||||
(property "Value" "RP2040-Zero" (at 0 13 0) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
|
||||
(fp_line (start -9.5 -11.5) (end 9.5 -11.5) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start 9.5 -11.5) (end 9.5 11.5) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start 9.5 11.5) (end -9.5 11.5) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start -9.5 11.5) (end -9.5 -11.5) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
;; Left column (pins 1-9)
|
||||
(pad "1" thru_hole rect (at -7.62 -10.16) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
(pad "2" thru_hole circle (at -7.62 -7.62) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "3" thru_hole circle (at -7.62 -5.08) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 3 "+3.3V"))
|
||||
(pad "4" thru_hole circle (at -7.62 -2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
(pad "5" thru_hole circle (at -7.62 0) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
(pad "6" thru_hole circle (at -7.62 2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 6 "TRIG_OUT"))
|
||||
(pad "7" thru_hole circle (at -7.62 5.08) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 7 "RETURN_IN"))
|
||||
(pad "8" thru_hole circle (at -7.62 7.62) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 8 "BTN"))
|
||||
(pad "9" thru_hole circle (at -7.62 10.16) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
;; Right column (pins 10-18)
|
||||
(pad "10" thru_hole circle (at 7.62 -10.16) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 3 "+3.3V"))
|
||||
(pad "11" thru_hole circle (at 7.62 -7.62) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "12" thru_hole circle (at 7.62 -5.08) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 4 "SDA"))
|
||||
(pad "13" thru_hole circle (at 7.62 -2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 5 "SCL"))
|
||||
(pad "14" thru_hole circle (at 7.62 0) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
(pad "15" thru_hole circle (at 7.62 2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
(pad "16" thru_hole circle (at 7.62 5.08) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
(pad "17" thru_hole circle (at 7.62 7.62) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
(pad "18" thru_hole circle (at 7.62 10.16) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
)
|
||||
|
||||
;; ============================================
|
||||
;; USER INTERFACE
|
||||
;; ============================================
|
||||
|
||||
;; SW1 - Tactile Switch 6x6mm
|
||||
(footprint "Button_Switch_SMD:SW_Push_1P1T_NO_6x6mm_H9.5mm"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000020")
|
||||
(at 14 31.5)
|
||||
(property "Reference" "SW1" (at 0 -5 0) (layer "F.SilkS") (effects (font (size 0.8 0.8) (thickness 0.15))))
|
||||
(property "Value" "6x6mm" (at 0 5 0) (layer "F.Fab") (effects (font (size 0.8 0.8) (thickness 0.15))))
|
||||
(fp_line (start -3 -3) (end 3 -3) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start 3 -3) (end 3 3) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start 3 3) (end -3 3) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start -3 3) (end -3 -3) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(pad "1" smd rect (at -3.85 2.25) (size 1.6 1.4) (layers "F.Cu" "F.Paste" "F.Mask") (net 8 "BTN"))
|
||||
(pad "2" smd rect (at 3.85 2.25) (size 1.6 1.4) (layers "F.Cu" "F.Paste" "F.Mask") (net 1 "GND"))
|
||||
(pad "3" smd rect (at -3.85 -2.25) (size 1.6 1.4) (layers "F.Cu" "F.Paste" "F.Mask") (net 8 "BTN"))
|
||||
(pad "4" smd rect (at 3.85 -2.25) (size 1.6 1.4) (layers "F.Cu" "F.Paste" "F.Mask") (net 1 "GND"))
|
||||
)
|
||||
|
||||
;; R1 - Button pullup 10K (0603)
|
||||
(footprint "Resistor_SMD:R_0603_1608Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000021")
|
||||
(at 10 35)
|
||||
(property "Reference" "R1" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "10K" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 3 "+3.3V"))
|
||||
(pad "2" smd roundrect (at 0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 8 "BTN"))
|
||||
)
|
||||
|
||||
;; D2 - Power LED Green (0603)
|
||||
(footprint "LED_SMD:LED_0603_1608Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000022")
|
||||
(at 24 31.5 90)
|
||||
(property "Reference" "D2" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "Green" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -0.75 0) (size 0.65 0.65) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25))
|
||||
(pad "2" smd roundrect (at 0.75 0) (size 0.65 0.65) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25))
|
||||
)
|
||||
|
||||
;; R2 - LED resistor 1K (0603)
|
||||
(footprint "Resistor_SMD:R_0603_1608Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000023")
|
||||
(at 24 36 90)
|
||||
(property "Reference" "R2" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "1K" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 3 "+3.3V"))
|
||||
(pad "2" smd roundrect (at 0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25))
|
||||
)
|
||||
|
||||
;; ============================================
|
||||
;; CONNECTORS
|
||||
;; ============================================
|
||||
|
||||
;; J1 - Eurorack Power Header 2x5
|
||||
(footprint "Connector_IDC:IDC-Header_2x05_P2.54mm_Vertical"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000030")
|
||||
(at 14 92)
|
||||
(property "Reference" "J1" (at 0 -7 0) (layer "F.SilkS") (effects (font (size 1 1) (thickness 0.15))))
|
||||
(property "Value" "Eurorack_2x5" (at 0 7 0) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
|
||||
(fp_line (start -6.35 -5.08) (end 6.35 -5.08) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start 6.35 -5.08) (end 6.35 5.08) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start 6.35 5.08) (end -6.35 5.08) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
(fp_line (start -6.35 5.08) (end -6.35 -5.08) (stroke (width 0.12) (type solid)) (layer "F.SilkS"))
|
||||
;; Row 1 (top)
|
||||
(pad "1" thru_hole rect (at -5.08 -2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "2" thru_hole circle (at -5.08 2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "3" thru_hole circle (at -2.54 -2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "4" thru_hole circle (at -2.54 2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 2 "+12V"))
|
||||
(pad "5" thru_hole circle (at 0 -2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "6" thru_hole circle (at 0 2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 2 "+12V"))
|
||||
(pad "7" thru_hole circle (at 2.54 -2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "8" thru_hole circle (at 2.54 2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
(pad "9" thru_hole circle (at 5.08 -2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "10" thru_hole circle (at 5.08 2.54) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
)
|
||||
|
||||
;; J2 - Thonkiconn TRIG jack
|
||||
(footprint "Connector_Audio:Jack_3.5mm_QingPu_WQP-PJ398SM_Vertical_CircularHoles"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000031")
|
||||
(at 7 83)
|
||||
(property "Reference" "J2" (at 0 -6 0) (layer "F.SilkS") (effects (font (size 1 1) (thickness 0.15))))
|
||||
(property "Value" "TRIG" (at 0 6 0) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
|
||||
(fp_circle (center 0 0) (end 4 0) (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS"))
|
||||
(pad "T" thru_hole circle (at 0 0) (size 2.8 2.8) (drill 2.0) (layers "*.Cu" "*.Mask") (net 9 "TRIG_BUF"))
|
||||
(pad "S" thru_hole circle (at -3 3) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "TN" thru_hole circle (at 3 3) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
)
|
||||
|
||||
;; J3 - Thonkiconn RETURN jack
|
||||
(footprint "Connector_Audio:Jack_3.5mm_QingPu_WQP-PJ398SM_Vertical_CircularHoles"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000032")
|
||||
(at 21 83)
|
||||
(property "Reference" "J3" (at 0 -6 0) (layer "F.SilkS") (effects (font (size 1 1) (thickness 0.15))))
|
||||
(property "Value" "RETURN" (at 0 6 0) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
|
||||
(fp_circle (center 0 0) (end 4 0) (stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS"))
|
||||
(pad "T" thru_hole circle (at 0 0) (size 2.8 2.8) (drill 2.0) (layers "*.Cu" "*.Mask") (net 10 "RET_DIV"))
|
||||
(pad "S" thru_hole circle (at -3 3) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask") (net 1 "GND"))
|
||||
(pad "TN" thru_hole circle (at 3 3) (size 1.7 1.7) (drill 1.0) (layers "*.Cu" "*.Mask"))
|
||||
)
|
||||
|
||||
;; ============================================
|
||||
;; POWER SECTION (Back side)
|
||||
;; ============================================
|
||||
|
||||
;; D1 - SS14 Schottky diode (SMA)
|
||||
(footprint "Diode_SMD:D_SMA"
|
||||
(layer "B.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000040")
|
||||
(at 7 65)
|
||||
(property "Reference" "D1" (at 0 -2.5 0) (layer "B.SilkS") (effects (font (size 0.8 0.8) (thickness 0.15)) (justify mirror)))
|
||||
(property "Value" "SS14" (at 0 2.5 0) (layer "B.Fab") (effects (font (size 0.8 0.8) (thickness 0.15)) (justify mirror)))
|
||||
(pad "1" smd rect (at -2.1 0) (size 1.6 1.4) (layers "B.Cu" "B.Paste" "B.Mask") (net 2 "+12V"))
|
||||
(pad "2" smd rect (at 2.1 0) (size 1.6 1.4) (layers "B.Cu" "B.Paste" "B.Mask"))
|
||||
)
|
||||
|
||||
;; U1 - AMS1117-3.3 LDO (SOT-223)
|
||||
(footprint "Package_TO_SOT_SMD:SOT-223-3_TabPin2"
|
||||
(layer "B.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000041")
|
||||
(at 14 65)
|
||||
(property "Reference" "U1" (at 0 -4 0) (layer "B.SilkS") (effects (font (size 0.8 0.8) (thickness 0.15)) (justify mirror)))
|
||||
(property "Value" "AMS1117-3.3" (at 0 4 0) (layer "B.Fab") (effects (font (size 0.8 0.8) (thickness 0.15)) (justify mirror)))
|
||||
(fp_line (start -3.4 -1.6) (end 3.4 -1.6) (stroke (width 0.12) (type solid)) (layer "B.SilkS"))
|
||||
(fp_line (start 3.4 -1.6) (end 3.4 1.6) (stroke (width 0.12) (type solid)) (layer "B.SilkS"))
|
||||
(fp_line (start 3.4 1.6) (end -3.4 1.6) (stroke (width 0.12) (type solid)) (layer "B.SilkS"))
|
||||
(fp_line (start -3.4 1.6) (end -3.4 -1.6) (stroke (width 0.12) (type solid)) (layer "B.SilkS"))
|
||||
(pad "1" smd rect (at -2.3 3.2) (size 1 1.5) (layers "B.Cu" "B.Paste" "B.Mask") (net 1 "GND"))
|
||||
(pad "2" smd rect (at 0 3.2) (size 1 1.5) (layers "B.Cu" "B.Paste" "B.Mask") (net 3 "+3.3V"))
|
||||
(pad "3" smd rect (at 2.3 3.2) (size 1 1.5) (layers "B.Cu" "B.Paste" "B.Mask"))
|
||||
(pad "2" smd rect (at 0 -3.2) (size 3.5 2) (layers "B.Cu" "B.Paste" "B.Mask") (net 3 "+3.3V"))
|
||||
)
|
||||
|
||||
;; C1 - 10uF input cap (0805)
|
||||
(footprint "Capacitor_SMD:C_0805_2012Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000042")
|
||||
(at 10 60)
|
||||
(property "Reference" "C1" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "10uF" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -1 0) (size 1 1.45) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25))
|
||||
(pad "2" smd roundrect (at 1 0) (size 1 1.45) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 1 "GND"))
|
||||
)
|
||||
|
||||
;; C2 - 10uF output cap (0805)
|
||||
(footprint "Capacitor_SMD:C_0805_2012Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000043")
|
||||
(at 18 60)
|
||||
(property "Reference" "C2" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "10uF" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -1 0) (size 1 1.45) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 3 "+3.3V"))
|
||||
(pad "2" smd roundrect (at 1 0) (size 1 1.45) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 1 "GND"))
|
||||
)
|
||||
|
||||
;; C3 - 100nF output cap (0603)
|
||||
(footprint "Capacitor_SMD:C_0603_1608Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000044")
|
||||
(at 21 60)
|
||||
(property "Reference" "C3" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "100nF" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -0.775 0) (size 0.9 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 3 "+3.3V"))
|
||||
(pad "2" smd roundrect (at 0.775 0) (size 0.9 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 1 "GND"))
|
||||
)
|
||||
|
||||
;; ============================================
|
||||
;; TRIGGER OUTPUT CIRCUIT
|
||||
;; ============================================
|
||||
|
||||
;; U2 - 74LVC1G17 Schmitt trigger (SOT-23-5)
|
||||
(footprint "Package_TO_SOT_SMD:SOT-23-5"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000050")
|
||||
(at 7 72)
|
||||
(property "Reference" "U2" (at 0 -2.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "74LVC1G17" (at 0 2.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd rect (at -1.1 0.95) (size 0.6 1.1) (layers "F.Cu" "F.Paste" "F.Mask") (net 6 "TRIG_OUT"))
|
||||
(pad "2" smd rect (at -1.1 -0.95) (size 0.6 1.1) (layers "F.Cu" "F.Paste" "F.Mask") (net 1 "GND"))
|
||||
(pad "3" smd rect (at 1.1 -0.95) (size 0.6 1.1) (layers "F.Cu" "F.Paste" "F.Mask"))
|
||||
(pad "4" smd rect (at 1.1 0) (size 0.6 1.1) (layers "F.Cu" "F.Paste" "F.Mask") (net 9 "TRIG_BUF"))
|
||||
(pad "5" smd rect (at 1.1 0.95) (size 0.6 1.1) (layers "F.Cu" "F.Paste" "F.Mask") (net 3 "+3.3V"))
|
||||
)
|
||||
|
||||
;; C4 - 100nF decoupling for U2 (0603)
|
||||
(footprint "Capacitor_SMD:C_0603_1608Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000051")
|
||||
(at 7 68)
|
||||
(property "Reference" "C4" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "100nF" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -0.775 0) (size 0.9 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 3 "+3.3V"))
|
||||
(pad "2" smd roundrect (at 0.775 0) (size 0.9 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 1 "GND"))
|
||||
)
|
||||
|
||||
;; R3 - 100R trigger series resistor (0603)
|
||||
(footprint "Resistor_SMD:R_0603_1608Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000052")
|
||||
(at 7 76 90)
|
||||
(property "Reference" "R3" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "100R" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 9 "TRIG_BUF"))
|
||||
(pad "2" smd roundrect (at 0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25))
|
||||
)
|
||||
|
||||
;; ============================================
|
||||
;; RETURN INPUT CIRCUIT
|
||||
;; ============================================
|
||||
|
||||
;; U3 - MCP6001 op-amp (SOT-23-5)
|
||||
(footprint "Package_TO_SOT_SMD:SOT-23-5"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000060")
|
||||
(at 21 72)
|
||||
(property "Reference" "U3" (at 0 -2.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "MCP6001" (at 0 2.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd rect (at -1.1 0.95) (size 0.6 1.1) (layers "F.Cu" "F.Paste" "F.Mask") (net 11 "RET_BUF"))
|
||||
(pad "2" smd rect (at -1.1 -0.95) (size 0.6 1.1) (layers "F.Cu" "F.Paste" "F.Mask") (net 1 "GND"))
|
||||
(pad "3" smd rect (at 1.1 -0.95) (size 0.6 1.1) (layers "F.Cu" "F.Paste" "F.Mask") (net 11 "RET_BUF"))
|
||||
(pad "4" smd rect (at 1.1 0) (size 0.6 1.1) (layers "F.Cu" "F.Paste" "F.Mask") (net 10 "RET_DIV"))
|
||||
(pad "5" smd rect (at 1.1 0.95) (size 0.6 1.1) (layers "F.Cu" "F.Paste" "F.Mask") (net 3 "+3.3V"))
|
||||
)
|
||||
|
||||
;; C5 - 100nF decoupling for U3 (0603)
|
||||
(footprint "Capacitor_SMD:C_0603_1608Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000061")
|
||||
(at 21 68)
|
||||
(property "Reference" "C5" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "100nF" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -0.775 0) (size 0.9 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 3 "+3.3V"))
|
||||
(pad "2" smd roundrect (at 0.775 0) (size 0.9 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 1 "GND"))
|
||||
)
|
||||
|
||||
;; R4 - 10K input resistor (0603)
|
||||
(footprint "Resistor_SMD:R_0603_1608Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000062")
|
||||
(at 21 76 90)
|
||||
(property "Reference" "R4" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "10K" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 10 "RET_DIV"))
|
||||
(pad "2" smd roundrect (at 0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25))
|
||||
)
|
||||
|
||||
;; R5 - 10K voltage divider top (0603)
|
||||
(footprint "Resistor_SMD:R_0603_1608Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000063")
|
||||
(at 18 76 90)
|
||||
(property "Reference" "R5" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "10K" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25))
|
||||
(pad "2" smd roundrect (at 0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 10 "RET_DIV"))
|
||||
)
|
||||
|
||||
;; R6 - 22K voltage divider bottom (0603)
|
||||
(footprint "Resistor_SMD:R_0603_1608Metric"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000064")
|
||||
(at 18 72 90)
|
||||
(property "Reference" "R6" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "22K" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd roundrect (at -0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 10 "RET_DIV"))
|
||||
(pad "2" smd roundrect (at 0.825 0) (size 0.8 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 1 "GND"))
|
||||
)
|
||||
|
||||
;; D3 - BAT54 clamp diode to GND (SOD-323)
|
||||
(footprint "Diode_SMD:D_SOD-323"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000065")
|
||||
(at 24 70 90)
|
||||
(property "Reference" "D3" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "BAT54" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd rect (at -1.15 0) (size 0.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (net 10 "RET_DIV"))
|
||||
(pad "2" smd rect (at 1.15 0) (size 0.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (net 1 "GND"))
|
||||
)
|
||||
|
||||
;; D4 - BAT54 clamp diode to 3.3V (SOD-323)
|
||||
(footprint "Diode_SMD:D_SOD-323"
|
||||
(layer "F.Cu")
|
||||
(uuid "00000000-0000-0000-0000-000000000066")
|
||||
(at 24 74 90)
|
||||
(property "Reference" "D4" (at 0 -1.5 0) (layer "F.SilkS") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(property "Value" "BAT54" (at 0 1.5 0) (layer "F.Fab") (effects (font (size 0.6 0.6) (thickness 0.12))))
|
||||
(pad "1" smd rect (at -1.15 0) (size 0.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (net 3 "+3.3V"))
|
||||
(pad "2" smd rect (at 1.15 0) (size 0.6 0.6) (layers "F.Cu" "F.Paste" "F.Mask") (net 10 "RET_DIV"))
|
||||
)
|
||||
|
||||
;; ============================================
|
||||
;; SILKSCREEN LABELS
|
||||
;; ============================================
|
||||
|
||||
(gr_text "SN-L00 v0.1"
|
||||
(at 14 98 0)
|
||||
(at 14 98)
|
||||
(layer "F.SilkS")
|
||||
(uuid "title-text")
|
||||
(effects (font (size 1.2 1.2) (thickness 0.2)) (justify center))
|
||||
)
|
||||
|
||||
(gr_text "SubModular"
|
||||
(at 14 2 0)
|
||||
(layer "F.SilkS")
|
||||
(uuid "company-text")
|
||||
(effects (font (size 0.8 0.8) (thickness 0.15)) (justify center))
|
||||
)
|
||||
|
||||
(gr_text "TRIG"
|
||||
(at 7 77 0)
|
||||
(layer "F.SilkS")
|
||||
(uuid "trig-label")
|
||||
(effects (font (size 0.8 0.8) (thickness 0.15)) (justify center))
|
||||
)
|
||||
|
||||
(gr_text "RETURN"
|
||||
(at 21 77 0)
|
||||
(layer "F.SilkS")
|
||||
(uuid "return-label")
|
||||
(effects (font (size 0.8 0.8) (thickness 0.15)) (justify center))
|
||||
)
|
||||
|
||||
(gr_text "SN-L00"
|
||||
(at 14 50 0)
|
||||
(layer "B.SilkS")
|
||||
(uuid "back-title")
|
||||
(effects (font (size 1.5 1.5) (thickness 0.2)) (justify center mirror))
|
||||
)
|
||||
|
||||
(gr_text "git.sub-net.at/submodular/SN-L00"
|
||||
(at 14 55 0)
|
||||
(layer "B.SilkS")
|
||||
(uuid "back-url")
|
||||
(effects (font (size 0.6 0.6) (thickness 0.12)) (justify center mirror))
|
||||
)
|
||||
|
||||
;; ============================================
|
||||
;; GROUND ZONE (Back copper)
|
||||
;; ============================================
|
||||
|
||||
(zone
|
||||
(net 1)
|
||||
(net_name "GND")
|
||||
(layer "B.Cu")
|
||||
(uuid "gnd-zone-back")
|
||||
(hatch edge 0.5)
|
||||
(connect_pads (clearance 0.3))
|
||||
(min_thickness 0.25)
|
||||
(fill yes (thermal_gap 0.5) (thermal_bridge_width 0.5))
|
||||
(polygon
|
||||
(pts
|
||||
(xy 0 0)
|
||||
(xy 28 0)
|
||||
(xy 28 100)
|
||||
(xy 0 100)
|
||||
)
|
||||
(uuid "a1b2c3d4-e5f6-7890-abcd-ef1234567891")
|
||||
(effects
|
||||
(font (size 1.2 1.2) (thickness 0.2))
|
||||
)
|
||||
)
|
||||
|
||||
;; ============================================
|
||||
;; GROUND ZONE (Front copper - partial)
|
||||
;; ============================================
|
||||
(gr_text "SubModular"
|
||||
(at 14 2)
|
||||
(layer "F.SilkS")
|
||||
(uuid "a1b2c3d4-e5f6-7890-abcd-ef1234567892")
|
||||
(effects
|
||||
(font (size 0.8 0.8) (thickness 0.15))
|
||||
)
|
||||
)
|
||||
|
||||
(zone
|
||||
(net 1)
|
||||
(net_name "GND")
|
||||
(layer "F.Cu")
|
||||
(uuid "gnd-zone-front")
|
||||
(hatch edge 0.5)
|
||||
(connect_pads (clearance 0.3))
|
||||
(min_thickness 0.25)
|
||||
(fill yes (thermal_gap 0.5) (thermal_bridge_width 0.5))
|
||||
(polygon
|
||||
(pts
|
||||
(xy 0 0)
|
||||
(xy 28 0)
|
||||
(xy 28 100)
|
||||
(xy 0 100)
|
||||
)
|
||||
(gr_text "TRIG"
|
||||
(at 7 77)
|
||||
(layer "F.SilkS")
|
||||
(uuid "a1b2c3d4-e5f6-7890-abcd-ef1234567893")
|
||||
(effects
|
||||
(font (size 0.8 0.8) (thickness 0.15))
|
||||
)
|
||||
)
|
||||
|
||||
(gr_text "RETURN"
|
||||
(at 21 77)
|
||||
(layer "F.SilkS")
|
||||
(uuid "a1b2c3d4-e5f6-7890-abcd-ef1234567894")
|
||||
(effects
|
||||
(font (size 0.8 0.8) (thickness 0.15))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
KiCad PCB Component Placement Script for SN-L00
|
||||
|
||||
Run this script in KiCad's Scripting Console (Tools > Scripting Console)
|
||||
after running "Update PCB from Schematic" to place all components.
|
||||
|
||||
Usage in KiCad scripting console:
|
||||
exec(open('/path/to/place_components.py').read())
|
||||
"""
|
||||
|
||||
import pcbnew
|
||||
|
||||
# Component placement coordinates (mm) based on CPL_PCBWay.csv
|
||||
# Format: {Reference: (x, y, rotation, layer)}
|
||||
# Layer: "F.Cu" for top, "B.Cu" for bottom
|
||||
|
||||
PLACEMENTS = {
|
||||
# Capacitors
|
||||
"C1": (10.0, 60.0, 0, "F.Cu"),
|
||||
"C2": (18.0, 60.0, 0, "F.Cu"),
|
||||
"C3": (21.0, 60.0, 0, "F.Cu"),
|
||||
"C4": (7.0, 68.0, 0, "F.Cu"),
|
||||
"C5": (21.0, 68.0, 0, "F.Cu"),
|
||||
|
||||
# Resistors
|
||||
"R1": (10.0, 35.0, 0, "F.Cu"),
|
||||
"R2": (24.0, 36.0, 90, "F.Cu"),
|
||||
"R3": (7.0, 76.0, 90, "F.Cu"),
|
||||
"R4": (21.0, 76.0, 90, "F.Cu"),
|
||||
"R5": (18.0, 76.0, 90, "F.Cu"),
|
||||
"R6": (18.0, 72.0, 90, "F.Cu"),
|
||||
|
||||
# Diodes
|
||||
"D1": (7.0, 65.0, 0, "B.Cu"), # Bottom layer
|
||||
"D2": (24.0, 31.5, 90, "F.Cu"),
|
||||
"D3": (24.0, 70.0, 90, "F.Cu"),
|
||||
"D4": (24.0, 74.0, 90, "F.Cu"),
|
||||
|
||||
# ICs
|
||||
"U1": (14.0, 65.0, 0, "B.Cu"), # LDO on bottom
|
||||
"U2": (7.0, 72.0, 0, "F.Cu"), # Schmitt trigger
|
||||
"U3": (21.0, 72.0, 0, "F.Cu"), # Op-amp
|
||||
|
||||
# Connectors
|
||||
"J1": (14.0, 92.0, 0, "F.Cu"), # Power header
|
||||
"J2": (7.0, 83.0, 0, "F.Cu"), # TRIG jack
|
||||
"J3": (21.0, 83.0, 0, "F.Cu"), # RETURN jack
|
||||
|
||||
# Switch
|
||||
"SW1": (14.0, 31.5, 0, "F.Cu"),
|
||||
|
||||
# Modules (hand-solder, placement reference only)
|
||||
"MOD1": (14.0, 46.5, 0, "F.Cu"), # RP2040-Zero
|
||||
"MOD2": (14.0, 17.5, 0, "F.Cu"), # OLED
|
||||
}
|
||||
|
||||
def place_components():
|
||||
"""Place all components according to the PLACEMENTS dictionary."""
|
||||
board = pcbnew.GetBoard()
|
||||
|
||||
if not board:
|
||||
print("Error: No board loaded!")
|
||||
return
|
||||
|
||||
placed = 0
|
||||
not_found = []
|
||||
|
||||
for ref, (x, y, rotation, layer) in PLACEMENTS.items():
|
||||
# Find the footprint by reference
|
||||
fp = board.FindFootprintByReference(ref)
|
||||
|
||||
if fp is None:
|
||||
not_found.append(ref)
|
||||
continue
|
||||
|
||||
# Convert mm to internal units (nanometers)
|
||||
pos = pcbnew.VECTOR2I(pcbnew.FromMM(x), pcbnew.FromMM(y))
|
||||
fp.SetPosition(pos)
|
||||
|
||||
# Set rotation (in tenths of degrees)
|
||||
fp.SetOrientationDegrees(rotation)
|
||||
|
||||
# Set layer (flip if on bottom)
|
||||
if layer == "B.Cu" and fp.GetLayer() == pcbnew.F_Cu:
|
||||
fp.Flip(pos, False)
|
||||
elif layer == "F.Cu" and fp.GetLayer() == pcbnew.B_Cu:
|
||||
fp.Flip(pos, False)
|
||||
|
||||
placed += 1
|
||||
print(f"Placed {ref} at ({x}, {y}) rot={rotation}° on {layer}")
|
||||
|
||||
if not_found:
|
||||
print(f"\nNot found (run 'Update PCB from Schematic' first): {not_found}")
|
||||
|
||||
print(f"\nPlaced {placed}/{len(PLACEMENTS)} components")
|
||||
|
||||
# Refresh the board view
|
||||
pcbnew.Refresh()
|
||||
|
||||
|
||||
def add_mounting_holes():
|
||||
"""Add M3 mounting holes at standard Eurorack positions."""
|
||||
board = pcbnew.GetBoard()
|
||||
|
||||
# Check if mounting holes already exist
|
||||
for fp in board.GetFootprints():
|
||||
if "MountingHole" in fp.GetValue():
|
||||
print("Mounting holes already exist, skipping...")
|
||||
return
|
||||
|
||||
# Would need to load footprint from library - simplified for this script
|
||||
print("Add mounting holes manually:")
|
||||
print(" MH1: (14, 5) - Top")
|
||||
print(" MH2: (14, 95) - Bottom")
|
||||
print(" Footprint: MountingHole:MountingHole_3.2mm_M3")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("SN-L00 Component Placement Script")
|
||||
print("=" * 40)
|
||||
place_components()
|
||||
add_mounting_holes()
|
||||
print("\nDone! Run DRC and then route traces.")
|
||||
Reference in New Issue
Block a user