1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-17 20:53:00 +02:00

Added SMD diodes, inductors and potentiometers.

Complete set of components added to MP1584EN buck regulator.
This commit is contained in:
Chris Palmer
2023-01-12 23:00:21 +00:00
parent 8e47270607
commit ebd50bae53
13 changed files with 287 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 KiB

After

Width:  |  Height:  |  Size: 998 KiB

View File

@@ -2438,14 +2438,17 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 1 | `box_header(2p54header, 4, 2)` | Box header 4 x 2 | | 1 | `box_header(2p54header, 4, 2)` | Box header 4 x 2 |
| 1 | `d_plug(DCONN9, pcb = true)` | D-type 9 way PCB mount plug | | 1 | `d_plug(DCONN9, pcb = true)` | D-type 9 way PCB mount plug |
| 1 | `dil_socket(12, 15.24)` | DIL socket 24 x 0.6" | | 1 | `dil_socket(12, 15.24)` | DIL socket 24 x 0.6" |
| 1 | `smd_diode(DO241AC)` | DO241AC package SS34 |
| 1 | `hdmi(hdmi_full)` | HDMI socket | | 1 | `hdmi(hdmi_full)` | HDMI socket |
| 1 | `pdip(24, 27C32, w = 15.24)` | IC 27C32 PDIP24 | | 1 | `pdip(24, 27C32, w = 15.24)` | IC 27C32 PDIP24 |
| 1 | `pdip(8, NE555)` | IC NE555 PDIP8 | | 1 | `pdip(8, NE555)` | IC NE555 PDIP8 |
| 1 | `idc_transition(2p54header, 5)` | IDC transition header 5 x 2 | | 1 | `idc_transition(2p54header, 5)` | IDC transition header 5 x 2 |
| 1 | `smd_inductor(IND2525)` | IND2525 package 4R7 |
| 1 | `potentiometer(KY_040_encoder)` | KY_040_encoder | | 1 | `potentiometer(KY_040_encoder)` | KY_040_encoder |
| 1 | `led(LED10mm, "yellow")` | LED 10 mm yellow | | 1 | `led(LED10mm, "yellow")` | LED 10 mm yellow |
| 1 | `led(LED3mm)` | LED 3 mm red | | 1 | `led(LED3mm)` | LED 3 mm red |
| 1 | `led(LED5mm, "orange")` | LED 5 mm orange | | 1 | `led(LED5mm, "orange")` | LED 5 mm orange |
| 1 | `led(LED8mm, "blue")` | LED 8 mm blue |
| 1 | `microswitch(small_microswitch)` | Microswitch DM1-00P-110-3 | | 1 | `microswitch(small_microswitch)` | Microswitch DM1-00P-110-3 |
| 1 | `hdmi(hdmi_mini)` | Mini HDMI socket | | 1 | `hdmi(hdmi_mini)` | Mini HDMI socket |
| 1 | `molex_254(2)` | Molex KK header 2 way | | 1 | `molex_254(2)` | Molex KK header 2 way |
@@ -2476,6 +2479,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 1 | `smd_sot(SOT23)` | SOT23 package 2N7000 | | 1 | `smd_sot(SOT23)` | SOT23 package 2N7000 |
| 1 | `square_button(button_4p5mm)` | Square button 4.5mm | | 1 | `square_button(button_4p5mm)` | Square button 4.5mm |
| 1 | `square_button(button_6mm)` | Square button 6mm | | 1 | `square_button(button_6mm)` | Square button 6mm |
| 1 | `smd_pot(TC33X1)` | TC33X1 package 10K |
| 1 | `pcb(TMC2130)` | TMC2130 | | 1 | `pcb(TMC2130)` | TMC2130 |
| 1 | `green_terminal(gt_5p08, 2)` | Terminal block 2 way 0.2" | | 1 | `green_terminal(gt_5p08, 2)` | Terminal block 2 way 0.2" |
| 2 | `green_terminal(gt_6p35, 2)` | Terminal block 2 way 0.25" | | 2 | `green_terminal(gt_6p35, 2)` | Terminal block 2 way 0.25" |
@@ -3578,7 +3582,7 @@ When woven sheets (e.g. carbon fibre) are rendered it is necessary to specify th
| 1 | `sheet(AL3, 30, 30, 2)` | Aluminium tooling plate 30mm x 30mm x 3mm | | 1 | `sheet(AL3, 30, 30, 2)` | Aluminium tooling plate 30mm x 30mm x 3mm |
| 1 | `sheet(AL6, 30, 30, 2)` | Aluminium tooling plate 30mm x 30mm x 6mm | | 1 | `sheet(AL6, 30, 30, 2)` | Aluminium tooling plate 30mm x 30mm x 6mm |
| 1 | `sheet(AL8, 30, 30, 2)` | Aluminium tooling plate 30mm x 30mm x 8mm | | 1 | `sheet(AL8, 30, 30, 2)` | Aluminium tooling plate 30mm x 30mm x 8mm |
| 1 | `sheet(Spring05, 30, 30, 2)` | Bi-metal saw blade 30mm x 30mm x 0.5mm | | 1 | `sheet(Spring08, 30, 30, 2)` | Bi-metal saw blade 30mm x 30mm x 0.8mm |
| 1 | `sheet(Cardboard, 30, 30, 2)` | Corrugated cardboard 30mm x 30mm x 5mm | | 1 | `sheet(Cardboard, 30, 30, 2)` | Corrugated cardboard 30mm x 30mm x 5mm |
| 1 | `sheet(Foam20, 30, 30, 2)` | Foam sponge 30mm x 30mm x 20mm | | 1 | `sheet(Foam20, 30, 30, 2)` | Foam sponge 30mm x 30mm x 20mm |
| 1 | `sheet(DiBond, 30, 30, 2)` | Sheet DiBond 30mm x 30mm x 3mm | | 1 | `sheet(DiBond, 30, 30, 2)` | Sheet DiBond 30mm x 30mm x 3mm |
@@ -3674,8 +3678,22 @@ Surface mount components for PCBs.
|:--- |:--- | |:--- |:--- |
| `smd_cap_end_cap(type)` | End cap width | | `smd_cap_end_cap(type)` | End cap width |
| `smd_cap_size(type)` | Body length, width | | `smd_cap_size(type)` | Body length, width |
| `smd_diode_lead_z(type)` | Top of lead frame from top |
| `smd_diode_leads(type)` | Lead extent in x, width, thickness and gap |
| `smd_diode_size(type)` | Body length, width and height |
| `smd_diode_z(type)` | Height above PCB surface |
| `smd_inductor_colour(type)` | Body colour |
| `smd_inductor_lead_z(type)` | Top of lead frame from top |
| `smd_inductor_leads(type)` | Lead extent in x, width, thickness and gap |
| `smd_inductor_size(type)` | Body length, width and height |
| `smd_inductor_z(type)` | Height above PCB surface |
| `smd_led_lens(type)` | Lens length width and height | | `smd_led_lens(type)` | Lens length width and height |
| `smd_led_size(type)` | Body length, width and height | | `smd_led_size(type)` | Body length, width and height |
| `smd_pot_contacts(type)` | Contacts width, depth, pitch and width, depth, gap for center contact |
| `smd_pot_cross(type)` | Cross head slot for screwdriver |
| `smd_pot_flat(type)` | Flat at the back of the wiper |
| `smd_pot_size(type)` | Base length, width and height |
| `smd_pot_wiper(type)` | Wiper diameter, offset, thickness, height, d1, d2, d3, d4 |
| `smd_res_end_cap(type)` | End cap width | | `smd_res_end_cap(type)` | End cap width |
| `smd_res_power(type)` | Power rating in Watts | | `smd_res_power(type)` | Power rating in Watts |
| `smd_res_size(type)` | Body length, width and height | | `smd_res_size(type)` | Body length, width and height |
@@ -3704,7 +3722,10 @@ Surface mount components for PCBs.
| Module | Description | | Module | Description |
|:--- |:--- | |:--- |:--- |
| `smd_capacitor(type, height, value = undef)` | Draw an SMD capacitor with specified height | | `smd_capacitor(type, height, value = undef)` | Draw an SMD capacitor with specified height |
| `smd_diode(type, value)` | Draw an SMD diode |
| `smd_inductor(type, value)` | Draw an SMD inductor |
| `smd_led(type, colour, cutout)` | Draw an SMD LED with specified `colour` | | `smd_led(type, colour, cutout)` | Draw an SMD LED with specified `colour` |
| `smd_pot(type, value)` | Draw an SMD pot |
| `smd_resistor(type, value)` | Draw an SMD resistor with specified value | | `smd_resistor(type, value)` | Draw an SMD resistor with specified value |
| `smd_soic(type, value)` | Draw an SMD SOIC | | `smd_soic(type, value)` | Draw an SMD SOIC |
| `smd_sot(type, value)` | Draw an SMD transistor | | `smd_sot(type, value)` | Draw an SMD transistor |
@@ -3714,6 +3735,8 @@ Surface mount components for PCBs.
### Vitamins ### Vitamins
| Qty | Module call | BOM entry | | Qty | Module call | BOM entry |
| ---:|:--- |:---| | ---:|:--- |:---|
| 1 | `smd_diode(DO241AC)` | DO241AC package SS34 |
| 1 | `smd_inductor(IND2525)` | IND2525 package 4R7 |
| 1 | `smd_led(LED0603, green)` | SMD LED 0603 green | | 1 | `smd_led(LED0603, green)` | SMD LED 0603 green |
| 1 | `smd_led(LED0805, blue)` | SMD LED 0805 blue | | 1 | `smd_led(LED0805, blue)` | SMD LED 0805 blue |
| 1 | `smd_led(LED1206, red)` | SMD LED 1306 red | | 1 | `smd_led(LED1206, red)` | SMD LED 1306 red |
@@ -3728,6 +3751,7 @@ Surface mount components for PCBs.
| 1 | `smd_soic(SOIC8)` | SOIC8 package SOIC8 | | 1 | `smd_soic(SOIC8)` | SOIC8 package SOIC8 |
| 1 | `smd_sot(SOT223)` | SOT223 package FZT851 | | 1 | `smd_sot(SOT223)` | SOT223 package FZT851 |
| 1 | `smd_sot(SOT23)` | SOT23 package 2N7000 | | 1 | `smd_sot(SOT23)` | SOT23 package 2N7000 |
| 1 | `smd_pot(TC33X1)` | TC33X1 package 10K |
<a href="#top">Top</a> <a href="#top">Top</a>

