Skip to content

SVG-PCB parametric use with RP2040

A simple attempt to do parametric design with SVG-PCB https://leomcelroy.com/svg-pcb/ and to learn a bit of javascript. It generates a LED and resistor for each pin. The only parameter is the number of LEDs. It use for and if functions (you have to mirror the design when you use >7 leds ).

The code file

RP2040_parametricleds_2leds.js

The parametric part

for (let i = 0; i < led_quantity; i++) {
  LED_number = LED_number + i;
  if(i < 7){
    let tempR = board.add(R_1206, { translate: pt(RP.padX(i), 0.55), rotate: 270, name: resistor_number + i });
    let tempL = board.add(LED_1206, { translate: pt(RP.padX(i), 0.8), rotate: 90, name: LED_number });
    board.wire(path(tempL.pad("C"),pt(RP.padX(i), 0.95),pt(0.3, 0.95), pt(0.3, -0.25),pt(RP.padX("GND"), -0.25), RP.pad("GND"),), trace_thickness);
    board.wire(path(tempR.pad("1"), tempL.pad("A"),), trace_thickness);
    board.wire(path(tempR.pad("2"), RP.pad(i),), trace_thickness);
  }


  if(i > 6){
    let tempR = board.add(R_1206, { translate: pt(RP.padX(i), -0.3), rotate: 90, name: resistor_number + i });
    let tempL = board.add(LED_1206, { translate: pt(RP.padX(i), -0.5), rotate: 270, name: LED_number });
    board.wire(path(tempL.pad("C"),pt(RP.padX(i), -0.6), pt(RP.padX("GND"), -0.6), RP.pad("GND"),), trace_thickness);
    board.wire(path(tempR.pad("1"), tempL.pad("A"),), trace_thickness);
    board.wire(path(tempR.pad("2"), RP.pad(i),), trace_thickness);
  }
}

Some examples

Here an example with 2 Leds

and with 11 Leds.

people

Luc Hanneuse - AgriLab