mirror of
https://github.com/DJSundog/NopSCADlib.git
synced 2024-11-23 07:13:51 -05:00
Added JST PH connectors.
Made jst_xh_header() more parametric and corrected pin positions.
This commit is contained in:
parent
eac0086199
commit
90047815b0
@ -2465,12 +2465,17 @@ Pin headers and sockets, etc.
|
||||
| Function | Description |
|
||||
|:--- |:--- |
|
||||
| ```hdr_base_colour(type)``` | Header insulator colour |
|
||||
| ```hdr_box_size(type)``` | Box header outside dimensions |
|
||||
| ```hdr_box_wall(type)``` | Box header wall thickness |
|
||||
| ```hdr_pin_below(type)``` | Header pin length underneath |
|
||||
| ```hdr_pin_colour(type)``` | Header pin colour |
|
||||
| ```hdr_pin_length(type)``` | Header pin length |
|
||||
| ```hdr_pin_width(type)``` | Header pin size |
|
||||
| ```hdr_pitch(type)``` | Header pitch |
|
||||
| ```hdr_ra_box_offset(type)``` | Offset between back of the box and the pins |
|
||||
| ```hdr_ra_height(type)``` | Height of right angle connector |
|
||||
| ```hdr_socket_depth(type)``` | Socket depth for female housing |
|
||||
| ```hdr_y_offset(type)``` | Y offset of pins from center of the box |
|
||||
|
||||
### Modules
|
||||
| Module | Description |
|
||||
|
@ -64,11 +64,14 @@ module pin_headers() {
|
||||
pin_socket(pin_headers[$i], 3, 3, right_angle = true);
|
||||
}
|
||||
|
||||
translate([-20, 0])
|
||||
jst_xh_header(jst_xh_header, 5);
|
||||
for(i = [0, 1], p = [5, 2][i], j = [0 , 1]) {
|
||||
h = [jst_ph_header, jst_xh_header][j];
|
||||
translate([-20 * (i + 1), 0 + j * 40])
|
||||
jst_xh_header(h, p);
|
||||
|
||||
translate([-20, 20])
|
||||
jst_xh_header(jst_xh_header, 5, true);
|
||||
translate([-20 * (i + 1), 20 + j * 40])
|
||||
jst_xh_header(h, p, true);
|
||||
}
|
||||
}
|
||||
|
||||
if($preview)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 174 KiB |
Binary file not shown.
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 152 KiB |
Binary file not shown.
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 166 KiB |
@ -41,7 +41,7 @@ DSP5005 = ["DSP5005", "Ruideng DSP5005 Power supply module", [7
|
||||
[[-25, 9, 0], [ 6.5, 4.5, 1], 0.5, "yellow"],
|
||||
]];
|
||||
|
||||
DSN_VC288PCB = ["", "", 41, 21, 1, 0, 0, 0, "green", false, [], [[ 5, -3, 0, "jst_xh", 3], ], []];
|
||||
DSN_VC288PCB = ["", "", 41, 21, 1, 0, 0, 0, "green", false, [], [[ 5, -3.525, 0, "jst_xh", 3], ], []];
|
||||
|
||||
DSN_VC288 = ["DSN_VC288","DSN-VC288 DC 100V 10A Voltmeter ammeter", [45.3, 26, 17.4], [47.8, 28.8, 2.5], 0, [1, 1.8], [36, 18, 2.5], [], 0, 2,
|
||||
[], 0, DSN_VC288PCB, 5, 0];
|
||||
|
@ -348,7 +348,7 @@ PI_IO = ["PI_IO", "PI_IO V2", 35.56, 25.4, 1.6, 0, 0, 0, "green", tru
|
||||
], []];
|
||||
|
||||
ZC_A0591 = ["ZC_A0591", "ZC-A0591 ULN2003 driver PCB", 35, 32, 1.6, 0, 2.5, 0, "green", false, [[2.25, 3.25], [-2.25, 3.25], [2.25, -3.25], [-2.25, -3.25] ],
|
||||
[ [ 12.25, 8.3, -90, "jst_xh", 5],
|
||||
[ [ 11.725, 8.3, -90, "jst_xh", 5],
|
||||
[ -6.5, 10, 0, "2p54header", 1, 4],
|
||||
[ 20.4, -4.5, 0, "2p54header", 4, 1],
|
||||
[ 20.4, 11, 180, "pdip", 16, "ULN2803AN", true],
|
||||
@ -408,7 +408,7 @@ RAMPSEndstop = ["RAMPSEndstop", "RAMPS Endstop Switch",
|
||||
[2, 2, false], [2, 13.5, false], [17, 13.5], [36, 13.5]
|
||||
],
|
||||
[
|
||||
[ 12, 8, -90, "jst_xh", 3, true, "white", "silver"],
|
||||
[ 11.6, 8, -90, "jst_xh", 3, true, "white", "silver"],
|
||||
[ 26.5, 12.75, 0, "microswitch", small_microswitch],
|
||||
[ 27.5, 17.5, 15, "chip", 15, 0.5, 4.5, "silver"],
|
||||
],
|
||||
|
@ -29,6 +29,11 @@ function hdr_pin_width(type) = type[4]; //! Header pin size
|
||||
function hdr_pin_colour(type) = type[5]; //! Header pin colour
|
||||
function hdr_base_colour(type) = type[6]; //! Header insulator colour
|
||||
function hdr_socket_depth(type) = type[7]; //! Socket depth for female housing
|
||||
function hdr_box_size(type) = type[8]; //! Box header outside dimensions
|
||||
function hdr_box_wall(type) = type[9]; //! Box header wall thickness
|
||||
function hdr_y_offset(type) = type[10]; //! Y offset of pins from center of the box
|
||||
function hdr_ra_box_offset(type)= type[11]; //! Offset between back of the box and the pins
|
||||
function hdr_ra_height(type) = type[12]; //! Height of right angle connector
|
||||
|
||||
module pin(type, length = undef) { //! Draw a header pin
|
||||
w = hdr_pin_width(type);
|
||||
@ -108,9 +113,11 @@ module pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cu
|
||||
|
||||
module box_header(type, cols = 1, rows = 1, smt = false, cutout = false) { //! Draw box header
|
||||
pitch = hdr_pitch(type);
|
||||
size = hdr_box_size(type);
|
||||
w = cols * pitch + 7.62;
|
||||
l = rows * pitch + 3.52;
|
||||
h = 8.7;
|
||||
h = size.z;
|
||||
t = hdr_box_wall(type);
|
||||
base = h - 6.4;
|
||||
|
||||
if(cutout)
|
||||
@ -131,7 +138,7 @@ module box_header(type, cols = 1, rows = 1, smt = false, cutout = false) { //! D
|
||||
difference() {
|
||||
square([w, l], center = true);
|
||||
|
||||
square([w - 2.4, l - 2.4], center = true);
|
||||
square([w - t, l - t], center = true);
|
||||
|
||||
translate([0, -l / 2])
|
||||
square([4.5, 4.5], center = true);
|
||||
@ -225,65 +232,95 @@ module pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt
|
||||
module jst_xh_header(type, pin_count, right_angle = false, colour = false, pin_colour = false) { //! Draw JST XH connector
|
||||
colour = colour ? colour : hdr_base_colour(type);
|
||||
pin_colour = pin_colour ? pin_colour : hdr_pin_colour(type);
|
||||
sizeY = 5.75;
|
||||
pitch = hdr_pitch(type);
|
||||
size = hdr_box_size(type) + [(pin_count - 1) * pitch, 0, 0];
|
||||
pinOffsetX = hdr_box_size(type).x / 2; // Offset from last pin to box edge
|
||||
wallThickness = hdr_box_wall(type);
|
||||
y_offset = hdr_y_offset(type);
|
||||
ra_box_offset = hdr_ra_box_offset(type);
|
||||
ra_h = hdr_ra_height(type);
|
||||
ra_z = ra_h - size.y / 2;
|
||||
ra_extra = ra_h - size.y; // thicker base for right angle version
|
||||
pinWidth = hdr_pin_width(type);
|
||||
|
||||
module jst_xh_socket(type, pin_count) {
|
||||
socketSizeZ = hdr_socket_depth(type);
|
||||
pinOffsetX = 2.45;
|
||||
sizeY = 5.75;
|
||||
wallThickness = 0.8;
|
||||
size = [pinOffsetX * 2 + (pin_count - 1) * pitch, sizeY, socketSizeZ];
|
||||
translate([-size[0] / 2, -size[1] / 2, 0]) {
|
||||
// the base
|
||||
cube([size[0], size[1], wallThickness]);
|
||||
// the three full sides
|
||||
translate([0, size[1] - wallThickness, 0])
|
||||
cube([size[0], wallThickness, size[2]]);
|
||||
cube([wallThickness, size[1], size[2]]);
|
||||
translate([size[0] - wallThickness, 0, 0])
|
||||
cube([wallThickness, size[1], size[2]]);
|
||||
// the sides with cutouts
|
||||
cube([size[0], wallThickness, 2]);
|
||||
cutoutWidth = 1;
|
||||
cutoutOffset = pinOffsetX - cutoutWidth / 2;
|
||||
cube([cutoutOffset, wallThickness, size[2]]);
|
||||
translate([size[0] - cutoutOffset, 0, 0])
|
||||
cube([cutoutOffset, wallThickness, size[2]]);
|
||||
cube([cutoutOffset, wallThickness, size[2]]);
|
||||
translate([size[0]-cutoutOffset, 0, 0])
|
||||
cube([cutoutOffset, wallThickness, size[2]]);
|
||||
translate([cutoutOffset + cutoutWidth, 0, 0])
|
||||
cube([size[0] - 2 * (cutoutWidth + cutoutOffset), wallThickness, size[2]]);
|
||||
module jst_xh_socket(type, pin_count, ra = false) {
|
||||
module wall() {
|
||||
difference() {
|
||||
square([size.x, size.y], center = true);
|
||||
|
||||
offset(-wallThickness)
|
||||
square([size.x, size.y], center = true);
|
||||
}
|
||||
if(right_angle)
|
||||
translate([0, size.y / 2 + ra_extra / 2])
|
||||
square([size.x, ra_extra], center = true);
|
||||
}
|
||||
|
||||
module slots() {
|
||||
cutoutWidth = 1.3;
|
||||
cutoutOffset = pinOffsetX + cutoutWidth / 2 - hdr_pin_width(type) / 2;
|
||||
for(side = [-1, 1])
|
||||
translate([side * (size.x / 2 - cutoutOffset), -size.y / 2 + wallThickness / 2])
|
||||
square([cutoutWidth, 2 * wallThickness], center = true);
|
||||
}
|
||||
|
||||
linear_extrude(wallThickness)
|
||||
square([size.x, size.y], center = true); // the base
|
||||
|
||||
linear_extrude(size.z / 2) // full walls up to the slots
|
||||
wall();
|
||||
|
||||
linear_extrude(size.z) // slotted walls to the top
|
||||
difference() {
|
||||
wall();
|
||||
|
||||
if(type[0] == "jst_xh_header") {
|
||||
if(pin_count > 2)
|
||||
slots();
|
||||
else
|
||||
hull()
|
||||
slots();
|
||||
|
||||
translate([0, -size.y / 2 + 3 * wallThickness / 2])
|
||||
square([size.x + 1, wallThickness], center = true);
|
||||
}
|
||||
|
||||
if(type[0] == "jst_ph_header") {
|
||||
translate([0, -size.y / 2 + wallThickness / 2])
|
||||
square([max((pin_count - 2) * pitch, 1), 2 * wallThickness], center = true);
|
||||
|
||||
translate([0, -y_offset / 2 - pinWidth / 4])
|
||||
square([size.x + 1, y_offset + pinWidth / 2], center = true);
|
||||
}
|
||||
}
|
||||
} // end module
|
||||
|
||||
|
||||
color(colour)
|
||||
if(right_angle)
|
||||
translate([0, -1, sizeY / 2])
|
||||
translate([0, -ra_box_offset, ra_z])
|
||||
rotate([-90, 0, 180])
|
||||
jst_xh_socket(type, pin_count);
|
||||
jst_xh_socket(type, pin_count, true);
|
||||
else
|
||||
translate([0, y_offset])
|
||||
jst_xh_socket(type, pin_count);
|
||||
|
||||
color(pin_colour)
|
||||
for(x = [0 : pin_count - 1]) {
|
||||
pinWidth = hdr_pin_width(type);
|
||||
verticalPinLength = right_angle ? hdr_pin_below(type) + sizeY / 2 : hdr_pin_length(type);
|
||||
translate([pitch * (x - (pin_count - 1) / 2), 0, 0]) {
|
||||
verticalPinLength = right_angle ? hdr_pin_below(type) + ra_z + y_offset : hdr_pin_length(type);
|
||||
horizontalPinLength = hdr_pin_length(type) - hdr_pin_below(type) + ra_box_offset;
|
||||
translate([pitch * (x - (pin_count - 1) / 2), 0]) {
|
||||
pin(type, verticalPinLength);
|
||||
|
||||
if(right_angle) {
|
||||
translate([0, -pinWidth / 2, sizeY / 2 - pinWidth / 2])
|
||||
translate([0, -pinWidth / 2, ra_z - pinWidth / 2 + y_offset])
|
||||
rotate([0, -90, 0])
|
||||
rotate_extrude(angle = 90, $fn = 32)
|
||||
translate([0, -pinWidth / 2])
|
||||
square(pinWidth);
|
||||
|
||||
translate([0, -sizeY / 2 - 3 * pinWidth / 4, sizeY / 2])
|
||||
translate([0, -hdr_pin_below(type), ra_z + y_offset])
|
||||
rotate([90, 0, 0])
|
||||
pin(type, hdr_pin_length(type) - hdr_pin_below(type));
|
||||
pin(type, horizontalPinLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,15 +17,16 @@
|
||||
// If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
// p p b p p b Socket depth
|
||||
// i i e i i a
|
||||
// t n l n n s
|
||||
// c o e
|
||||
// h l w w c
|
||||
// c
|
||||
//
|
||||
2p54header = ["2p54header", 2.54, 11.6, 3.2, 0.66, "gold", grey(20), 8.5];
|
||||
jst_xh_header = ["JST XH header",2.5, 10, 3.4, 0.64, "gold", grey(90), 7];
|
||||
// p p b p p b s b b p r r
|
||||
// i i e i i a o o o i a a
|
||||
// t n l n n s c x x n
|
||||
// c o e k b h
|
||||
// h l w w c s t y
|
||||
// c h z o
|
||||
// f
|
||||
2p54header = ["2p54header", 2.54, 11.6, 3.2, 0.66, "gold", grey(20), 8.5, [0, 0, 8.7], 2.4, 0, 0, 0 ];
|
||||
jst_xh_header = ["jst_xh_header",2.5, 10, 3.4, 0.64, "gold", grey(90), 0, [4.9, 5.75, 7], 0.8, 0.525, 0.6, 6.1];
|
||||
jst_ph_header = ["jst_ph_header",2.0, 9, 3.4, 0.64, silver, grey(90), 0, [3.9, 4.5, 6], 0.6, 0.55, 0.25, 4.8];
|
||||
|
||||
pin_headers = [ 2p54header ];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user