mcopy/scad/cpc_connectors.scad

249 lines
7.3 KiB
OpenSCAD
Raw Normal View History

2023-03-05 05:28:39 +00:00
/*
Amphenol CPC 9pin Connectors
*/
include <./common/common.scad>;
FN = 120;
2023-12-01 03:32:18 +00:00
PlugD = 16.15 - 0.6;
2023-03-08 21:01:02 +00:00
PlugH = 11.65;
2023-12-01 03:32:18 +00:00
PlugGuideD = 17 - 0.6;
2023-12-11 03:48:12 +00:00
PlugPinD1 = 1.9;
PlugPinD2 = 2.9;
PlugPinD3 = 3.9;
2023-03-08 21:01:02 +00:00
PlugGuideRetraction = 1.25;
PinSpacing = 3.85;
2023-03-05 05:28:39 +00:00
2023-12-01 03:32:18 +00:00
SocketD = 16.15;
SocketGuideD = 17.5;
SocketOuterD = 20;
2023-03-26 22:53:01 +00:00
SocketH = 10.5;
2023-12-11 03:48:12 +00:00
SocketPinD = 3.1;
2023-03-16 02:11:48 +00:00
CollarD = 22;
2023-03-08 21:01:02 +00:00
GuideAngles = [0, 100, 140, 215, 260];
2023-03-08 21:01:02 +00:00
GuideWidths = [3.2, 1.5, 1.5, 1.5, 1.5];
2023-12-11 03:48:12 +00:00
DEBUG = false;
2023-03-08 21:01:02 +00:00
function arc_angle (D, W) = W / ((PI/180) * (D/2));
module guide (Diameter, Height, Angle, Width) {
A = arc_angle(Diameter, Width);
echo(A);
2023-12-11 03:48:12 +00:00
if (!DEBUG) {
rotate([0, 0, Angle]) difference () {
cylinder(r = R(Diameter), h = Height, center = true, $fn = FN);
rotate([0, 0, -A/2]) translate([Diameter / 2, 0, 0]) cube([Diameter, Diameter * 2, Height + 1], center = true);
rotate([0, 0, A/2]) translate([-Diameter / 2, 0, 0]) cube([Diameter, Diameter * 2, Height + 1], center = true);
}
2023-03-08 21:01:02 +00:00
}
}
2023-04-11 01:04:01 +00:00
//
2023-12-11 03:48:12 +00:00
module plug_pin (X = 0, Y = 0, H = 10) {
translate([X, Y, 0]) rotate([180, 0, 0]) {
cylinder(r = R(PlugPinD3), h = H, center = true, $fn = 40);
translate([0, 0, -(H / 2) - (3.1 / 2)]) cylinder(r = R(PlugPinD2), h = 3.11, center = true, $fn = 40);
translate([0, 0, -(H / 2) - 3.1 - (0.7 / 2)]) cylinder(r1 = R(PlugPinD1), r2 = R(PlugPinD2), h = 0.72, center = true, $fn = 40);
translate([0, 0, -(H / 2) - 3.1 - 0.7 - (8 / 2)]) cylinder(r = R(PlugPinD1), h = 8.01, center = true, $fn = 40);
}
}
module socket_pin (X = 0, Y = 0, H = 10) {
2023-03-08 21:01:02 +00:00
translate([X, Y, 0]) {
2023-12-11 03:48:12 +00:00
cylinder(r = R(SocketPinD), h = H, center = true, $fn = 40);
2023-03-08 21:01:02 +00:00
}
}
2023-03-27 00:19:00 +00:00
module m3_bolt_void (pos = [0, 0, 0], H = 1) {
D = 3.25;
translate(pos) {
cylinder(r = R(D), h = H, center = true, $fn = 40);
}
}
2023-03-08 21:01:02 +00:00
module plug_pin_voids (PinH) {
plug_pin(0, 0, PinH); //5
plug_pin(PinSpacing, 0, PinH); //4
plug_pin(-PinSpacing, 0, PinH); //6
plug_pin(0, PinSpacing, PinH); //2
plug_pin(0, -PinSpacing, PinH); //8
plug_pin(PinSpacing, PinSpacing, PinH); //1
plug_pin(-PinSpacing, PinSpacing, PinH); //3
plug_pin(-PinSpacing, -PinSpacing, PinH); //9
plug_pin(PinSpacing, -PinSpacing, PinH); //7
}
module socket_pin_voids (PinH, OnlyPins) {
2023-12-11 03:48:12 +00:00
socket_pin(0, 0, PinH); //5
socket_pin(PinSpacing, 0, PinH); //4
socket_pin(-PinSpacing, 0, PinH); //6
socket_pin(0, PinSpacing, PinH); //2
socket_pin(0, -PinSpacing, PinH); //8
socket_pin(PinSpacing, PinSpacing, PinH); //1
socket_pin(-PinSpacing, PinSpacing, PinH); //3
socket_pin(-PinSpacing, -PinSpacing, PinH); //9
socket_pin(PinSpacing, -PinSpacing, PinH); //7
}
2023-03-05 05:28:39 +00:00
module cpc_9pin_plug () {
$fn = FN;
2023-03-08 21:01:02 +00:00
PinH = PlugH + 1;
2023-03-05 05:28:39 +00:00
difference () {
union () {
2023-03-08 21:01:02 +00:00
cylinder(r = R(PlugD), h = PlugH, center = true);
2023-12-11 03:48:12 +00:00
//translate([0, 0, -(PlugH/2)+(2/2)]) cylinder(r = R(PlugD + 2), h = 2, center = true);
2023-03-08 21:01:02 +00:00
translate([0, 0, -PlugGuideRetraction/2]) {
for (i = [0 : len(GuideAngles) - 1]) {
guide(PlugGuideD, PlugH - PlugGuideRetraction, GuideAngles[i], GuideWidths[i]);
}
}
2023-03-05 05:28:39 +00:00
}
2023-12-11 03:48:12 +00:00
translate([0, 0, -7]) cylinder(r = R(PlugD) - 0.5, h = PlugH, center = true);
translate([0, 0, -5]) plug_pin_voids(PinH);
2023-03-05 05:28:39 +00:00
}
2023-12-11 03:48:12 +00:00
}
2023-03-13 21:45:50 +00:00
2023-12-11 03:48:12 +00:00
module cpc_9pin_plug_insert () {
$fn = FN;
BaseH = 3;
2023-12-16 00:40:18 +00:00
PinH = PlugH + 10;
2023-12-11 03:48:12 +00:00
translate([0, 0, -5.75]) difference () {
union () {
2024-01-06 22:56:55 +00:00
cylinder(r = R(PlugD - 0.85), h = 6, center = true);
2023-12-11 03:48:12 +00:00
translate([0, 0, -1]) cylinder(r = R(PlugD + 2.5), h = 2, center = true);
color("green") translate([0, 0, -7]) cylinder(r = R(PlugD + 1.2), h = 10, center = true);
}
2023-12-16 00:40:18 +00:00
cylinder(r = R(PlugD - 2.6), h = 30, center = true);
translate([0, 0, -6]) plug_pin_voids(PinH);
2023-12-11 03:48:12 +00:00
}
2023-03-05 05:28:39 +00:00
}
2023-03-05 22:13:42 +00:00
module cpc_9pin_plug_collar () {
$fn = FN;
2023-12-11 03:48:12 +00:00
H = 10;
2023-12-16 00:40:18 +00:00
OuterD = 23;
CenterD = 17;
InnerD = 21;
LipD = 19;
2023-03-05 05:28:39 +00:00
difference () {
union () {
2023-12-16 00:40:18 +00:00
cylinder(r = R(OuterD), h = H, center = true);
2023-03-05 05:28:39 +00:00
}
2023-12-16 00:40:18 +00:00
cylinder(r = R(CenterD), h = H + 1, center = true);
cylinder(r = R(InnerD), h = H - 4, center = true);
translate([0, 0, H / 2]) cylinder(r = R(LipD), h = H, center = true);
//bevel
translate([0, 0, 3.49]) cylinder(r1 = R(InnerD), r2 = R(LipD), h = 1, center = true);
difference () {
translate([0, 0, 3.49]) cylinder(r = R(InnerD), h = 4, center = true);
translate([0, 0, 4]) cube([OuterD + 1, 3.9, 15], center = true);
}
2023-03-05 05:28:39 +00:00
}
}
2023-03-13 21:45:50 +00:00
module cpc_9pin_plug_back () {
$fn = FN;
RimD = PlugD + 4;
difference () {
union () {
cylinder(r = R(PlugD - 2.7), h = 15, center = true);
translate([0, 0, -2.5]) cylinder(r = R(RimD), h = 10, center = true);
translate([0, 0, -15 / 2]) sphere(r = R(RimD));
2024-01-09 18:54:01 +00:00
translate([0, 0, -15]) cylinder(r = R(10), h = 4, center = true);
}
//void
cylinder(r = R(PlugD - 5), h = 15 + 1, center = true);
translate([0, 0, -15 / 2]) sphere(r = R(PlugD - 5));
cylinder(r = R(5), h = 40, center = true);
}
2023-03-13 21:45:50 +00:00
}
2023-03-16 02:11:48 +00:00
module flange_guide_void (pos = [0, 0, 0], Z = 8) {
OD = 24;
2023-03-26 22:53:01 +00:00
ID = 19;
2023-12-11 03:48:12 +00:00
if (!DEBUG) {
translate(pos) {
intersection () {
difference () {
cylinder(r = R(OD), h = Z, center = true);
cylinder(r = R(ID), h = Z + 1, center = true);
}
union () {
translate([0, 0, 1]) cube([5, 25, Z], center = true);
translate([0, 0, -3]) rotate([7, 0, 0]) translate([(OD/2)-(5/2), OD/4, 0]) cube([OD, OD/2, 3], center = true);
translate([0, 0, -3]) rotate([-7, 0, 0]) translate([-(OD/2)+(5/2), -OD/4, 0]) cube([OD, OD/2, 3], center = true);
}
2023-03-16 02:11:48 +00:00
}
}
}
}
2023-03-05 05:28:39 +00:00
module cpc_9pin_socket () {
$fn = FN;
2023-03-26 22:53:01 +00:00
BaseH = 3;
2023-04-11 01:04:01 +00:00
BoltVoid = 26;
BackingH = 8;
BackingD = 17;
PinH = SocketH + BaseH + BackingH + 10;
2023-03-13 21:45:50 +00:00
difference () {
2023-03-27 00:19:00 +00:00
union () {
cylinder(r = R(SocketOuterD), h = SocketH + BaseH, center = true);
2023-04-11 01:04:01 +00:00
translate([0, 0, -((SocketH + BaseH) / 2) + (BaseH / 2)]) rounded_cube([34, 34, BaseH], d = 6, center = true, $fn = 40);
translate([0, 0, - (BaseH / 2) - BackingH]) cylinder(r = R(BackingD), h = BackingH, center = true);
2023-03-27 00:19:00 +00:00
}
2023-03-26 22:53:01 +00:00
translate([0, 0, BaseH]) {
cylinder(r = R(SocketD), h = SocketH + BaseH, center = true);
2023-03-13 21:45:50 +00:00
for (i = [0 : len(GuideAngles) - 1]) {
2023-03-26 22:53:01 +00:00
guide(SocketGuideD + 0.1, SocketH + BaseH, GuideAngles[i], GuideWidths[i] + 0.5);
2023-03-13 21:45:50 +00:00
}
}
2023-12-11 03:48:12 +00:00
socket_pin_voids(PinH);
2023-03-26 22:53:01 +00:00
translate([0, 0, 3]) rotate([0,0, 37]) flange_guide_void([0, 0, (PlugH / 2) - (8 / 2) + 0.01], 8);
2023-03-27 00:19:00 +00:00
translate([0, 0, -((SocketH + BaseH) / 2) + (BaseH / 2)]) {
m3_bolt_void([BoltVoid/2, BoltVoid/2, 0], BaseH + 1);
m3_bolt_void([BoltVoid/2, -BoltVoid/2, 0], BaseH + 1);
m3_bolt_void([-BoltVoid/2, BoltVoid/2, 0], BaseH + 1);
m3_bolt_void([-BoltVoid/2, -BoltVoid/2, 0], BaseH + 1);
}
2023-03-13 21:45:50 +00:00
}
}
2023-03-05 05:28:39 +00:00
2023-03-13 21:45:50 +00:00
module debug () {
2023-12-11 03:48:12 +00:00
//cpc_9pin_plug();
2023-03-05 05:28:39 +00:00
difference () {
union () {
2023-12-16 00:40:18 +00:00
//color("green") translate([0, 0, 2.1]) rotate([180, 0, 0]) cpc_9pin_socket();
2023-12-11 03:48:12 +00:00
cpc_9pin_plug_insert();
translate([0, 0, -5]) cpc_9pin_plug_collar();
translate([0, 0, -20.5]) cpc_9pin_plug_back();
2023-03-05 05:28:39 +00:00
}
2023-03-13 21:45:50 +00:00
translate([25, 0, 0]) cube([50, 50, 100], center = true);
2023-03-05 05:28:39 +00:00
}
}
2024-01-09 18:54:01 +00:00
PART = "9pin_plug";
2023-12-16 00:40:18 +00:00
2023-08-21 23:31:20 +00:00
if (PART == "9pin_plug") {
rotate([180, 0, 0]) cpc_9pin_plug();
2023-12-11 03:48:12 +00:00
} else if (PART == "9pin_plug_insert") {
cpc_9pin_plug_insert();
2023-08-21 23:31:20 +00:00
} else if (PART == "9pin_plug_collar") {
2023-03-05 22:13:42 +00:00
cpc_9pin_plug_collar();
} else if (PART == "9pin_plug_back") {
2024-01-09 18:54:01 +00:00
rotate([180, 0, 0]) cpc_9pin_plug_back();
2023-08-21 23:31:20 +00:00
} else if (PART == "9pin_socket") {
2023-03-05 05:28:39 +00:00
cpc_9pin_socket();
2023-03-13 21:45:50 +00:00
} else {
debug();
2023-08-21 23:38:16 +00:00
}