]> git.scottworley.com Git - tattlekey/blob - housing/tattlekey.scad
f117e2770eacac7f7ecd4d3f91058bc232cb2fe7
[tattlekey] / housing / tattlekey.scad
1 use <cherryVoid.scad>
2
3 key_interface_size = 19;
4 key_interface_corner_r = 5;
5
6 housing_inner_h = 10; // Chosen to let board fit inside
7 housing_inner_w = 21;
8
9 thickness = 1.7;
10
11 wiring_l = 12;
12
13 pico_board_l = 51.0;
14 pico_board_w = 21.0;
15 pico_total_h = 3.7;
16
17 $fs = .1;
18 $fa = 6;
19
20 slop = 128;
21 epsilon = 1/64;
22
23 module pico_hole(d, x, y) {
24 translate([x, y, -slop/2])
25 cylinder(h=slop, d = d);
26 }
27
28 module pico_w(hole_d = 2.1) {
29 board_l = pico_board_l;
30 board_w = pico_board_w;
31 board_h = 1.0;
32
33 hole_x1 = 2.0;
34 hole_x2 = board_l - 2.0;
35 hole_y_spacing = 11.4;
36 hole_y = (board_w - hole_y_spacing)/2;
37
38 difference() {
39 color("green")
40 cube([board_l, board_w, board_h]);
41
42 pico_hole(hole_d, hole_x1, hole_y);
43 pico_hole(hole_d, hole_x2, hole_y);
44 pico_hole(hole_d, hole_x1, hole_y + hole_y_spacing);
45 pico_hole(hole_d, hole_x2, hole_y + hole_y_spacing);
46
47 }
48
49 total_l = 52.3;
50 total_h = pico_total_h;
51 usb_w = 8.0;
52 usb_l = 5.6;
53 usb_h = 3.0;
54 color("lightgray")
55 translate([board_l - total_l, (board_w-usb_w)/2, total_h-usb_h])
56 cube([usb_l, usb_w, usb_h]);
57
58 button_l = 4.2;
59 button_w = 3.4;
60 button_h = 3.5;
61 button_x = 9.9;
62 button_y = 5.2;
63 color("white")
64 translate([button_x, button_y, epsilon])
65 cube([button_l, button_w, button_h]);
66
67 wifi_l = 10.0;
68 wifi_w = 12.0;
69 wifi_h = 2.8;
70 wifi_x = 33.0;
71 color("lightgray")
72 translate([wifi_x, (board_w-wifi_w)/2, epsilon])
73 cube([wifi_l, wifi_w, wifi_h]);
74 }
75
76 module at_key() {
77 translate([pico_board_l + wiring_l, 0, 0])
78 rotate([45, 0, 0])
79 rotate([0, 90, 0])
80 children();
81 }
82
83 module key_interface_shape(thick = thickness) {
84 inner = key_interface_size - 2*key_interface_corner_r;
85 linear_extrude(thick)
86 minkowski() {
87 square([inner, inner], center=true);
88 circle(r=key_interface_corner_r);
89 }
90 }
91
92 module key_interface() {
93 at_key()
94 difference() {
95 key_interface_shape();
96
97 #translate([0, 0, 6 - epsilon])
98 cherry_switch_void();
99 }
100 }
101
102 module housing(length = pico_board_l) {
103 inner_squish = housing_inner_h / housing_inner_w;
104 housing_outer_w = housing_inner_w + 2 * thickness;
105 housing_outer_h = housing_inner_h + 2 * thickness;
106 outer_squish = housing_outer_h / housing_outer_w;
107 rotate([90, 0, 0])
108 rotate([0, 90, 0])
109 linear_extrude(length)
110 difference() {
111 scale([1, outer_squish])
112 circle(d = housing_outer_w);
113 scale([1, inner_squish])
114 circle(d = housing_inner_w);
115 }
116 }
117
118 /*
119 !union() {housing(); hull() {
120 at_key() key_interface_shape(epsilon);
121 translate([pico_board_l-wiring_l, 0, 0])
122 housing(wiring_l);
123 }}
124 */
125
126 translate([0, -pico_board_w/2, -1])
127 pico_w(hole_d = 2);
128
129 key_interface();
130 housing();