Skip to content

Instantly share code, notes, and snippets.

@kortschak
Last active September 1, 2019 12:35
Show Gist options
  • Save kortschak/3c1542a40ce4737b88416f9fb5dc7248 to your computer and use it in GitHub Desktop.
Save kortschak/3c1542a40ce4737b88416f9fb5dc7248 to your computer and use it in GitHub Desktop.
devkit_bottomup.scad from https://emdete.de/l5/devkit_bottomup.scad
/*
Upside-down approach for a devkit case: The devkit is put
in from behind, display first. So all components
(batteryholder, cam, ...) are freely reachable and
sensitive parts (like TS-connector) are covered. And the
processor heat can be taken care of as it's just open - a
fan can be mounted.
The idea is to plug the devkit in and put some hot glue
to the corners to fix it or screw it to the risers.
*/
$fn=40;
module centered_cube(x, y, z) {
translate([-x/2, -y/2, 0]) cube([x, y, z]);
}
inf = 200; //
border = 3; // case border width
case_rounded = 2;
display_height = 2; //
display_width = 70+1;
display_length = 147+1;
display_rounded = 6;
pcb_width = 90;
pcb_length = 180;
pcb_tol = 2;
pcb_distance = 6; // from display surface
pcb_thick = 1;
screw_diameter = 1.5;
reset_pos = 130;
power_pos = 61;
vol_up_pos = 82;
vol_down_pos = 98;
buttons_pos = [85, 95, 105, 122];
show_board = false;
case();
if (show_board) {
#translate([0, 0, pcb_distance+0.1]) {
centered_cube(90, 180, 1.2);
let(dx = pcb_width/2 - 1, dy = pcb_length/2) {
// Switch bt, wifi, mic/cam, bootmode:
for (y = buttons_pos) {
translate([dx-1, dy-y, -4]) {
centered_cube(4, 9.5, 4);
translate([2, 0, 0]) centered_cube(2, 4, 1.5);
}
}
// Button reset:
translate([dx, dy-reset_pos, pcb_thick]) centered_cube(2, 3, 2);
// Button power:
translate([-dx, dy-power_pos, pcb_thick]) centered_cube(2, 3, 2);
// Button speaker up:
translate([-dx, dy-vol_up_pos, pcb_thick]) centered_cube(2, 3, 2);
// Button speaker down:
translate([-dx, dy-vol_down_pos, pcb_thick]) centered_cube(2, 3, 2);
}
}
}
module case() {
difference() {
minkowski() {
sphere(r = case_rounded);
difference() {
translate([0, 0, case_rounded]) centered_cube((pcb_width+pcb_tol)+2*(border-case_rounded), (pcb_length+pcb_tol)+2*(border-case_rounded), 30-2*case_rounded);
minkowski() {
sphere(r = 12);
translate([0, 0, 30]) cube([100, 40, 1], center=true);
}
}
}
difference() {
union() {
// display
translate([0, 0, -inf/2]) minkowski(){
cylinder(inf, display_rounded, display_rounded);
centered_cube(display_width-2*display_rounded, display_length-2*display_rounded, inf);
}
// pcb
translate([0, 0, display_height]) centered_cube((pcb_width+pcb_tol), (pcb_length+pcb_tol), inf);
// bottom holes
let(dx = pcb_width/2, dy = pcb_length/2, dz = pcb_distance + pcb_thick) {
// headphonejack
translate([dx-15.5, -dy-pcb_tol/2, dz+3]) rotate([90, 0, 0]) cylinder(inf, 4, 4);
translate([dx-15.5, -dy-pcb_tol/2, dz]) centered_cube(12, 4, inf);
// ethernet
translate([dx-30, -dy, dz]) centered_cube(16, inf, 14);
// HDMI:
// translate([dx-47, -dy, dz]) centered_cube(12, inf, 3);
// USB-C:
translate([dx-59, -dy, dz-(7-3)/2]) centered_cube(11, inf, 7);
// SD Card:
translate([dx-73, -dy, dz-0.5]) {
centered_cube(13, inf, 3);
translate([-13/2, -6.5, 3/2]) rotate(a=[0, 90, 0]) cylinder(r=border+2, h=13);
}
// SIM:
translate([-inf/2, dy-36, dz-0.5]) {
centered_cube(inf, 15, 3);
translate([inf/2-dx-6.5, 15/2, 3/2]) rotate(a=[90, 0, 0]) cylinder(r=border+2, h=15);
}
// Securecard:
translate([-inf/2, dy-152, dz]) {
centered_cube(inf, 18, 3);
translate([inf/2-dx-6.5, 18/2, 3/2]) rotate(a=[90, 0, 0]) cylinder(r=border+2, h=18);
}
}
// side holes
let(dx = pcb_width/2 + 2, dy = pcb_length/2, dz = pcb_distance-2-inf) {
// Switch bt, wifi, mic/cam, bootmode:
for (y = buttons_pos) {
translate([dx+3.5, dy-y, dz]) {
translate([0, 0, inf]) sphere(r=border+2);
cylinder(r=border+2, h=inf);
}
rotate(a=[0, -4, 0]) translate([dx, dy-y, 0]) centered_cube(2, 4, inf);
}
// Button reset:
translate([dx+5, dy-reset_pos, pcb_distance+2]) sphere(r=border+4);
// Button power:
translate([-dx-5, dy-power_pos, pcb_distance+2]) sphere(r=border+4);
// Button speaker up:
translate([-dx-5, dy-vol_up_pos, pcb_distance+2]) sphere(r=border+4);
// Button speaker down:
translate([-dx-5, dy-vol_down_pos, pcb_distance+2]) sphere(r=border+4);
}
// front holes
let(dz = -inf/2) {
// Ambient/proximity sensor:
translate([90/2-48, 76, dz]) hull()
for (off=[-1.75, 1.75])
translate ([off, 0, 0])
cylinder(h=inf, r=1);
// Speaker:
translate([90/2-52, 84, dz]) cylinder(h=inf, r=3);
// Microphone:
translate([90/2-44, -78, dz]) cylinder(h=inf, r=3);
}
}
union() {
// risers
let(dx = (pcb_width) / 2, dy = (pcb_length) / 2, r = border+2) {
// corners
origin = [dx, dy, 0];
for (pos = [[5.5, 5.5, 0], [84.5, 5.5, 0], [87, 172, 0]])
translate(pos-origin) difference() {
cylinder(r1=4, r2=3, h=pcb_distance);
union() {
cylinder(d=screw_diameter, h=inf);
translate([0, 0, pcb_distance-1]) cylinder(d1=screw_diameter, d2=2, h=1);
}
}
// middle
translate([dx+pcb_tol, 25, 0]) cylinder(r=r, h=pcb_distance);
translate([-dx-pcb_tol, -25, 0]) cylinder(r=r, h=pcb_distance);
translate([-dx-1, dy+1, 12]) rotate([0, 0, 45]) cube([8, 8, 2], center=true);
translate([-dx-1, dy+1, 0]) rotate([0, 0, 45]) cube([8, 8, pcb_distance*2], center=true);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment