Skip to content

Commit

Permalink
feat(case): MCU and RJ45 cover
Browse files Browse the repository at this point in the history
  • Loading branch information
azzamsa committed Dec 3, 2024
1 parent b0e47ee commit b50d98b
Show file tree
Hide file tree
Showing 9 changed files with 223 additions and 11 deletions.
2 changes: 1 addition & 1 deletion case/cheapino-bottom-left.scad
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ step = 0.05;
// 2.5 will leave 0.35 at the thinnest(between hotswap and magsafe).


$fn=50;
$fn = $preview ? 10 : 50;

// Rotate so you dont need to do that in extruder
translate([0,0,2.5])
Expand Down
2 changes: 1 addition & 1 deletion case/cheapino-bottom-right.scad
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ step = 0.05;
// 2.5 will leave 0.35 at the thinnest(between hotswap and magsafe).


$fn=50;
$fn = $preview ? 10 : 50;

// Rotate so you dont need to do that in extruder
translate([0,0,2.5])
Expand Down
82 changes: 82 additions & 0 deletions case/cheapino-top-left-with-cover.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
height = 95.1738;
width = 132.6134;
step = 0.06;
$fn = $preview ? 10 : 50;

height_translation = 0;
include <modules.scad>

difference() {
case();
linear_extrude(4.1) offset(delta=0.45) base();

// For debug: comment out above 3 lines and comment in this
//translate([0,0,4.1])
// board();

translate([0,0,top_of_pcb]) switch_holes();

// Diodes
translate([0, 0, top_of_pcb]) diodes();

// RJ45 socket
color("cyan") {
translate([29.2, -10.6, 4.1])
linear_extrude(10)
square([30, 16.6]);

translate([45, -5.8, 2.5])
linear_extrude(10)
square([15, 7]);
}

mcu_cutout();
// mounting holes
mounting_hole_inserts();

}

// RJ45 socket cover
color("purple") {
difference() {
// x = front/back, y = left/right, z = top/down
// -0.8 is thickness of the back cover
// -10.6 is the initial size of left/right
// 8.1 is the start of the case
translate([29.2 + (-0.8), -10.6 - 2, 8.1])
// width = front/back, depth = left/right, height = top cover
// Add thickness of 4. 2 left 2 right.
// (reset mcu_height) + 2 is for top cover thickness
roundedcube([30 - 8, 16.6 + 4, rj45_height - 2], false, cover_radius, "xmax");

// To craete a hole, repeat the difference() for initial rj45
translate([29.2, -10.6, 8.1])
// 0.5 for tolerance
linear_extrude((rj45_height - 4.1) + 0.5)
square([30, 16.6]);
}
}

// MCU cover
color("green") {
difference() {
// x = left/right, y = front/back
// 8.1 is the start of the case
translate([29.5 - 1, 10.2 - 3, 8.1])
// To set the cube height
// width = left/right, height = front/back
// Add thickness of 3. 2 outer, 1 inner.
// (reset mcu_height) + 2 is for top cover thickness
roundedcube([19.5 + 3, 26 + 3, (mcu_height - 4.1) + 2], false, cover_radius, "xmax");

// To craete a hole, repeat the difference() for initial mcu cutout
translate([29.5, 10.2, 8.1])
linear_extrude(mcu_height - 3.1)
square([19.5, 25]);

// Repeat USB C port opening
translate([34.25, 25.2, 8.1])
linear_extrude(mcu_height - 3.1)
square([10, 20]);
}
}
5 changes: 1 addition & 4 deletions case/cheapino-top-left.scad
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
height = 95.1738;
width = 132.6134;
step = 0.06;
$fn=50;
$fn = $preview ? 10 : 50;

height_translation = 0;
include <modules.scad>
Expand Down Expand Up @@ -38,6 +38,3 @@ mcu_cutout();
mounting_hole_inserts();

}



79 changes: 79 additions & 0 deletions case/cheapino-top-right-with-cover.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
height = 95.1738;
width = 132.6134;
step = 0.06;
$fn = $preview ? 10 : 50;

height_translation = 0;
include <modules.scad>


