]> git.scottworley.com Git - tattlekey/blobdiff - housing/tattlekey.scad
housing: Basic shape
[tattlekey] / housing / tattlekey.scad
index f117e2770eacac7f7ecd4d3f91058bc232cb2fe7..c6b0e734819c644bf4ee6bd806f912368cb4d32a 100644 (file)
@@ -1,21 +1,23 @@
 use <cherryVoid.scad>
 
-key_interface_size = 19;
+key_interface_size = 18;
 key_interface_corner_r = 5;
+key_interface_thickness = 1.484;
 
-housing_inner_h = 10; // Chosen to let board fit inside
+housing_inner_h = 8; // Chosen to let board fit inside
 housing_inner_w = 21;
 
 thickness = 1.7;
 
 wiring_l = 12;
+extra_flare = wiring_l;
 
 pico_board_l = 51.0;
 pico_board_w = 21.0;
 pico_total_h = 3.7;
 
 $fs = .1;
-$fa = 6;
+$fa = 3;
 
 slop = 128;
 epsilon = 1/64;
@@ -25,7 +27,9 @@ module pico_hole(d, x, y) {
     cylinder(h=slop, d = d);
 }
 
-module pico_w(hole_d = 2.1) {    
+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_h = 1.0;
@@ -80,12 +84,12 @@ module at_key() {
     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);
-        circle(r=key_interface_corner_r);
+        circle(r=key_interface_corner_r + outline);
     }
 }
 
@@ -94,37 +98,63 @@ module key_interface() {
     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(length = pico_board_l) {
+module housing_shape(outline = thickness) {
     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;
+    housing_w = housing_inner_w + 2 * outline;
+    housing_h = housing_inner_h + 2 * outline;
+    squish = housing_h / housing_w;
+
+    scale([1, squish])
+    circle(d = housing_w);
+}
+
+module housing(length = pico_board_l - extra_flare) {
     rotate([90, 0, 0])
     rotate([0, 90, 0])
     linear_extrude(length)
     difference() {
-        scale([1, outer_squish])
-        circle(d = housing_outer_w);
-        scale([1, inner_squish])
-        circle(d = housing_inner_w);
+        housing_shape();
+        housing_shape(0);
     }
 }
 
-/*
-!union() {housing(); hull() {
-    at_key() key_interface_shape(epsilon);
-    translate([pico_board_l-wiring_l, 0, 0])
-    housing(wiring_l);
-}}
-*/
+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);
+    }
+}
 
-translate([0, -pico_board_w/2, -1])
-pico_w(hole_d = 2);
+module flare() {
+    difference() {
+        flare_shape(thickness, 0);
+        flare_shape(0, epsilon);
+    }
+}
+
+module tattlekey_case() {
+    key_interface();
+
+    difference() {
+        union() {
+            housing();
+            flare();
+        }
+        translate([0, -pico_board_w/2, -1])
+        pico_w();
+    }
+}
 
-key_interface();
-housing();
+tattlekey_case();