View File

@@ -70,6 +70,8 @@ test_pcb = ["test_pcb", "Test PCB",
[ 25, 2, 90, "smd_cap", CAP1206, 1.5], [ 25, 2, 90, "smd_cap", CAP1206, 1.5],
[ 28, 2, 90, "smd_cap", CAP0805, 1.0], [ 28, 2, 90, "smd_cap", CAP0805, 1.0],
[ 31, 2, 90, "smd_cap", CAP0603, 0.7], [ 31, 2, 90, "smd_cap", CAP0603, 0.7],
[ 34, 3, 90, "smd_diode",DO241AC, "SS34"],
[ 22, 6, -90, "smd_pot", TC33X1, "10K"],
[ 16, 6, -90, "smd_sot", SOT23, "2N7000"], [ 16, 6, -90, "smd_sot", SOT23, "2N7000"],
[ 28, 20, -90, "smd_sot", SOT223, "LM117"], [ 28, 20, -90, "smd_sot", SOT223, "LM117"],
@@ -78,9 +80,10 @@ test_pcb = ["test_pcb", "Test PCB",
[ 10, 20, 0, "2p54boxhdr", 4, 2], [ 10, 20, 0, "2p54boxhdr", 4, 2],
[ 10, 30, 0, "2p54socket", 6, 1], [ 10, 30, 0, "2p54socket", 6, 1],
[ 25, 30, 0, "2p54socket", 4, 1, false, 0, false, "red" ], [ 25, 30, 0, "2p54socket", 4, 1, false, 0, false, "red" ],
[ 65, 50, 0, "led", LED3mm, "red"], [ 59, 50, 180, "led", LED3mm, "red"],
[ 75, 50, 0, "led", LED5mm, "orange"], [ 66, 50, 180, "led", LED5mm, "orange"],
[ 90, 50, 0, "led", LED10mm, "yellow"], [ 77, 50, 180, "led", LED8mm, "blue"],
[ 90, 50, 180, "led", LED10mm, "yellow"],
[ 10, 45, 180, "rj45"], [ 10, 45, 180, "rj45"],
[ 8, 65, 180, "usb_A"], [ 8, 65, 180, "usb_A"],
[ 8, 105, 180, "usb_Ax2"], [ 8, 105, 180, "usb_Ax2"],
@@ -141,6 +144,8 @@ test_pcb = ["test_pcb", "Test PCB",
[ 52, 200, 0, "pcb", 11, TMC2130 ], [ 52, 200, 0, "pcb", 11, TMC2130 ],
[ 80, 210, 0, "pdip", 24, "27C32", true, inch(0.6) ], [ 80, 210, 0, "pdip", 24, "27C32", true, inch(0.6) ],
[ 80, 180, 0, "pdip", 8, "NE555" ], [ 80, 180, 0, "pdip", 8, "NE555" ],
[ 71, 180, 0, "smd_inductor", IND2525, "4R7"],
[ 80, 166, -90, "smd_soic", SOIC18, "PIC18F88"], [ 80, 166, -90, "smd_soic", SOIC18, "PIC18F88"],
[ 71, 166, -90, "smd_soic", SOIC16, "ICL323"], [ 71, 166, -90, "smd_soic", SOIC16, "ICL323"],
[ 64, 166, -90, "smd_soic", SOIC8, "M34063"], [ 64, 166, -90, "smd_soic", SOIC8, "M34063"],

View File

@@ -34,16 +34,30 @@ module smds() {
let(c = smd_capacitors[$i]) let(c = smd_capacitors[$i])
smd_capacitor(c, smd_cap_size(c).y * 0.8); smd_capacitor(c, smd_cap_size(c).y * 0.8);
translate([0, 12]) translate([0, 9])
layout([for(d = smd_diodes) smd_diode_size(d).x], 1)
let(d = smd_diodes[$i])
smd_diode(d, ["SS34"][$i]);
translate([0, 15])
layout([for(s = smd_sots) smd_sot_size(s).x], 1) layout([for(s = smd_sots) smd_sot_size(s).x], 1)
let(s = smd_sots[$i]) let(s = smd_sots[$i])
smd_sot(s, ["2N7000", "FZT851"][$i]); smd_sot(s, ["2N7000", "FZT851"][$i]);
translate([0, 20]) translate([0, 21])
layout([for(p = smd_pots) smd_pot_size(p).x], 1)
let(p = smd_pots[$i])
smd_pot(p, "10K");
translate([0, 28])
layout([for(s = smd_soics) smd_soic_size(s).x], 1) layout([for(s = smd_soics) smd_soic_size(s).x], 1)
let(s = smd_soics[$i]) let(s = smd_soics[$i])
smd_soic(s, s[0]); smd_soic(s, s[0]);
translate([0, 36])
layout([for(i = smd_inductors) smd_inductor_size(i).x], 1)
let(i = smd_inductors[$i])
smd_inductor(i, "4R7");
} }
if($preview) if($preview)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 KiB

After

Width:  |  Height:  |  Size: 157 KiB

View File

@@ -1135,6 +1135,9 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "smd_cap")) smd_capacitor(comp[4], comp[5], param(6, undef)); if(show(comp, "smd_cap")) smd_capacitor(comp[4], comp[5], param(6, undef));
if(show(comp, "smd_sot")) smd_sot(comp[4], comp[5]); if(show(comp, "smd_sot")) smd_sot(comp[4], comp[5]);
if(show(comp, "smd_soic")) smd_soic(comp[4], comp[5]); if(show(comp, "smd_soic")) smd_soic(comp[4], comp[5]);
if(show(comp, "smd_diode")) smd_diode(comp[4], comp[5]);
if(show(comp, "smd_inductor")) smd_inductor(comp[4], comp[5]);
if(show(comp, "smd_pot")) smd_pot(comp[4], comp[5]);
if(show(comp, "vero_pin")) vero_pin(param(4, false)); if(show(comp, "vero_pin")) vero_pin(param(4, false));
if(show(comp, "terminal")) terminal_block(comp[5], comp[4]); if(show(comp, "terminal")) terminal_block(comp[5], comp[4]);
if(show(comp, "text")) color("white") linear_extrude(eps) resize([comp[4], comp[5]]) text(comp[6], font = param(7, "Liberation Mono"), valign = "center", halign = "center"); if(show(comp, "text")) color("white") linear_extrude(eps) resize([comp[4], comp[5]]) text(comp[6], font = param(7, "Liberation Mono"), valign = "center", halign = "center");

View File

@@ -744,9 +744,24 @@ WD2002SJ = ["WD2002SJ", "WD2002SJ Buck Boost DC-DC converter", 78, 47, 1.6, 0, 3
], ],
[]]; []];
MP1584EN = ["MP1584EN", "MP1584EN 3A buck converter", 22, 17, 1.2, 0, 1, [2, 2], "green", false, MP1584EN = ["MP1584EN", "MP1584EN 3A buck converter", 22, 17, 1.25, 0, 1, [2, 2], "green", false,
[[1.75, 1.75], [1.75, -1.75], [-1.75, 1.75], [-1.75, -1.75], [-1.75, -4.4], [-1.75, 4.48], [1.75, -4.4], [1.75, 4.4]], [[1.75, 1.75], [1.75, -1.75], [-1.75, 1.75], [-1.75, -1.75], [-1.75, -4.4], [-1.75, 4.4], [1.75, -4.4], [1.75, 4.4]],
[] [ [1.75, 8.5, 90, "smd_cap", CAP1206, 1],
[-1.75, 8.5, 90, "smd_cap", CAP1206, 1],
[7.5, 8.5, 0, "smd_soic", SOIC8, "WP1584EN"],
[3.9, 8.3, 90, "smd_res", RES0603, "104"],
[3.9, 11.2, 90,"smd_cap", CAP0603, 0.5],
[3.9, 5.4, 90, "smd_res", RES0603, "822"],
[6.2, 3.5, 0, "smd_res", RES0603, "104"],
[6.2, 2.1, 0, "smd_cap", CAP0603, 0.5],
[9.2, 3.5, 0, "smd_res", RES0603, "104"],
[9.2, 2.1, 0, "smd_res", RES0603, "104"],
[6.3, 14.4, 0, "smd_diode",DO241AC, "SS34"],
[12.1, 4.9, 0, "smd_cap", CAP0603, 0.5],
[15.8, 4.9, 0, "smd_cap", CAP0603, 0.5],
[14.5, 10, 90, "smd_inductor", IND2525, "4R7"],
[14.7, 1.8,-90,"smd_pot", TC33X1, "10K"],
]
]; ];
PERF80x20 = ["PERF80x20", "Perfboard 80 x 20mm", 80, 20, 1.6, 0, 2.3, 0, "green", true, [[2,2],[-2,2],[2,-2],[-2,-2]], [], [], [5.71, 3.65]]; PERF80x20 = ["PERF80x20", "Perfboard 80 x 20mm", 80, 20, 1.6, 0, 2.3, 0, "green", true, [[2,2],[-2,2],[2,-2],[-2,-2]], [], [], [5.71, 3.65]];

