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