Skip to content

Instantly share code, notes, and snippets.

@honnet
Last active February 17, 2022 23:59
Show Gist options
  • Save honnet/99db74cb50a125d0d0a9bc922703f8cf to your computer and use it in GitHub Desktop.
Save honnet/99db74cb50a125d0d0a9bc922703f8cf to your computer and use it in GitHub Desktop.
LED strip: SK6805-EC15
// https://leomcelroy.com/svg-pcb/?file=https://gist.githubusercontent.com/honnet/99db74cb50a125d0d0a9bc922703f8cf/raw/LED_strip_SK6805-EC15.js
//////////////////////////
const LED_num = 15;
const size_y = 0.1;
const is_pad_export = 0;
//////////////////////////
const LED = (() => { return kicadToObj(
`(module LED_SK6805-EC15 (layer F.Cu) (tedit 5F81CF8C)
(descr "1.5mm x 1.5mm LED")
(tags LED)
(attr smd)
(fp_text reference REF** (at 0 -1.8) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value LED (at 0 2.25) (layer F.Fab) hide
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_poly (pts (xy 0.1 0.7) (xy -0.1 0.5) (xy 0.1 0.3)) (layer F.SilkS) (width 0))
(fp_line (start -1 1) (end 1 1) (layer F.SilkS) (width 0.12))
(fp_line (start -1 -1) (end 1 -1) (layer F.SilkS) (width 0.12))
(fp_line (start -1 -0.55) (end -1 -1) (layer F.SilkS) (width 0.12))
(fp_line (start 1 -1) (end -1 -1) (layer F.Fab) (width 0.1))
(fp_line (start 1 1) (end 1 -1) (layer F.Fab) (width 0.1))
(fp_line (start -1 1) (end 1 1) (layer F.Fab) (width 0.1))
(fp_line (start -1 -1) (end -1 1) (layer F.Fab) (width 0.1))
(fp_line (start 0 -1) (end -1 0) (layer F.Fab) (width 0.1))
(fp_line (start 1.2 -1.2) (end -1.2 -1.2) (layer F.CrtYd) (width 0.05))
(fp_line (start 1.2 1.2) (end 1.2 -1.2) (layer F.CrtYd) (width 0.05))
(fp_line (start -1.2 1.2) (end 1.2 1.2) (layer F.CrtYd) (width 0.05))
(fp_line (start -1.2 -1.2) (end -1.2 1.2) (layer F.CrtYd) (width 0.05))
(fp_circle (center 0 0) (end 0.8 0) (layer F.Fab) (width 0.1))
(fp_text user %R (at 0 0) (layer F.Fab)
(effects (font (size 0.5 0.5) (thickness 0.075)))
)
(pad 2 smd rect (at -0.475 0.475) (size 0.55 0.55) (layers F.Cu F.Paste F.Mask))
(pad 3 smd rect (at 0.475 0.475) (size 0.55 0.55) (layers F.Cu F.Paste F.Mask))
(pad 4 smd rect (at 0.475 -0.475) (size 0.55 0.55) (layers F.Cu F.Paste F.Mask))
(pad 1 smd rect (at -0.475 -0.475) (size 0.55 0.55) (layers F.Cu F.Paste F.Mask))
(model LED_1515.step
(offset (xyz 0 0 0.1))
(scale (xyz 1 1 1))
(rotate (xyz 0 0 0))
)
)`)})()
let board = new PCB();
let LEDs = [];
const dist_y = 0.12;
const w = 0.018; // wire width
for (let i = 0; i < LED_num; i++) {
LEDs[i] = board.add(LED, {translate: [0.05, 3*size_y/4 + i*dist_y],
rotate: -45,
name: "LED"});
if (is_pad_export == 0) {
if (i > 0) {
board.wire([LEDs[i-0].pad("3"), LEDs[i-1].pad("1")], w*1.5); // OUT => IN
board.wire( [
[LEDs[i-0].padX("2")-w/2, LEDs[i-0].padY("2")],
[LEDs[i-1].padX("2")-w/2, LEDs[i-1].padY("2")]
], w); // VCC
board.wire( [
[LEDs[i-0].padX("4")+w/2, LEDs[i-0].padY("4")],
[LEDs[i-1].padX("4")+w/2, LEDs[i-1].padY("4")]
], w); // GND
// board.wire([LEDs[i-0].pad("4"), LEDs[i-1].pad("4")], w); // GND
}
}
}
// TODO: check this:
renderPCB({
pcb: board,
layerColors: {
"F.Cu": "#ff0000"
},
limits: {
x: [0, 0.1],
y: [0, dist_y * LED_num]
},
mm_per_unit: 25.4
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment