1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-01-17 05:28:14 +01:00

Added SMD Tantalum caps and 0502 and 0402 resistor and capacitors.

This commit is contained in:
Chris Palmer 2023-04-22 12:12:12 +01:00
parent 1c5d9a8ef5
commit 5fc70e19ac
8 changed files with 173 additions and 29 deletions

View File

@ -2526,12 +2526,19 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 1 | `smd_led(LED0603, orange)` | SMD LED 0603 orange |
| 1 | `smd_led(LED0805, red)` | SMD LED 0805 red |
| 1 | `smd_led(LED1206, blue)` | SMD LED 1306 blue |
| 1 | `smd_tant(TANT_A)` | SMD Tantalum capacitor package A ,1uF, 2.5V |
| 1 | `smd_tant(TANT_B)` | SMD Tantalum capacitor package B ,10uF, 10V |
| 1 | `smd_tant(TANT_C)` | SMD Tantalum capacitor package C ,100uF, 16V |
| 1 | `smd_capacitor(CAP0402)` | SMD capacitor 0402 10nF |
| 1 | `smd_capacitor(CAP0502)` | SMD capacitor 0502 10nF |
| 1 | `smd_capacitor(CAP0603)` | SMD capacitor 0603 10nF |
| 1 | `smd_capacitor(CAP0805)` | SMD capacitor 0805 100nF |
| 1 | `smd_capacitor(CAP1206)` | SMD capacitor 1206 1uF |
| 1 | `smd_resistor(RES0603, 1K)` | SMD resistor 0603 1K 0.1W |
| 1 | `smd_resistor(RES0402, 1)` | SMD resistor 0402 1 0.0625W |
| 1 | `smd_resistor(RES0502, 10)` | SMD resistor 0502 10 0.05W |
| 1 | `smd_resistor(RES0603, 100)` | SMD resistor 0603 100 0.1W |
| 1 | `smd_resistor(RES0805, 1K)` | SMD resistor 0805 1K 0.125W |
| 1 | `smd_resistor(RES1206, 1K)` | SMD resistor 1206 1K 0.25W |
| 1 | `smd_resistor(RES1206, 1M)` | SMD resistor 1206 1M 0.25W |
| 1 | `smd_soic(SOIC14)` | SOIC14 package 74HC00 |
| 1 | `smd_soic(SOIC16)` | SOIC16 package ICL323 |
| 1 | `smd_soic(SOIC18)` | SOIC18 package PIC18F88 |
@ -3812,6 +3819,21 @@ SK shaft support brackets
## SMDs
Surface mount components for PCBs.
Note that the value string for tantalum capacitors is the the capacitance in pico farads expressed as two digits plus an exponent plus a single letter voltage code.
E.g. 475A is 4.7uF 10V on the parts list.
| Code | Voltage |
| ---- | ------- |
| e | 2.5 |
| G | 4 |
| J | 6.3 |
| A | 10 |
| C | 16 |
| D | 20 |
| E | 25 |
| V | 35 |
| H | 50 |
[vitamins/smds.scad](vitamins/smds.scad) Object definitions.
[vitamins/smd.scad](vitamins/smd.scad) Implementation.
@ -3823,6 +3845,7 @@ Surface mount components for PCBs.
|:--- |:--- |
| `smd_cap_end_cap(type)` | End cap width |
| `smd_cap_size(type)` | Body length, width |
| `smd_diode_colour(type)` | Body colour |
| `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 |
@ -3855,6 +3878,11 @@ Surface mount components for PCBs.
| `smd_sot_size(type)` | Body length, width and height |
| `smd_sot_tab_width(type)` | The wide lead at the top |
| `smd_sot_z(type)` | Height above PCB surface |
| `smd_tant_colours(type)` | Colours of body and stripe |
| `smd_tant_lead_z(type)` | Top of lead frame from top |
| `smd_tant_leads(type)` | Lead extent in x, width, thickness and gap |
| `smd_tant_size(type)` | Body length, width and height |
| `smd_tant_z(type)` | Height above PCB surface |
### Functions
| Function | Description |
@ -3874,6 +3902,7 @@ Surface mount components for PCBs.
| `smd_resistor(type, value)` | Draw an SMD resistor with specified value |
| `smd_soic(type, value)` | Draw an SMD SOIC |
| `smd_sot(type, value)` | Draw an SMD transistor |
| `smd_tant(type, value)` | Draw an SMD tantalum capacitor |
![smds](tests/png/smds.png)
@ -3885,10 +3914,17 @@ Surface mount components for PCBs.
| 1 | `smd_led(LED0603, green)` | SMD LED 0603 green |
| 1 | `smd_led(LED0805, blue)` | SMD LED 0805 blue |
| 1 | `smd_led(LED1206, red)` | SMD LED 1306 red |
| 1 | `smd_tant(TANT_A)` | SMD Tantalum capacitor package A ,1uF, 2.5V |
| 1 | `smd_tant(TANT_B)` | SMD Tantalum capacitor package B ,10uF, 6.3V |
| 1 | `smd_tant(TANT_C)` | SMD Tantalum capacitor package C ,100uF, 10V |
| 1 | `smd_capacitor(CAP0402)` | SMD capacitor 0402 |
| 1 | `smd_capacitor(CAP0502)` | SMD capacitor 0502 |
| 1 | `smd_capacitor(CAP0603)` | SMD capacitor 0603 |
| 1 | `smd_capacitor(CAP0805)` | SMD capacitor 0805 |
| 1 | `smd_capacitor(CAP1206)` | SMD capacitor 1206 |
| 1 | `smd_resistor(RES0603, 1R0)` | SMD resistor 0603 1R0 0.1W |
| 1 | `smd_resistor(RES0402, 1R0)` | SMD resistor 0402 1R0 0.0625W |
| 1 | `smd_resistor(RES0502, 10)` | SMD resistor 0502 10 0.05W |
| 1 | `smd_resistor(RES0603, 100)` | SMD resistor 0603 100 0.1W |
| 1 | `smd_resistor(RES0805, 10M)` | SMD resistor 0805 10M 0.125W |
| 1 | `smd_resistor(RES1206, 100K)` | SMD resistor 1206 100K 0.25W |
| 1 | `smd_soic(SOIC14)` | SOIC14 package SOIC14 |

View File

@ -62,19 +62,26 @@ test_pcb = ["test_pcb", "Test PCB",
[
[ 20, -5, 180, "trimpot10"],
[ 20, -15, 90, "trimpot10", true],
[ 7, 2, 90, "smd_led", LED1206, "blue"],
[ 10, 2, 90, "smd_led", LED0805, "red"],
[ 19, 2, 90, "smd_led", LED1206, "blue"],
[ 16, 2, 90, "smd_led", LED0805, "red"],
[ 13, 2, 90, "smd_led", LED0603, "orange"],
[ 16, 2, 90, "smd_res", RES1206, "1K"],
[ 19, 2, 90, "smd_res", RES0805, "1K"],
[ 22, 2, 90, "smd_res", RES0603, "1K"],
[ 25, 2, 90, "smd_cap", CAP1206, 1.5, "1uF"],
[ 28, 2, 90, "smd_cap", CAP0805, 1.0, "100nF"],
[ 31, 2, 90, "smd_cap", CAP0603, 0.7, "10nF"],
[ 34, 3, 90, "smd_diode",DO241AC, "SS34"],
[ 21, 6, -90, "smd_pot", TC33X1, "10K"],
[ 16, 6, -90, "smd_sot", SOT23, "2N7000"],
[ 28, 8, -90, "smd_sot", SOT223, "LM117"],
[ 19, 6, -90, "smd_res", RES1206, "1M"],
[ 16, 6, -90, "smd_res", RES0805, "1K"],
[ 13, 6, -90, "smd_res", RES0603, "100"],
[ 10, 6, -90, "smd_res", RES0502, "10"],
[ 7, 6, -90, "smd_res", RES0402, "1"],
[ 19, 10, 90, "smd_cap", CAP1206, 1.5, "1uF"],
[ 16, 10, 90, "smd_cap", CAP0805, 1.0, "100nF"],
[ 13, 10, 90, "smd_cap", CAP0603, 0.7, "10nF"],
[ 10, 10, 90, "smd_cap", CAP0502, 0.6, "10nF"],
[ 7, 10, 90, "smd_cap", CAP0402, 0.5, "10nF"],
[ 19, 16, -90, "smd_tant", TANT_C, "107C"],
[ 13, 16, -90, "smd_tant", TANT_B, "106A"],
[ 7, 16, -90, "smd_tant", TANT_A, "105e"],
[ 32, 3, -90, "smd_diode",DO241AC, "SS34"],
[ 26, 2, -90, "smd_pot", TC33X1, "10K"],
[ 28, 6, -90, "smd_sot", SOT23, "2N7000"],
[ 28, 12, -90, "smd_sot", SOT223, "LM117"],
[ 45, 35, 0, "2p54header", 4, 1],
[ 60, 35, 0, "2p54header", 5, 1, false, "blue" ],

View File

@ -23,7 +23,7 @@ include <../vitamins/smds.scad>
module smds() {
layout([for(r = smd_resistors) smd_res_size(r).x], 1)
smd_resistor(smd_resistors[$i], ["1R0", "10M", "100K"][$i % 3]);
smd_resistor(smd_resistors[$i], ["1R0", "10", "100", "10M", "100K"][$i % 5]);
translate([0, 3])
layout([for(l = smd_leds) smd_led_size(l).x], 1)
@ -35,27 +35,32 @@ module smds() {
smd_capacitor(c, smd_cap_size(c).y * 0.8);
translate([0, 9])
layout([for(d = smd_diodes) smd_diode_size(d).x], 1)
layout([for(t = smd_tants) smd_tant_leads(t).x], 1)
let(t = smd_tants[$i])
smd_tant(t, ["105e","106J", "107A"][$i]);
translate([0, 12.5])
layout([for(d = smd_diodes) smd_diode_leads(d).x], 1)
let(d = smd_diodes[$i])
smd_diode(d, ["SS34"][$i]);
translate([0, 15])
translate([0, 24])
layout([for(s = smd_sots) smd_sot_size(s).x], 1)
let(s = smd_sots[$i])
smd_sot(s, ["2N7000", "FZT851"][$i]);
translate([0, 21])
translate([0, 18])
layout([for(p = smd_pots) smd_pot_size(p).x], 1)
let(p = smd_pots[$i])
smd_pot(p, "10K");
translate([0, 28])
translate([0, 31])
layout([for(s = smd_soics) smd_soic_size(s).x], 1)
let(s = smd_soics[$i])
smd_soic(s, s[0]);
translate([0, 36])
layout([for(i = smd_inductors) smd_inductor_size(i).x], 1)
translate([0, 39])
layout([for(i = smd_inductors) smd_inductor_leads(i).x], 1)
let(i = smd_inductors[$i])
smd_inductor(i, "4R7");
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 180 KiB

View File

@ -1146,6 +1146,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "buzzer")) buzzer(param(4, 9), param(5, 12), param(6, grey(20)));
if(show(comp, "smd_res")) smd_resistor(comp[4], comp[5]);
if(show(comp, "smd_cap")) smd_capacitor(comp[4], comp[5], param(6, undef));
if(show(comp, "smd_tant")) smd_tant(comp[4], param(5, undef));
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_diode")) smd_diode(comp[4], comp[5]);

View File

@ -19,6 +19,21 @@
//
//! Surface mount components for PCBs.
//!
//! Note that the value string for tantalum capacitors is the the capacitance in pico farads expressed as two digits plus an exponent plus a single letter voltage code.
//! E.g. 475A is 4.7uF 10V on the parts list.
//!
//! | Code | Voltage |
//! | ---- | ------- |
//! | e | 2.5 |
//! | G | 4 |
//! | J | 6.3 |
//! | A | 10 |
//! | C | 16 |
//! | D | 20 |
//! | E | 25 |
//! | V | 35 |
//! | H | 50 |
//
include <../utils/core/core.scad>
@ -234,6 +249,7 @@ 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
function smd_diode_colour(type) = type[5]; //! Body colour
module smd_diode(type, value) { //! Draw an SMD diode
vitamin(str("smd_diode(", type[0], "): ", type[0], " package ", value));
@ -248,7 +264,7 @@ module smd_diode(type, value) { //! Draw an SMD diode
gap = leads[3];
gap2 = gap - leads.z * 2;
color(grey(20))
color(smd_diode_colour(type))
difference() {
hull()
for(z = [z0, z1, z2], inset = abs(z - z1) * tan(slant))
@ -287,6 +303,75 @@ module smd_diode(type, value) { //! Draw an SMD diode
}
function smd_tant_size(type) = type[1]; //! Body length, width and height
function smd_tant_z(type) = type[2]; //! Height above PCB surface
function smd_tant_lead_z(type) = type[3]; //! Top of lead frame from top
function smd_tant_leads(type) = type[4]; //! Lead extent in x, width, thickness and gap
function smd_tant_colours(type)= type[5]; //! Colours of body and stripe
module smd_tant(type, value) { //! Draw an SMD tantalum capacitor
function dig(c) = let(x = ord(c) - ord("0")) assert(x >= 0 && x <= 9, "expected value in the form 475A for 4.7uF 10V") x;
uF = is_undef(value) ? "" : str(" ,", (dig(value[0]) * 10 + dig(value[1])) * 10 ^ dig(value[2]) / 10^6, "uF");
codes = "eGJACDEVH";
voltages = [2.5, 4, 6.3, 10, 16, 20, 25, 35, 50];
volts = is_undef(value) ? "" : let(c = value[3])
assert(in(codes, c), str("expected the 4th character of value to be a voltage code: ", codes, ", got ", c))
str(", ", voltages[search(c, codes)[0]], "V");
vitamin(str("smd_tant(", type[0], "): SMD Tantalum capacitor package ", type[0][len(type[0]) -1], uF, volts));
size = smd_tant_size(type);
slant = 5; //! 5 degree body draft angle
z0 = smd_tant_z(type);
z2 = z0 + size.z;
z1 = z2 - smd_tant_lead_z(type);
stripe = size.x / 5;
leads = smd_tant_leads(type);
gap = leads[3];
gap2 = gap - leads.z * 2;
colours = smd_tant_colours(type);
inset = (z2 - z1) * tan(slant);
color(colours[0])
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") {
w = 0.9 * (size.x - stripe - inset);
translate([-size.x / 2 + inset + stripe + w / 2, 0, z2])
linear_extrude(eps)
resize([w, size.y / 2])
text(value, halign = "center", valign = "center");
}
color(colours[1]) {
translate([-size.x / 2 + stripe * 0.2, -size.y / 2 + inset, z2])
cube([(stripe - inset) * 0.8, 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

View File

@ -27,34 +27,44 @@ LED1206 = ["LED1206", [3.2, 1.6, 0.5], [2.0, 1.6, .6]];
smd_leds = [LED0603, LED0805, LED1206];
RES0402 = ["RES0402", [1.0, 0.5, 0.35], 0.2, 1/16];
RES0502 = ["RES0502", [1.3, 0.6, 0.38], 0.2, 1/20];
RES0603 = ["RES0603", [1.6, 0.8, 0.45], 0.3, 1/10];
RES0805 = ["RES0805", [2.0, 1.2, 0.45], 0.4, 1/8];
RES1206 = ["RES1206", [3.1, 1.6, 0.6], 0.5, 1/4];
smd_resistors = [RES0603, RES0805, RES1206];
smd_resistors = [RES0402, RES0502, RES0603, RES0805, RES1206];
CAP0402 = ["CAP0402", [1.0, 0.5], 0.2];
CAP0502 = ["CAP0502", [1.3, 0.6], 0.2];
CAP0603 = ["CAP0603", [1.6, 0.8], 0.3];
CAP0805 = ["CAP0805", [2.0, 1.2], 0.4];
CAP1206 = ["CAP1206", [3.1, 1.6], 0.5];
smd_capacitors = [CAP0603, CAP0805, CAP1206];
smd_capacitors = [CAP0402, CAP0502, CAP0603, CAP0805, CAP1206];
SOT23 = ["SOT23", [3, 1.4, 1.0], 0.05, 0.66, 1.9, 2.6, [0.4, 0.45, 0.15], 0.4];
SOT223 = ["SOT223", [6.5, 3.5, 1.6], 0.05, 0.89, 2.3, 7.0, [0.7, 0.95, 0.25], 3];
smd_sots = [SOT23, SOT223];
SOIC8 = ["SOIC8", [4.90, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]];
SOIC14 = ["SOIC14", [8.70, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]];
SOIC16 = ["SOIC16", [9.90, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]];
SOIC8 = ["SOIC8", [4.90, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]];
SOIC14 = ["SOIC14", [8.70, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]];
SOIC16 = ["SOIC16", [9.90, 3.90, 1.25], 0.10, 0.66, 1.27, 6.00, [0.31, .50, 0.20]];
SOIC18 = ["SOIC18", [11.40,7.50, 2.00], 0.10, 1.20, 1.27, 10.30, [0.31, .50, 0.20]];
smd_soics = [SOIC8, SOIC14, SOIC16, SOIC18];
DO241AC = ["DO241AC", [4.0, 2.5, 2.0], 0.1, 1, [4.8, 1.2, 0.15, 2]];
DO241AC = ["DO241AC", [4.0, 2.5, 2.0], 0.1, 1, [4.8, 1.2, 0.15, 2], grey(20)];
smd_diodes = [DO241AC];
TANT_A = ["TANT_A", [3.0, 1.6, 1.6], 0.1, 0.8, [3.2, 1.2, 0.08, 1.1], ["#E9D769", "#E9B44A"]];
TANT_B = ["TANT_B", [3.3, 2.8, 1.9], 0.1, 0.95, [3.5, 2.2, 0.08, 1.4], ["#E9D769", "#E9B44A"]];
TANT_C = ["TANT_C", [5.8, 3.2, 2.6], 0.1, 1.3, [6.0, 2.2, 0.08, 2.9], ["#E9D769", "#E9B44A"]];
smd_tants = [TANT_A, TANT_B, TANT_C];
IND2525 = ["IND2525", [6.75, 6.75, 2], 0.1, 1.75, [7.24, 3.2, 0.15, 4.4], grey(50)];
smd_inductors = [IND2525];