Added SMT resistors and 0603 LED.

This commit is contained in:
Chris Palmer 2020-06-27 19:59:49 +01:00
parent 60659a43f8
commit 186dbbfd08
8 changed files with 70 additions and 11 deletions

View File

@ -2126,7 +2126,11 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o
| 1 | ```ax_res(res1_4, 10000)``` | Resistor 10000 Ohms 5% 0.25W | | 1 | ```ax_res(res1_4, 10000)``` | Resistor 10000 Ohms 5% 0.25W |
| 1 | ```ax_res(res1_2, 100000)``` | Resistor 100000 Ohms 5% 0.5W | | 1 | ```ax_res(res1_2, 100000)``` | Resistor 100000 Ohms 5% 0.5W |
| 1 | ```ax_res(res1_8, 1e+6, tol = 1)``` | Resistor 1e+6 Ohms 1% 0.125W | | 1 | ```ax_res(res1_8, 1e+6, tol = 1)``` | Resistor 1e+6 Ohms 1% 0.125W |
| 1 | ```smd_led(LED0603, orange)``` | SMD LED 0603 orange |
| 1 | ```smd_led(LED0805, red)``` | SMD LED 0805 red | | 1 | ```smd_led(LED0805, red)``` | SMD LED 0805 red |
| 1 | ```smd_resistor(RES0603, 1K)``` | SMD resistor 0603 1K 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 | ```square_button(button_6mm)``` | Square button 6mm | | 1 | ```square_button(button_6mm)``` | Square button 6mm |
| 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" |
@ -3081,11 +3085,14 @@ Surface mount components for PCBs.
|:--- |:--- | |:--- |:--- |
| ```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_res_end_cap(type)``` | End cap width |
| ```smd_res_power(type)``` | Power rating in Watts |
| ```smd_res_size(type)``` | Body length, width and height |
### Functions ### Functions
| Function | Description | | Function | Description |
|:--- |:--- | |:--- |:--- |
| ```smd_100th(x)``` | Convert dimesion to 1/100" notation | | ```smd_100th(x)``` | Convert dimension to 1/100" notation |
| ```smd_led_height(type)``` | Total height | | ```smd_led_height(type)``` | Total height |
| ```smd_size(size)``` | Convert size to 1/100" notation | | ```smd_size(size)``` | Convert size to 1/100" notation |
@ -3093,13 +3100,18 @@ Surface mount components for PCBs.
| Module | Description | | Module | Description |
|:--- |:--- | |:--- |:--- |
| ```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_resistor(type, value)``` | Draw an SMD resistor with specified value |
![smds](tests/png/smds.png) ![smds](tests/png/smds.png)
### Vitamins ### Vitamins
| Qty | Module call | BOM entry | | Qty | Module call | BOM entry |
| ---:|:--- |:---| | ---:|:--- |:---|
| 1 | ```smd_led(LED0805, green)``` | SMD LED 0805 green | | 1 | ```smd_led(LED0603, green)``` | SMD LED 0603 green |
| 1 | ```smd_led(LED0805, blue)``` | SMD LED 0805 blue |
| 1 | ```smd_resistor(RES0603, 1R0)``` | SMD resistor 0603 1R0 0.1W |
| 1 | ```smd_resistor(RES0805, 10M)``` | SMD resistor 0805 10M 0.125W |
| 1 | ```smd_resistor(RES1206, 100K)``` | SMD resistor 1206 100K 0.25W |
<a href="#top">Top</a> <a href="#top">Top</a>

View File

