]> git.scottworley.com Git - tattlekey/blame - housing/tattlekey.scad
server: extract open_log_for_writing()
[tattlekey] / housing / tattlekey.scad
CommitLineData
7f78ee27
SW
1use <cherryVoid.scad>
2
859fd2d9 3key_interface_size = 18;
7f78ee27 4key_interface_corner_r = 5;
859fd2d9 5key_interface_thickness = 1.484;
7f78ee27 6
38453ccc 7// Chosen to let board fit inside
855c1745 8housing_inner_h = 6;
7f78ee27 9housing_inner_w = 21;
855c1745 10housing_flat = 8;
2505c819 11housing_extra_l = 10;
7f78ee27
SW
12
13thickness = 1.7;
14
38453ccc
SW
15board_gap = 0.125;
16
7f78ee27 17wiring_l = 12;
859fd2d9 18extra_flare = wiring_l;
7f78ee27
SW
19
20pico_board_l = 51.0;
21pico_board_w = 21.0;
855c1745 22pico_board_h = 1.0;
7f78ee27
SW
23pico_total_h = 3.7;
24
25$fs = .1;
859fd2d9 26$fa = 3;
7f78ee27
SW
27
28slop = 128;
29epsilon = 1/64;
30
31module pico_hole(d, x, y) {
32 translate([x, y, -slop/2])
33 cylinder(h=slop, d = d);
34}
35
2505c819
SW
36module pico_board(length = pico_board_l, gap = 0) {
37 translate([-gap - length + pico_board_l, 0, -gap])
38 cube([length + 2*gap, pico_board_w, pico_board_h + 2*gap]);
38453ccc
SW
39}
40
859fd2d9
SW
41module pico_w(hole_d = 2.1) {
42 // Dimensions from measuring and/or
43 // https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf
7f78ee27
SW
44 board_l = pico_board_l;
45 board_w = pico_board_w;
7f78ee27
SW
46
47 hole_x1 = 2.0;
48 hole_x2 = board_l - 2.0;
49 hole_y_spacing = 11.4;
50 hole_y = (board_w - hole_y_spacing)/2;
51
52 difference() {
53 color("green")
38453ccc 54 pico_board();
7f78ee27
SW
55
56 pico_hole(hole_d, hole_x1, hole_y);
57 pico_hole(hole_d, hole_x2, hole_y);
58 pico_hole(hole_d, hole_x1, hole_y + hole_y_spacing);
59 pico_hole(hole_d, hole_x2, hole_y + hole_y_spacing);
60
61 }
62
63 total_l = 52.3;
64 total_h = pico_total_h;
65 usb_w = 8.0;
66 usb_l = 5.6;
67 usb_h = 3.0;
68 color("lightgray")
69 translate([board_l - total_l, (board_w-usb_w)/2, total_h-usb_h])
70 cube([usb_l, usb_w, usb_h]);
71
72 button_l = 4.2;
73 button_w = 3.4;
74 button_h = 3.5;
75 button_x = 9.9;
76 button_y = 5.2;
77 color("white")
78 translate([button_x, button_y, epsilon])
79 cube([button_l, button_w, button_h]);
80
81 wifi_l = 10.0;
82 wifi_w = 12.0;
83 wifi_h = 2.8;
84 wifi_x = 33.0;
85 color("lightgray")
86 translate([wifi_x, (board_w-wifi_w)/2, epsilon])
87 cube([wifi_l, wifi_w, wifi_h]);
88}
89
90module at_key() {
91 translate([pico_board_l + wiring_l, 0, 0])
92 rotate([45, 0, 0])
93 rotate([0, 90, 0])
94 children();
95}
96
859fd2d9 97module key_interface_shape(thick = key_interface_thickness, outline = thickness) {
7f78ee27
SW
98 inner = key_interface_size - 2*key_interface_corner_r;
99 linear_extrude(thick)
100 minkowski() {
101 square([inner, inner], center=true);
859fd2d9 102 circle(r=key_interface_corner_r + outline);
7f78ee27
SW
103 }
104}
105
106module key_interface() {
107 at_key()
108 difference() {
109 key_interface_shape();
110
859fd2d9
SW
111 translate([0, 0, 6 - epsilon])
112 cherry_switch_void(tolerance=0.05);
7f78ee27
SW
113 }
114}
115
859fd2d9 116module housing_shape(outline = thickness) {
859fd2d9
SW
117 housing_w = housing_inner_w + 2 * outline;
118 housing_h = housing_inner_h + 2 * outline;
855c1745 119 squish = housing_h / (housing_w - housing_flat);
859fd2d9
SW
120
121 scale([1, squish])
855c1745
SW
122 minkowski() {
123 circle(d = housing_w - housing_flat);
124 square([housing_flat, epsilon], center=true);
125 }
859fd2d9
SW
126}
127
2505c819
SW
128module housing() {
129 length = pico_board_l - extra_flare;
130 translate([-housing_extra_l, 0, 0])
7f78ee27
SW
131 rotate([90, 0, 0])
132 rotate([0, 90, 0])
2505c819 133 linear_extrude(length + housing_extra_l)
7f78ee27 134 difference() {
859fd2d9
SW
135 housing_shape();
136 housing_shape(0);
7f78ee27
SW
137 }
138}
139
859fd2d9
SW
140module flare_shape(outline, extra_len) {
141 hull() {
142 at_key()
143 key_interface_shape(epsilon + extra_len, outline);
144 translate([pico_board_l-extra_flare, 0, 0])
145
146 translate([-extra_len, 0, 0])
147 rotate([90, 0, 0])
148 rotate([0, 90, 0])
149 linear_extrude(epsilon+extra_len)
150 housing_shape(outline);
151 }
152}
7f78ee27 153
859fd2d9
SW
154module flare() {
155 difference() {
156 flare_shape(thickness, 0);
157 flare_shape(0, epsilon);
158 }
159}
160
38453ccc 161module at_board() {
855c1745 162 translate([0, -pico_board_w/2, -pico_board_h])
38453ccc
SW
163 children();
164}
165
859fd2d9
SW
166module tattlekey_case() {
167 key_interface();
168
169 difference() {
170 union() {
171 housing();
172 flare();
173 }
38453ccc 174 at_board()
2505c819 175 pico_board(slop, board_gap);
859fd2d9
SW
176 }
177}
7f78ee27 178
38453ccc
SW
179module preview() {
180 at_board() pico_w();
181 render() tattlekey_case();
182}
183
184//preview();
185
859fd2d9 186tattlekey_case();