mirror() {
difference() {
case();
linear_extrude(4.1) offset(delta=0.45) base();

// holes and shape for debug
//translate([0,0,4.1])
// board();

translate([0,0,top_of_pcb]) switch_holes();

// Diodes
translate([0, 0, top_of_pcb]) diodes();

// RJ45 socket
color("cyan") {
translate([29.2, -9.33, 4.1])
linear_extrude(10)
square([30, 16.6]);

translate([45, -4.53, 2.5])
linear_extrude(10)
square([15, 7]);
}

// EC11 encoder
color("pink") {
translate([32.75, 16.5, 4.1])
linear_extrude(10)
square(13);

translate([32.2, 15, 4.1])
linear_extrude(3)
square([14.2, 17.5]);
}

// solder bridge pads needs some space
color("red")
translate([29, -15.53, 4.1])
linear_extrude(2)
square([19.5, 3.5]);


mounting_hole_inserts();
}
}


mirror() {
// RJ45 socket cover
color("purple") {
difference() {
// x = front/back, y = left/right, z = top/down
// -0.8 is thickness of the back cover
// -9.33 is the initial size of left/right
// 8.1 is the intial value of the PCB
translate([29.2 + (-0.8), -9.33 - 2, 8.1])
// width = front/back, depth = left/right, height = top cover
// Add thickness of 4. 2 left 2 right.
// (reset mcu_height) + 2 is for top cover thickness
roundedcube([30 - 8, 16.6 + 4, (rj45_height - 4.1) + 2], false, cover_radius, "xmax");

// To craete a hole, repeat the difference() for initial rj45
translate([29.2, -9.33, 8.1])
// 0.5 for tolerance
linear_extrude((rj45_height - 4.1) + 0.5)
square([30, 16.6]);
}
}
}
2 changes: 1 addition & 1 deletion case/cheapino-top-right.scad
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
height = 95.1738;
width = 132.6134;
step = 0.06;
$fn=50;
$fn = $preview ? 10 : 50;

height_translation = 0;
include <modules.scad>
Expand Down
3 changes: 1 addition & 2 deletions case/cheapino.scad
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
height = 95.1738;
width = 132.6134;
step = 0.05;
$fn=30;
$fn = $preview ? 10 : 30;

height_translation = 0;

Expand Down Expand Up @@ -78,4 +78,3 @@ module base_line(expanded)
base();
}
}

55 changes: 55 additions & 0 deletions case/modules.scad
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ pcb_thickness = 1.6;
bottom_plate_thickness = 2.5;
top_of_pcb = bottom_plate_thickness + pcb_thickness;

cover_radius = 2;
rj45_height = 13;
mcu_height = 9; // mcu + hotswap

// bottom plate
module bottom()
Expand Down Expand Up @@ -411,3 +414,55 @@ module mcu_cutout() {
}
}

// More information: https://danielupshaw.com/openscad-rounded-corners/
// License: Unlicense
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;

translate_min = radius;
translate_xmax = size[0] - radius;
translate_ymax = size[1] - radius;
translate_zmax = size[2] - radius;

diameter = radius * 2;

obj_translate = (center == false) ?
[0, 0, 0] : [
-(size[0] / 2),
-(size[1] / 2),
-(size[2] / 2)
];

translate(v = obj_translate) {
hull() {
for (translate_x = [translate_min, translate_xmax]) {
x_at = (translate_x == translate_min) ? "min" : "max";
for (translate_y = [translate_min, translate_ymax]) {
y_at = (translate_y == translate_min) ? "min" : "max";
for (translate_z = [translate_min, translate_zmax]) {
z_at = (translate_z == translate_min) ? "min" : "max";

translate(v = [translate_x, translate_y, translate_z])
if (
(apply_to == "all") ||
(apply_to == "xmin" && x_at == "min") || (apply_to == "xmax" && x_at == "max") ||
(apply_to == "ymin" && y_at == "min") || (apply_to == "ymax" && y_at == "max") ||
(apply_to == "zmin" && z_at == "min") || (apply_to == "zmax" && z_at == "max")
) {
sphere(r = radius);
} else {
rotate =
(apply_to == "xmin" || apply_to == "xmax" || apply_to == "x") ? [0, 90, 0] : (
(apply_to == "ymin" || apply_to == "ymax" || apply_to == "y") ? [90, 90, 0] :
[0, 0, 0]
);
rotate(a = rotate)
cylinder(h = diameter, r = radius, center = true);
}
}
}
}
}
}
}
4 changes: 2 additions & 2 deletions case/plate.scad
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

$fn=100;
$fn = $preview ? 10 : 100;

height_translation = 0;

Expand All @@ -10,4 +10,4 @@ module plate()
}

linear_extrude(1.6)
plate();
plate();

0 comments on commit b50d98b

Please sign in to comment.