]>
Commit | Line | Data |
---|---|---|
1 | use <cherryVoid.scad> | |
2 | ||
3 | key_interface_size = 18; | |
4 | key_interface_corner_r = 5; | |
5 | key_interface_thickness = 1.484; | |
6 | ||
7 | // Chosen to let board fit inside | |
8 | housing_inner_h = 6; | |
9 | housing_inner_w = 21; | |
10 | housing_flat = 8; | |
11 | housing_extra_l = 10; | |
12 | ||
13 | thickness = 1.7; | |
14 | ||
15 | board_gap = 0.125; | |
16 | ||
17 | wiring_l = 12; | |
18 | extra_flare = wiring_l; | |
19 | ||
20 | pico_board_l = 51.0; | |
21 | pico_board_w = 21.0; | |
22 | pico_board_h = 1.0; | |
23 | pico_total_h = 3.7; | |
24 | ||
25 | $fs = .1; | |
26 | $fa = 3; | |
27 | ||
28 | slop = 128; | |
29 | epsilon = 1/64; | |
30 | ||
31 | module pico_hole(d, x, y) { | |
32 | translate([x, y, -slop/2]) | |
33 | cylinder(h=slop, d = d); | |
34 | } | |
35 | ||
36 | module 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]); | |
39 | } | |
40 | ||
41 | module pico_w(hole_d = 2.1) { | |
42 | // Dimensions from measuring and/or | |
43 | // https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf | |
44 | board_l = pico_board_l; | |
45 | board_w = pico_board_w; | |
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") | |
54 | pico_board(); | |
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 | ||
90 | module 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 | ||
97 | module key_interface_shape(thick = key_interface_thickness, outline = thickness) { | |
98 | inner = key_interface_size - 2*key_interface_corner_r; | |
99 | linear_extrude(thick) | |
100 | minkowski() { | |
101 | square([inner, inner], center=true); | |
102 | circle(r=key_interface_corner_r + outline); | |
103 | } | |
104 | } | |
105 | ||
106 | module key_interface() { | |
107 | at_key() | |
108 | difference() { | |
109 | key_interface_shape(); | |
110 | ||
111 | translate([0, 0, 6 - epsilon]) | |
112 | cherry_switch_void(tolerance=0.05); | |
113 | } | |
114 | } | |
115 | ||
116 | module housing_shape(outline = thickness) { | |
117 | housing_w = housing_inner_w + 2 * outline; | |
118 | housing_h = housing_inner_h + 2 * outline; | |
119 | squish = housing_h / (housing_w - housing_flat); | |
120 | ||
121 | scale([1, squish]) | |
122 | minkowski() { | |
123 | circle(d = housing_w - housing_flat); | |
124 | square([housing_flat, epsilon], center=true); | |
125 | } | |
126 | } | |
127 | ||
128 | module housing() { | |
129 | length = pico_board_l - extra_flare; | |
130 | translate([-housing_extra_l, 0, 0]) | |
131 | rotate([90, 0, 0]) | |
132 | rotate([0, 90, 0]) | |
133 | linear_extrude(length + housing_extra_l) | |
134 | difference() { | |
135 | housing_shape(); | |
136 | housing_shape(0); | |
137 | } | |
138 | } | |
139 | ||
140 | module 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 | } | |
153 | ||
154 | module flare() { | |
155 | difference() { | |
156 | flare_shape(thickness, 0); | |
157 | flare_shape(0, epsilon); | |
158 | } | |
159 | } | |
160 | ||
161 | module at_board() { | |
162 | translate([0, -pico_board_w/2, -pico_board_h]) | |
163 | children(); | |
164 | } | |
165 | ||
166 | module tattlekey_case() { | |
167 | key_interface(); | |
168 | ||
169 | difference() { | |
170 | union() { | |
171 | housing(); | |
172 | flare(); | |
173 | } | |
174 | at_board() | |
175 | pico_board(slop, board_gap); | |
176 | } | |
177 | } | |
178 | ||
179 | module preview() { | |
180 | at_board() pico_w(); | |
181 | render() tattlekey_case(); | |
182 | } | |
183 | ||
184 | //preview(); | |
185 | ||
186 | tattlekey_case(); |