]> git.scottworley.com Git - tattlekey/blobdiff - housing/tattlekey.scad
More description. Images
[tattlekey] / housing / tattlekey.scad
index f117e2770eacac7f7ecd4d3f91058bc232cb2fe7..1f5ea4c0709e41051971179d6eae28318a52a25c 100644 (file)
@@ -1,21 +1,29 @@
 use <cherryVoid.scad>
 
 use <cherryVoid.scad>
 
-key_interface_size = 19;
+key_interface_size = 18;
 key_interface_corner_r = 5;
 key_interface_corner_r = 5;
+key_interface_thickness = 1.484;
 
 
-housing_inner_h = 10; // Chosen to let board fit inside
+// Chosen to let board fit inside
+housing_inner_h = 6;
 housing_inner_w = 21;
 housing_inner_w = 21;
+housing_flat = 8;
+housing_extra_l = 10;
 
 thickness = 1.7;
 
 
 thickness = 1.7;
 
+board_gap = 0.125;
+
 wiring_l = 12;
 wiring_l = 12;
+extra_flare = wiring_l;
 
 pico_board_l = 51.0;
 pico_board_w = 21.0;
 
 pico_board_l = 51.0;
 pico_board_w = 21.0;
+pico_board_h = 1.0;
 pico_total_h = 3.7;
 
 $fs = .1;
 pico_total_h = 3.7;
 
 $fs = .1;
-$fa = 6;
+$fa = 3;
 
 slop = 128;
 epsilon = 1/64;
 
 slop = 128;
 epsilon = 1/64;
@@ -25,10 +33,16 @@ module pico_hole(d, x, y) {
     cylinder(h=slop, d = d);
 }
 
     cylinder(h=slop, d = d);
 }
 
-module pico_w(hole_d = 2.1) {    
+module pico_board(length = pico_board_l, gap = 0) {
+    translate([-gap - length + pico_board_l, 0, -gap])
+    cube([length + 2*gap, pico_board_w, pico_board_h + 2*gap]);
+}
+
+module pico_w(hole_d = 2.1) {
+    // Dimensions from measuring and/or
+    // https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf
     board_l = pico_board_l;
     board_w = pico_board_w;
     board_l = pico_board_l;
     board_w = pico_board_w;
-    board_h = 1.0;
     
     hole_x1 = 2.0;
     hole_x2 = board_l - 2.0;
     
     hole_x1 = 2.0;
     hole_x2 = board_l - 2.0;
@@ -37,7 +51,7 @@ module pico_w(hole_d = 2.1) {
     
     difference() {
         color("green")
     
     difference() {
         color("green")
-        cube([board_l, board_w, board_h]);
+        pico_board();
 
         pico_hole(hole_d, hole_x1, hole_y);
         pico_hole(hole_d, hole_x2, hole_y);
 
         pico_hole(hole_d, hole_x1, hole_y);
         pico_hole(hole_d, hole_x2, hole_y);
@@ -80,12 +94,12 @@ module at_key() {
     children();
 }
 
     children();
 }
 
-module key_interface_shape(thick = thickness) {
+module key_interface_shape(thick = key_interface_thickness, outline = thickness) {
     inner = key_interface_size - 2*key_interface_corner_r;
     linear_extrude(thick)
     minkowski() {
         square([inner, inner], center=true);
     inner = key_interface_size - 2*key_interface_corner_r;
     linear_extrude(thick)
     minkowski() {
         square([inner, inner], center=true);
-        circle(r=key_interface_corner_r);
+        circle(r=key_interface_corner_r + outline);
     }
 }
 
     }
 }
 
@@ -94,37 +108,79 @@ module key_interface() {
     difference() {
         key_interface_shape();
         
     difference() {
         key_interface_shape();
         
-        #translate([0, 0, 6 - epsilon])
-        cherry_switch_void();
+        translate([0, 0, 6 - epsilon])
+        cherry_switch_void(tolerance=0.05);
+    }
+}
+
+module housing_shape(outline = thickness) {
+    housing_w = housing_inner_w + 2 * outline;
+    housing_h = housing_inner_h + 2 * outline;
+    squish = housing_h / (housing_w - housing_flat);
+
+    scale([1, squish])
+    minkowski() {
+        circle(d = housing_w - housing_flat);
+        square([housing_flat, epsilon], center=true);
     }
 }
 
     }
 }
 
-module housing(length = pico_board_l) {
-    inner_squish = housing_inner_h / housing_inner_w;
-    housing_outer_w = housing_inner_w + 2 * thickness;
-    housing_outer_h = housing_inner_h + 2 * thickness;
-    outer_squish = housing_outer_h / housing_outer_w;
+module housing() {
+    length = pico_board_l - extra_flare;
+    translate([-housing_extra_l, 0, 0])
     rotate([90, 0, 0])
     rotate([0, 90, 0])
     rotate([90, 0, 0])
     rotate([0, 90, 0])
-    linear_extrude(length)
+    linear_extrude(length + housing_extra_l)
+    difference() {
+        housing_shape();
+        housing_shape(0);
+    }
+}
+
+module flare_shape(outline, extra_len) {
+    hull() {
+        at_key()
+        key_interface_shape(epsilon + extra_len, outline);
+        translate([pico_board_l-extra_flare, 0, 0])
+
+        translate([-extra_len, 0, 0])
+        rotate([90, 0, 0])
+        rotate([0, 90, 0])
+        linear_extrude(epsilon+extra_len)
+        housing_shape(outline);
+    }
+}
+
+module flare() {
+    difference() {
+        flare_shape(thickness, 0);
+        flare_shape(0, epsilon);
+    }
+}
+
+module at_board() {
+    translate([0, -pico_board_w/2, -pico_board_h])
+    children();
+}
+
+module tattlekey_case() {
+    key_interface();
+
     difference() {
     difference() {
-        scale([1, outer_squish])
-        circle(d = housing_outer_w);
-        scale([1, inner_squish])
-        circle(d = housing_inner_w);
+        union() {
+            housing();
+            flare();
+        }
+        at_board()
+        pico_board(slop, board_gap);
     }
 }
 
     }
 }
 
-/*
-!union() {housing(); hull() {
-    at_key() key_interface_shape(epsilon);
-    translate([pico_board_l-wiring_l, 0, 0])
-    housing(wiring_l);
-}}
-*/
+module preview() {
+    at_board() pico_w();
+    render() tattlekey_case();
+}
 
 
-translate([0, -pico_board_w/2, -1])
-pico_w(hole_d = 2);
+//preview();
 
 
-key_interface();
-housing();
+tattlekey_case();