X-Git-Url: http://git.scottworley.com/tattlekey/blobdiff_plain/dae35db78064b749ad7368b707bbe63489b9c838..7f78ee2745614bdf5db67f6d9bbccbe460b8186b:/housing/tattlekey.scad diff --git a/housing/tattlekey.scad b/housing/tattlekey.scad new file mode 100644 index 0000000..f117e27 --- /dev/null +++ b/housing/tattlekey.scad @@ -0,0 +1,130 @@ +use + +key_interface_size = 19; +key_interface_corner_r = 5; + +housing_inner_h = 10; // Chosen to let board fit inside +housing_inner_w = 21; + +thickness = 1.7; + +wiring_l = 12; + +pico_board_l = 51.0; +pico_board_w = 21.0; +pico_total_h = 3.7; + +$fs = .1; +$fa = 6; + +slop = 128; +epsilon = 1/64; + +module pico_hole(d, x, y) { + translate([x, y, -slop/2]) + cylinder(h=slop, d = d); +} + +module pico_w(hole_d = 2.1) { + 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_y_spacing = 11.4; + hole_y = (board_w - hole_y_spacing)/2; + + difference() { + color("green") + cube([board_l, board_w, board_h]); + + pico_hole(hole_d, hole_x1, hole_y); + pico_hole(hole_d, hole_x2, hole_y); + pico_hole(hole_d, hole_x1, hole_y + hole_y_spacing); + pico_hole(hole_d, hole_x2, hole_y + hole_y_spacing); + + } + + total_l = 52.3; + total_h = pico_total_h; + usb_w = 8.0; + usb_l = 5.6; + usb_h = 3.0; + color("lightgray") + translate([board_l - total_l, (board_w-usb_w)/2, total_h-usb_h]) + cube([usb_l, usb_w, usb_h]); + + button_l = 4.2; + button_w = 3.4; + button_h = 3.5; + button_x = 9.9; + button_y = 5.2; + color("white") + translate([button_x, button_y, epsilon]) + cube([button_l, button_w, button_h]); + + wifi_l = 10.0; + wifi_w = 12.0; + wifi_h = 2.8; + wifi_x = 33.0; + color("lightgray") + translate([wifi_x, (board_w-wifi_w)/2, epsilon]) + cube([wifi_l, wifi_w, wifi_h]); +} + +module at_key() { + translate([pico_board_l + wiring_l, 0, 0]) + rotate([45, 0, 0]) + rotate([0, 90, 0]) + children(); +} + +module key_interface_shape(thick = 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); + } +} + +module key_interface() { + at_key() + difference() { + key_interface_shape(); + + #translate([0, 0, 6 - epsilon]) + cherry_switch_void(); + } +} + +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; + 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); + } +} + +/* +!union() {housing(); hull() { + at_key() key_interface_shape(epsilon); + translate([pico_board_l-wiring_l, 0, 0]) + housing(wiring_l); +}} +*/ + +translate([0, -pico_board_w/2, -1]) +pico_w(hole_d = 2); + +key_interface(); +housing();