case.scad: version for bigger microswitch
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 3 Feb 2014 15:47:46 +0000 (16:47 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Mon, 3 Feb 2014 15:49:16 +0000 (16:49 +0100)
- also the "+" and "-" signs inside swapped,
- added + and - labels to buttons

case.scad

index f96549a..596b0da 100644 (file)
--- a/case.scad
+++ b/case.scad
@@ -19,6 +19,7 @@ pcb_len = 36 + 1;     // length of the board
 pcb_width = 11 + 0.5;  // width of the board
 pcb_thick = 1.2 + 0.3;         // thickness of the board
 pcb_comp_h = 2.2;      // height of the components on board
+pcb_comp_h2 = 4.5;     // height of the components on board - component side
 pcb_groove = 1;
 
 body_top_h = 0.35 * batt_diam; // cube-shaped part of the body
@@ -30,7 +31,8 @@ batt_end_h = wire_sep/2 + wire_thick/2 + 1.5;;
 
 lid_sep = 0.2; // the lid is made this much smaller to separate from the body
 
-sw_diam = 2.5 + 0.5;
+// sw_diam = 2.5 + 0.5;
+sw_diam = 3.5 + 0.5;
 led_diam = 3 + 0.5;
 sw_xoff =  250 * 25.4/1000; // x offset of microswitches
 pcb_xoff = 90 * 25.4/1000; // offset of the LED from the middle of the PCB
@@ -66,13 +68,13 @@ module case_body() {
                };
                translate([-front_flat_len/2,
                        batt_diam/2 - pcb_width,
-                       -batt_diam/2-2*pcb_comp_h-pcb_thick-wall])
+                       -batt_diam/2-pcb_comp_h-pcb_comp_h2-pcb_thick-wall])
                        cube([front_flat_len, pcb_width+wall, eps]);
        };
        // mounting cylinders
        for (x = [-1, 1]) translate([x*(batt_len/2-mounthole_w/2),
                batt_diam/2+wall, 0]) {
-                       translate([0, 0, -batt_diam/2-wall-2*pcb_comp_h-pcb_thick])
+                       translate([0, 0, -batt_diam/2-wall-pcb_comp_h-pcb_comp_h2-pcb_thick])
                                mount_cyl(); // front
                        translate([0, 0, body_top_h]) // rear
                                scale([1, 1, -1])
@@ -121,23 +123,29 @@ module case() {
                        -pcb_width+batt_diam/2,
                        -batt_diam/2-outcable_h])
                        cube([outcable_w, infty, outcable_h]);
-               // hole under the PCB
+               // hole under the PCB (groove)
                translate([-pcb_len/2+pcb_groove-pcb_xoff,
                        batt_diam/2-pcb_width + pcb_groove,
-                       -batt_diam/2-pcb_thick - 2*pcb_comp_h])
+                       -batt_diam/2-pcb_thick - pcb_comp_h - pcb_comp_h2])
                        cube([pcb_len-2*pcb_groove, pcb_width-2*pcb_groove,
-                               batt_diam/2 + pcb_thick + pcb_comp_h + eps]);
+                               batt_diam/2 + pcb_thick + pcb_comp_h2 + eps]);
+               // hole under the PCB (pcb-width)
+               translate([-pcb_len/2+2*pcb_groove-pcb_xoff,
+                       batt_diam/2-pcb_width,
+                       -batt_diam/2-pcb_thick - pcb_comp_h - pcb_comp_h2])
+                       cube([pcb_len-4*pcb_groove, pcb_width,
+                               batt_diam/2 + pcb_thick + pcb_comp_h2 + eps]);
                // hole for prog connector
                translate([pcb_len/2-pcb_xoff-pcb_groove-eps,
                        batt_diam/2-pcb_width/2-prg_width/2,
-                       -batt_diam/2-pcb_thick - 2*pcb_comp_h])
+                       -batt_diam/2-pcb_thick - pcb_comp_h - pcb_comp_h2])
                        difference() {
                                cube([prg_len+pcb_groove+eps, prg_width,
                                        batt_diam/2 + pcb_thick + pcb_comp_h + eps]);
-                               translate([prg_len/2+pcb_groove, -eps, pcb_comp_h])
+                               translate([prg_len/2+pcb_groove, -eps, pcb_comp_h2])
                                        cube([prg_len/2+eps, prg_width+2*eps, pcb_thick]);
                        };
