add stuff

This commit is contained in:
Triss 2021-09-18 01:46:00 +02:00
commit 96c1ddfbba
4 changed files with 261 additions and 0 deletions

7
README.md Normal file
View File

@ -0,0 +1,7 @@
# cad
Some CAD stuff I made for 3D printing etc
## usbuart-case
Case/shell for https://github.com/thequux/usb-uart , made in OpenSCAD.

1
usbuart-case/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.stl

View File

@ -0,0 +1,253 @@
pcb_width = 33.5;
pcb_length = 85.6;
pcb_thickness = 1.6;
thread_diameter = 2.6752404735808355; // Dp of coarse M3
hole_diameter = 3.2;
raise_diameter = 5.2;
hole1_xoff = 4.254;
hole1_yoff = 4.841;
hole2_xoff = pcb_width - 4.191;
hole2_yoff = hole1_yoff;
hole3_xoff = hole1_xoff;
hole3_yoff = pcb_length - 4.757;
hole4_xoff = pcb_width - 4.274;
hole4_yoff = hole3_yoff;
outer_spacing = 1.5;
outer_thickness = 1.5;
groove_width = 1;
groove_thickness = 1;
case_height_total = 6;
case_height_inner = case_height_total - outer_thickness;
j1_xoff = 12.676;//12.696;
j1_width = 8.128;
j1_height = 3+pcb_thickness;
sw1_yoff = 11.052;
sw1_width = 12.7;
sw1_height = 5+pcb_thickness;
j3_yoff = sw1_yoff + sw1_width + 11.43;
j3_width = 6.223;
j3_height = 2.54+pcb_thickness;
j8_xoff = 7.977;//9.140;
j8_width = 16.383;
j8_height = j3_height;
j2_width = 16.29;
j2_length = 9.9;
j2_xoff = 8.116;
j2_yoff = pcb_length - 11.536 - j2_length;
j7_width = 6.15;
j7_length = j7_width;
j7_xoff = 13.192;
j7_yoff = j2_yoff - 3.156 - j7_length;
j456_width = 8.68;
j456_length = 11.2;
j456_xoff = 11.926;
j456_yoff = j7_yoff - 1.236 - j456_length;
// pcb
%linear_extrude(pcb_thickness) square([pcb_width, pcb_length]);
// case etc
translate([0,0,0],$fn=40) difference() {
union() {
// outer shell
difference() {
minkowski() {
translate([0,0,-groove_width])
cube([pcb_width,pcb_length,case_height_inner+pcb_thickness+groove_width]);
sphere(r=outer_thickness);
}
translate([0,0,-case_height_inner*0.1-groove_width])
cube([pcb_width,pcb_length,case_height_inner*1.1+groove_width]);
translate([-outer_thickness,-outer_thickness,-pcb_thickness*1.1-groove_width])
cube([pcb_width+outer_thickness*2,pcb_length+outer_thickness*2,pcb_thickness*1.1]);
// informative text
translate([0,0,case_height_total+1.25]) {
linear_extrude(1) union() {
translate([j8_xoff+2.54,pcb_length-1.27]) rotate(90) union() {
translate([0,-2.54*0])text("A",size=2,halign="right");
translate([0,-2.54*1])text("GND",size=2,halign="right");
translate([0,-2.54*2])text("TXD",size=2,halign="right");
translate([0,-2.54*3])text("RXD",size=2,halign="right");
translate([0,-2.54*4])text("B",size=2,halign="right");
translate([0,-2.54*5])text("Vtgt",size=2,halign="right");
}
translate([j2_xoff,j2_yoff]) union() {
translate([-1.27,2.54*0.5])text("A",size=2,halign="right");
translate([-1.27,2.54*2.5])text("GND",size=2,halign="right");
translate([j2_width/2,-2.54])text("↑TXD↑",size=2,halign="center");
translate([j2_width/2,2.54*4])text("↓RXD↓",size=2,halign="center");
translate([j2_width+1.27,2.54*0.5])text("B",size=2);
translate([j2_width+1.27,2.54*2.5])text("Vtgt",size=2);
}
translate([j7_xoff-1.27*0.5,j7_yoff+1.27])
text("swapped||",size=2,halign="right");
translate([j7_xoff-1.27*0.5,j7_yoff+2.54+1.27])
text("normal=",size=2,halign="right");
translate([j456_xoff-2.54*3,j456_yoff+2.54*1.8])
text("A",size=4,halign="right");
translate([j456_xoff+j456_width+2.54*4.5,j456_yoff+2.54*1.8])
text("B",size=4,halign="right");
translate([j456_xoff-2.54*2.5,j456_yoff+1.27*0.5]) union() {
translate([0,2.55*0])text("DSR",size=2);
translate([0,2.55*1])text("CTS",size=2);
translate([0,2.55*2])text("DTR",size=2);
translate([-2.6,2.55*3])text("→RTS",size=2);
}
translate([j456_xoff+1.27+j456_width,j456_yoff+1.27*0.5]) union() {
translate([0,2.55*0])text("DSR",size=2);
translate([0,2.55*1])text("CTS←",size=2);
translate([0,2.55*2])text("DTR",size=2);
translate([0,2.55*3])text("RTS",size=2);
}
translate([pcb_width/2,j456_yoff-2.54*2.5]) union() {
translate([0,-2.54*0])text("USB UART case",size=2,halign="center");
translate([0,-2.54*1])text("© sys64738",size=2,halign="center");
translate([0,-2.54*2])text("For CH340 UART",size=2,halign="center");
translate([0,-2.54*3])text("PCB by TQ",size=2,halign="center");
translate([0,-2.54*5])text("OSHW: git.lain.faith",size=2,halign="center");
translate([0,-2.54*6])text("/sys64738/cad",size=2,halign="center");
}
translate([pcb_width/2,0]) text("USB",size=2,halign="center");
translate([pcb_width,sw1_yoff+sw1_width-3.5]) union() {
translate([0,-4*0])text("3V3",size=2,halign="right");
translate([0,-4*1])text("Ext",size=2,halign="right");
translate([0,-4*2])text("5V",size=2,halign="right");
}
translate([pcb_width,j3_yoff+j3_width-2.54]) union() {
translate([0,-2.54*0])text("-",size=2,halign="right");
translate([0,-2.54*1])text("+",size=2,halign="right");
translate([-2.54,-2.54*1.4])rotate(90)text("Vext",size=2);
}
}
}
}
// screw thingies
translate([0,0,pcb_thickness]) difference() {
// cylinders
union() {
// hole 1 bearing
translate([hole1_xoff,hole1_yoff])
cylinder(case_height_inner,d=raise_diameter);
// hole 2 bearing
translate([hole2_xoff,hole2_yoff])
cylinder(case_height_inner,d=raise_diameter);
// hole 3 bearing
translate([hole3_xoff,hole3_yoff])
cylinder(case_height_inner,d=raise_diameter);
// hole 4 bearing
translate([hole4_xoff,hole4_yoff])
cylinder(case_height_inner,d=raise_diameter);
}
// thread holes
translate([0,0,-0.1]) union() {
translate([hole1_xoff,hole1_yoff])
cylinder(case_height_inner+0.1,d=thread_diameter);
// hole 2 bearing
translate([hole2_xoff,hole2_yoff])
cylinder(case_height_inner+0.1,d=thread_diameter);
// hole 3 bearing
translate([hole3_xoff,hole3_yoff])
cylinder(case_height_inner+0.1,d=thread_diameter);
// hole 4 bearing
translate([hole4_xoff,hole4_yoff])
cylinder(case_height_inner+0.1,d=thread_diameter);
}
}
}
// hole: J1
translate([j1_xoff,-5,-0.1-groove_width])
cube([j1_width, 10, j1_height+0.1+groove_width]);
// hole: SW1
translate([pcb_width-4,sw1_yoff,-0.1-groove_width])
cube([8, sw1_width, sw1_height+0.1+groove_width]);
// hole: J3
translate([pcb_width-2.54,j3_yoff,-0.1-groove_width])
cube([2.54*2, j3_width, j3_height+0.1+groove_width]);
// hole: J8
translate([j8_xoff,pcb_length-2.54,-0.1-groove_width])
cube([j8_width, 2.54*2, j8_height+0.1+groove_width]);
// hole: J2
translate([j2_xoff,j2_yoff,case_height_total/2])
cube([j2_width,j2_length,case_height_total]);
// hole: J7
translate([j7_xoff,j7_yoff,case_height_total/2])
cube([j7_width,j7_length,case_height_total]);
// hole: J4..6
translate([j456_xoff,j456_yoff,case_height_total/2])
cube([j456_width,j456_length,case_height_total]);
}
// bottom & pcb holder
translate([0,0,-groove_thickness],$fn=40) difference() {
union() {
// pcb holder
linear_extrude(groove_thickness) difference() {
square([pcb_width, pcb_length]);
translate([groove_width,groove_width])
square([pcb_width-groove_width*2,pcb_length-groove_width*2]);
}
// hole 1 bearing
translate([hole1_xoff,hole1_yoff]) cylinder(groove_thickness,d=raise_diameter);
// hole 2 bearing
translate([hole2_xoff,hole2_yoff]) cylinder(groove_thickness,d=raise_diameter);
// hole 3 bearing
translate([hole3_xoff,hole3_yoff]) cylinder(groove_thickness,d=raise_diameter);
// hole 4 bearing
translate([hole4_xoff,hole4_yoff]) cylinder(groove_thickness,d=raise_diameter);
// bottom plane
translate([0,0,-outer_thickness])
linear_extrude(outer_thickness) {
minkowski() {
square([pcb_width,pcb_length]);
circle(r=outer_spacing);
}
}
}
// holes for screws
translate([0,0,-2]) union() {
// hole 1 bearing
translate([hole1_xoff,hole1_yoff]) cylinder(5,d=hole_diameter);
translate([hole2_xoff,hole2_yoff]) cylinder(5,d=hole_diameter);
translate([hole3_xoff,hole3_yoff]) cylinder(5,d=hole_diameter);
translate([hole4_xoff,hole4_yoff]) cylinder(5,d=hole_diameter);
}
// space for screw heads
translate([0,0,-outer_thickness-0.01]) union() {
// hole 1 bearing
translate([hole1_xoff,hole1_yoff])
cylinder(outer_thickness*0.75,d=raise_diameter*1.25);
translate([hole2_xoff,hole2_yoff])
cylinder(outer_thickness*0.75,d=raise_diameter*1.25);
translate([hole3_xoff,hole3_yoff])
cylinder(outer_thickness*0.75,d=raise_diameter*1.25);
translate([hole4_xoff,hole4_yoff])
cylinder(outer_thickness*0.75,d=raise_diameter*1.25);
}
}

Binary file not shown.