@ -58,8 +58,12 @@ test_pcb = ["TestPCB", "Test PCB",
// components // components
[ [
[ 20, -5, 180, "trimpot10"], [ 20, -5, 180, "trimpot10"],
[ 20, -15, 0, "trimpot10", true], [ 20, -15, 90, "trimpot10", true],
[ 10, 2, 0, "smd_led", LED0805, "red"], [ 10, 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"],
[ 10, 10, 0, "2p54header", 4, 1], [ 10, 10, 0, "2p54header", 4, 1],
[ 25, 10, 0, "2p54header", 5, 1, false, "blue" ], [ 25, 10, 0, "2p54header", 5, 1, false, "blue" ],
[ 10, 20, 0, "2p54boxhdr", 4, 2], [ 10, 20, 0, "2p54boxhdr", 4, 2],

View File

@ -21,9 +21,14 @@ use <../utils/layout.scad>
include <../vitamins/smds.scad> include <../vitamins/smds.scad>
module smds() module smds() {
layout([for(l = smd_leds) smd_led_size(l).x], 1) layout([for(r = smd_resistors) smd_res_size(r).x], 1)
smd_led(smd_leds[$i], ["green", "blue", "red"][$i % 3]); smd_resistor(smd_resistors[$i], ["1R0", "10M", "100K"][$i % 3]);
translate([0, 3])
layout([for(l = smd_leds) smd_led_size(l).x], 1)
smd_led(smd_leds[$i], ["green", "blue", "red"][$i % 3]);
}
if($preview) if($preview)
smds(); smds();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -924,6 +924,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
if(show(comp, "jst_xh")) jst_xh_header(jst_xh_header, comp[4], param(5, false), param(6, "white"), param(7, undef)); if(show(comp, "jst_xh")) jst_xh_header(jst_xh_header, comp[4], param(5, false), param(6, "white"), param(7, undef));
if(show(comp, "potentiometer")) potentiometer(param(4, 5), param(5, 9)); if(show(comp, "potentiometer")) potentiometer(param(4, 5), param(5, 9));
if(show(comp, "buzzer")) buzzer(param(4, 9), param(5, 12), param(6, grey(20))); 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]);
} }
} }
} }

View File

@ -29,7 +29,7 @@ function smd_led_lens(type) = type[2]; //! Lens length width and height
function smd_led_height(type) = //! Total height function smd_led_height(type) = //! Total height
smd_led_size(type).z + smd_led_lens(type).z; smd_led_size(type).z + smd_led_lens(type).z;
function smd_100th(x) = //! Convert dimesion to 1/100" notation function smd_100th(x) = //! Convert dimension to 1/100" notation
let(s = str(round(x / inch(0.01)))) let(s = str(round(x / inch(0.01))))
len(s) < 2 ? str("0", s) : s; len(s) < 2 ? str("0", s) : s;
@ -78,3 +78,33 @@ module smd_led(type, colour, cutout) { //! Draw an SMD LED with specified ```col
} }
} }
} }
function smd_res_size(type) = type[1]; //! Body length, width and height
function smd_res_end_cap(type) = type[2]; //! End cap width
function smd_res_power(type) = type[3]; //! Power rating in Watts
module smd_resistor(type, value) { //! Draw an SMD resistor with specified value
size = smd_res_size(type);
vitamin(str("smd_resistor(", type[0], ", ", value, "): SMD resistor ", smd_size(size), " ", value, " ", smd_res_power(type), "W"));
t = 0.04;
cap = smd_res_end_cap(type);
color("white")
translate_z(size.z / 2)
cube([size.x - 2 * t, size.y, size.z - 2 * t], center = true);
color(grey(20))
translate_z(size.z - t)
cube([size.x - 2 * cap, size.y, eps], center = true);
color(silver)
for(end = [-1, 1])
translate([end * (size.x / 2 - cap / 2), 0, size.z / 2])
cube([cap, size.y - 2 * eps, size.z], center = true);
color("white")
translate([0, 0, size.z])
linear_extrude(eps)
resize([(size.x - 2 * cap) * 0.75, size.y / 2])
text(value, halign = "center", valign = "center");
}

View File

@ -18,11 +18,18 @@
// //
// //
//! Axial components //! SMD components
// //
LED0805 = ["LED0805", [2, 1.25, 0.46], [1.4, 1.25, 0.54]]; LED0603 = ["LED0603", [1.6, 0.8, 0.18], [1.0, 0.8, 0.42]];
LED0805 = ["LED0805", [2.0, 1.25, 0.46], [1.4, 1.25, 0.54]];
smd_leds = [LED0805]; smd_leds = [LED0603, LED0805];
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];
use <smd.scad> use <smd.scad>