-                // LED hole
+                // LED and button holes
                translate([0, batt_diam/2-pcb_width/2, -infty/2]) {
                        cylinder(r=led_diam/2, h=infty, $fn=6);
                        translate([sw_xoff, 0, 0])
@@ -181,7 +189,7 @@ module case() {
                                -batt_diam/2-pcb_comp_h-pcb_thick])
                                cube([wall + eps, pcb_width, eps]);
                        translate([0, batt_diam/2 - pcb_width + 0.5*wall,
-                               -batt_diam/2-2*pcb_comp_h-pcb_thick])
+                               -batt_diam/2-pcb_comp_h-pcb_comp_h2-pcb_thick])
                                cube([wall + eps, pcb_width-0.5*wall, eps]);
                };
                // inner hole behind the battery contacts
@@ -205,15 +213,23 @@ module case() {
                        cylinder(r = mounthole_w/2, h = infty);
                // grabbing gap
                for(x=[-1,1]) scale([x, 1, 1])
-               translate([batt_len/2+cable_sep+wall+10, batt_diam/2-pcb_width/2, -batt_diam/2-2*pcb_comp_h-pcb_thick-wall-eps])
+               translate([batt_len/2+cable_sep+wall+10, batt_diam/2-pcb_width/2, -batt_diam/2-pcb_comp_h-pcb_comp_h2-pcb_thick-wall-eps])
                        cylinder(r1 = 10, r2 = 10 - wall, h = wall + 2*eps);
-               // plus sign - vertical line
-               translate([batt_len/2 - 1.5*wall-plus_width/2, -plus_width/2, -batt_diam/2-wall])
+               // internal plus sign - vertical line
+               translate([-batt_len/2 + 0.5*wall+plus_width/2, -plus_width/2, -batt_diam/2-wall])
                        cube([wall, plus_width, infty]);
-               // plus and minus signs - horizontal line
+               // internal plus and minus signs - horizontal line
                for(x=[-1,1]) scale([x, 1, 1])
                translate([batt_len/2 - wall - plus_width, -wall/2, -batt_diam/2-wall])
                        cube([plus_width, wall, infty]);
+               // button + label
+               scale([-1, 1, 1])
+               translate([sw_xoff + sw_diam/2 + wall/2 + plus_width/2, batt_diam/2-pcb_width/2-plus_width/2, -batt_diam/2-pcb_thick-pcb_comp_h-pcb_comp_h2-wall-eps])
+                       cube([wall, plus_width, wall/2]);
+               // button +/- label - horizontal line
+               for (x=[-1, 1]) scale([x, 1, 1])
+               translate([sw_xoff + sw_diam/2 + wall, batt_diam/2-pcb_width/2-wall/2, -batt_diam/2-pcb_thick-pcb_comp_h-pcb_comp_h2-wall-eps])
+                       cube([plus_width, wall, wall/2]);
        };
        // clip barrier
        for (x = [-1, 1]) scale([x, 1, 1]) hull () {
@@ -247,7 +263,7 @@ module lid_body() {
                        rotate([0, 90, 0])
                                cylinder(r = batt_diam/2-lid_sep, h = wall-lid_sep);
                        translate([-clip_pretension, batt_diam/2 - pcb_width + 0.5*wall + lid_sep,
-                               batt_diam/2+2*pcb_comp_h+pcb_thick-lid_sep])
+                               batt_diam/2+pcb_comp_h+pcb_comp_h2+pcb_thick-lid_sep])
                                cube([wall+clip_pretension, pcb_width-0.5*wall-1.5*lid_sep, eps]);
                };
        // outer part of the clip behind the battery contacts
@@ -264,7 +280,7 @@ module lid_body() {
                };
                translate([-clip_pretension,
                        batt_diam/2 - pcb_width,
-                       batt_diam/2+2*pcb_comp_h+pcb_thick+wall])
+                       batt_diam/2+pcb_comp_h+pcb_comp_h2+pcb_thick+wall])
                        cube([wall-lid_sep, pcb_width+wall, eps]);
        };
 };
@@ -302,7 +318,7 @@ if (lowres) {
        translate([0, 15, 0]) case();
        translate([0, -15, 0]) rotate([180, 0, 0]) lid();
 } else {
-       translate([0, 15, batt_diam/2+pcb_thick+2*pcb_comp_h+wall])
+       translate([0, 15, batt_diam/2+pcb_thick+pcb_comp_h+pcb_comp_h2+wall])
                case($fn=128);
        translate([0, -15, batt_diam/2+wall])
                lid($fn=128);