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