View File

@@ -49,7 +49,7 @@ AL3 = [ "AL3", "Aluminium tooling plate", 3, [0.9, 0.9, 0.9, 1 ],
AL6 = [ "AL6", "Aluminium tooling plate", 6, [0.9, 0.9, 0.9, 1 ], false]; AL6 = [ "AL6", "Aluminium tooling plate", 6, [0.9, 0.9, 0.9, 1 ], false];
AL8 = [ "AL8", "Aluminium tooling plate", 8, [0.9, 0.9, 0.9, 1 ], false]; AL8 = [ "AL8", "Aluminium tooling plate", 8, [0.9, 0.9, 0.9, 1 ], false];
Steel06 = [ "Steel06", "Sheet mild steel", 0.6,"silver" , false]; Steel06 = [ "Steel06", "Sheet mild steel", 0.6,"silver" , false];
Spring05 = [ "Spring05", "Bi-metal saw blade", 0.5,"#FBC300", false]; Spring08 = [ "Spring08", "Bi-metal saw blade", 0.8,"#FBC300", false];
Silicone3 = [ "Silicone3", "Sheet silicone", 3, [0.9, 0.9, 0.9, 0.95 ], false]; Silicone3 = [ "Silicone3", "Sheet silicone", 3, [0.9, 0.9, 0.9, 0.95 ], false];
CF1 = [ "CF1", "Sheet carbon fiber", 1, grey(35), false, 2, 2, grey(20)]; CF1 = [ "CF1", "Sheet carbon fiber", 1, grey(35), false, 2, 2, grey(20)];
CF2 = [ "CF2", "Sheet carbon fiber", 2, grey(35), false, 2, 2, grey(20)]; CF2 = [ "CF2", "Sheet carbon fiber", 2, grey(35), false, 2, 2, grey(20)];
@@ -57,6 +57,6 @@ CF3 = [ "CF3", "Sheet carbon fiber", 3, grey(35),
sheets = [CF1, CF2, CF3, MDF6, MDF10, MDF12, MDF19, PMMA1p25, PMMA2, PMMA3, PMMA6, PMMA8, PMMA10, sheets = [CF1, CF2, CF3, MDF6, MDF10, MDF12, MDF19, PMMA1p25, PMMA2, PMMA3, PMMA6, PMMA8, PMMA10,
glass2, DiBond, DiBond6, Cardboard, FoilTape, AL1_6, AL2, AL3, AL6, AL8, Steel06, Spring05, Silicone3, Foam20]; glass2, DiBond, DiBond6, Cardboard, FoilTape, AL1_6, AL2, AL3, AL6, AL8, Steel06, Spring08, Silicone3, Foam20];
use <sheet.scad> use <sheet.scad>

View File

@@ -24,6 +24,7 @@ include <../utils/core/core.scad>
use <../utils/tube.scad> use <../utils/tube.scad>
use <../utils/sweep.scad> use <../utils/sweep.scad>
use <../utils/sector.scad>
function smd_led_size(type) = type[1]; //! Body length, width and height function smd_led_size(type) = type[1]; //! Body length, width and height
function smd_led_lens(type) = type[2]; //! Lens length width and height function smd_led_lens(type) = type[2]; //! Lens length width and height
@@ -228,3 +229,205 @@ module smd_soic(type, value) { //! Draw an SMD SOIC
text(value, halign = "center", valign = "center"); text(value, halign = "center", valign = "center");
} }
function smd_diode_size(type) = type[1]; //! Body length, width and height
function smd_diode_z(type) = type[2]; //! Height above PCB surface
function smd_diode_lead_z(type) = type[3]; //! Top of lead frame from top
function smd_diode_leads(type) = type[4]; //! Lead extent in x, width, thickness and gap
module smd_diode(type, value) { //! Draw an SMD diode
vitamin(str("smd_diode(", type[0], "): ", type[0], " package ", value));
slant = 5; //! 5 degree body draft angle
size = smd_diode_size(type);
z0 = smd_diode_z(type);
z2 = z0 + size.z;
z1 = z2 - smd_diode_lead_z(type);
stripe = size.x / 5;
leads = smd_diode_leads(type);
gap = leads[3];
gap2 = gap - leads.z * 2;
color(grey(20))
difference() {
hull()
for(z = [z0, z1, z2], inset = abs(z - z1) * tan(slant))
translate_z(z)
cube([size.x - 2 * inset, size.y - 2 * inset, eps], center = true);
for(side = [-1, 1])
translate([side * (size.x / 2 - (size.x - gap2) / 4), 0, eps])
cube([(size.x - gap2) / 2, size.y, 3 * leads.z], center = true);
}
color("white")
translate([-stripe / 2, 0, z2])
linear_extrude(eps)
resize([0.9 * (size.x - stripe), size.y / 2])
text(value, halign = "center", valign = "center");
color(grey(90)) {
inset = (z2 - z1) * tan(slant);
translate([size.x / 2 - stripe, -size.y / 2 + inset, z2])
cube([stripe - inset, size.y - 2 * inset, eps]);
}
color(silver)
translate_z(z1 / 2)
rotate([90, 0, 0])
linear_extrude(leads.y, center = true, convexity = 3) let($fn = 32)
difference() {
rounded_square([leads.x, z1], 2 * leads.z);
rounded_square([leads.x - 2 * leads.z, z1 - 2 * leads.z], leads.z);
translate([0, - z1 / 2])
square([gap, leads.z * 2 + eps], center = true);
}
}
function smd_inductor_size(type) = type[1]; //! Body length, width and height
function smd_inductor_z(type) = type[2]; //! Height above PCB surface
function smd_inductor_lead_z(type) = type[3]; //! Top of lead frame from top
function smd_inductor_leads(type) = type[4]; //! Lead extent in x, width, thickness and gap
function smd_inductor_colour(type) = type[5]; //! Body colour
module smd_inductor(type, value) { //! Draw an SMD inductor
vitamin(str("smd_inductor(", type[0], "): ", type[0], " package ", value));
size = smd_inductor_size(type);
z0 = smd_inductor_z(type);
z1 = smd_inductor_lead_z(type);
z2 = z0 + size.z;
leads = smd_inductor_leads(type);
gap = leads[3];
gap2 = gap - leads.z * 2;
color(smd_inductor_colour(type))
difference() {
translate_z(z0)
rounded_rectangle(size, 0.5);
for(side = [-1, 1])
translate([side * (size.x / 2 - (size.x - gap2) / 4), 0, eps])
cube([(size.x - gap2) / 2, leads.y + 2 * leads.z, 3 * leads.z], center = true);
}
color("white")
translate_z(z2)
linear_extrude(eps)
resize([0.9 * size.x, size.y / 2])
text(value, halign = "center", valign = "center");
color(silver)
translate_z(z1 / 2)
rotate([90, 0, 0])
linear_extrude(leads.y, center = true, convexity = 3) let($fn = 32)
difference() {
rounded_square([leads.x, z1], 2 * leads.z);
rounded_square([leads.x - 2 * leads.z, z1 - 2 * leads.z], leads.z);
translate([0, - z1 / 2])
square([gap, leads.z * 2 + eps], center = true);
}
}
function smd_pot_size(type) = type[1]; //! Base length, width and height
function smd_pot_contacts(type) = type[2]; //! Contacts width, depth, pitch and width, depth, gap for center contact
function smd_pot_wiper(type) = type[3]; //! Wiper diameter, offset, thickness, height, d1, d2, d3, d4
function smd_pot_cross(type) = type[4]; //! Cross head slot for screwdriver
function smd_pot_flat(type) = type[5]; //! Flat at the back of the wiper
module smd_pot(type, value) { //! Draw an SMD pot
vitamin(str("smd_pot(", type[0], "): ", type[0], " package ", value));
size = smd_pot_size(type);
contacts = smd_pot_contacts(type);
contacts_pitch = contacts[2];
centre_contact_w = contacts[3];
centre_contact_d = contacts[4];
centre_contact_gap = contacts[5];
wiper = smd_pot_wiper(type);
wiper_r1 = wiper.x / 2; // outer radius
wiper_y = wiper.y;
wiper_t = wiper.z;
wiper_h = wiper[3];
wiper_r2 = wiper[4] / 2; // inner radius at the top
wiper_r3 = wiper[5] / 2; // inner radius at the bottom
wiper_r4 = wiper[6] / 2; // outer radius of rivet
wiper_r5 = wiper[7] / 2; // inner radius of rivet
cross = smd_pot_cross(type);
flat = smd_pot_flat(type);
track_or = size.x * 0.48;
track_ir = track_or * 0.6;
color(grey(90))
translate_z(size.z / 2)
cube(size, center = true);
color(silver) {
for(side = [-1, 1])
translate([side * contacts_pitch, -size.y / 2 + contacts.y / 2, size.z / 2])
cube([contacts.x, contacts.y, size.z] + 2 * eps * [1,1,1], center = true);
translate([0, size.y / 2 - centre_contact_d / 2, size.z / 2])
render() difference() {
cube([centre_contact_w, centre_contact_d + 2 * eps, size.z + 2 * eps], center = true);
translate_z(size.z / 2)
cube([centre_contact_gap, centre_contact_d + 4 * eps, 2 * eps], center = true);
}
slope_angle = atan((wiper_h - size.z - wiper_t) / (wiper_r2 - wiper_r3));
dx = wiper_t / tan(90 - slope_angle / 2);
translate([0, wiper_y]) {
render() difference() {
rotate_extrude() {
polygon([
[wiper_r5, size.z + wiper_t],
[wiper_r3, size.z + wiper_t],
[wiper_r2, wiper_h],
[wiper_r1, wiper_h],
[wiper_r1, wiper_h - wiper_t],
[wiper_r2 + dx, wiper_h - wiper_t],
[wiper_r3 + dx, size.z],
[wiper_r5, size.z],
]);
r = (wiper_r4 - wiper_r5) / 2;
translate([wiper_r5 + r, size.z + wiper_t])
circle(r, $fn = 16);
}
translate_z(size.z + wiper_t)
linear_extrude(wiper_h - size.z - wiper_t)
difference() {
union() {
square(cross, center = true);
rotate(90)
square(cross, center = true);
}
circle(wiper_r4 + eps);
}
}
translate([0, -(wiper_r1 + cross.x / 2) / 2, wiper_h - wiper_t / 2])
cube([flat, wiper_r1 - cross.x / 2, wiper_t], center = true);
}
}
color("black")
translate([0, wiper.y, size.z])
linear_extrude(eps) {
difference() {
sector(track_or, -270 / 2 + 90, 270 / 2 + 90);
circle(track_ir);
}
track_w = track_or - track_ir;
track_l = wiper.y - track_ir / sqrt(2) + size.y / 2 - contacts.y;
for(side = [-1, 1])
translate([side * (track_ir / sqrt(2) + track_w / 2), -wiper.y -size.y / 2 + track_l / 2 + contacts.y])
square([track_w, track_l], center = true);
}
}

View File

@@ -50,4 +50,16 @@ SOIC18 = ["SOIC18", [11.40, 7.50, 2.00], 0.10, 1.20, 1.27, 10.30, [0.31, .50, 0.
smd_soics = [SOIC8, SOIC16, SOIC18]; smd_soics = [SOIC8, SOIC16, SOIC18];
DO241AC = ["DO241AC", [4.0, 2.5, 2.0], 0.1, 1, [4.8, 1.2, 0.15, 2]];
smd_diodes = [DO241AC];
IND2525 = ["IND2525", [6.75, 6.75, 2], 0.1, 1.75, [7.24, 3.2, 0.15, 4.4], grey(50)];
smd_inductors = [IND2525];
TC33X1 = ["TC33X1", [3.0, 3.8, 0.5], [0.95, 0.9, 0.88, 1.5, 0.2, 0.75],[3.0, 0.1, 0.2, 1.2, 1.7, 1.2, 1, 0.5], [2.1, 0.5], 1.5];
smd_pots = [TC33X1];
use <smd.scad> use <smd.scad>