Browse Source

rework complete openscad

phschoen 1 year ago
parent
commit
0ec4b3ee22

+ 45
- 0
hardware/ball_and_bearing.scad View File

@@ -0,0 +1,45 @@
1
+/*
2
+ * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
3
+ *                           Philipp Schönberger (mail@phschoen.de)
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * See <http://www.gnu.org/licenses/>.
16
+ */
17
+include<config.scad>;
18
+
19
+use<bearing.scad>;
20
+use<util.scad>;
21
+
22
+//ball_and_bearing_holder();
23
+bearing_mount_for_hull();
24
+
25
+module ball_and_bearing_holder()
26
+{
27
+    // trackball itself
28
+    if(draw_trackball)
29
+    color("red")
30
+    sphere(d = trackball_dia, $fn = $fn);
31
+
32
+    bearing_rot_trans()
33
+    bearing_holder();
34
+}
35
+module bearing_rot_trans()
36
+{
37
+    for (r = [0 : bearing_count - 1])
38
+    rotate([0, 0, bearing_mount_angle_off + 360 / bearing_count * r])
39
+    {
40
+        rotate([0, sphere_angle_at_rh(trackball_dia *0.10, trackball_dia / 2) , 0])
41
+        translate([0, 0, -trackball_dia / 2])
42
+        rotate([0,0,90]) // move flange to bottom
43
+        children();
44
+    }
45
+}

+ 205
- 0
hardware/bearing.scad View File

@@ -0,0 +1,205 @@
1
+/*
2
+ * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
3
+ *                           Philipp Schönberger (mail@phschoen.de)
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * See <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+include <config.scad>;
19
+include <BOSL2/std.scad>;
20
+include <BOSL2/threading.scad>;
21
+
22
+bearing_holder();
23
+
24
+bearing_holder_mount();
25
+
26
+//NOTE: [0,0,0] should be the "top" contact point of the bearings
27
+
28
+module bearing_holder()
29
+{
30
+    difference()
31
+    {
32
+        if(bearing_type=="static") {
33
+            bearing_holder_static();
34
+        }
35
+
36
+        if(bearing_type=="dynamic_m6_vcn320") {
37
+
38
+            bearing_holder_m6_vcn320();
39
+        }
40
+
41
+        if(bearing_type=="dynamic_3d_vcn410") {
42
+            bearing_holder_d3_vcn410();
43
+        }
44
+
45
+        // cut of the flange
46
+        translate([0,bearing_mount_flange, 0])// move in by flange
47
+        translate([0,-bearing_mount_dia/2, 0])// move to edge of cylinder
48
+        translate([-bearing_mount_dia,-bearing_mount_dia, -bearing_h*2])// center on on half
49
+        cube([bearing_mount_dia *2, bearing_mount_dia, bearing_h *3]);
50
+    }
51
+}
52
+
53
+module bearing_holder_static()
54
+{
55
+
56
+    // glider ball itself
57
+    %translate([0, 0, -bearing_static_dia/2])
58
+    color([0.3,0.3,0.3,0.2])
59
+    sphere(d = bearing_static_dia, $fn = $fn);
60
+
61
+    difference()
62
+    {
63
+        // holder itself
64
+        color("magenta")
65
+        hull()
66
+        {
67
+            // hold static ball itself
68
+            translate([0, 0, -bearing_static_dia -bearing_static_dia*0.35])
69
+            cylinder(d1 = bearing_mount_dia, d2=bearing_static_dia+1,  h = bearing_static_dia);
70
+
71
+            // bottom surface
72
+            translate([0, 0, -bearing_h])
73
+            cylinder(d = bearing_mount_dia, h = $e);
74
+
75
+        }
76
+        // cut the bearing on the side
77
+//        #translate([-bearing_mount_dia / 2 - 1, bearing_mount_dia / 2 - bearing_holder_sider_cut, -1])
78
+//        cube([bearing_mount_dia + 2, bearing_mount_dia / 2 + 1, bearing_h + 2]);
79
+
80
+        // tiny hole through the complete holder to seperate the ball from the holder if needed
81
+        color([0.9,0.5,0.5])// lightred
82
+        translate([0, 0, -bearing_h-$e])
83
+        cylinder(d = bearing_thread_hole, h = bearing_h+$e*2);
84
+
85
+        // sphere cut of the holder itself
86
+        color("gray")
87
+        translate([0, 0, - bearing_static_dia / 2])
88
+        sphere(d = bearing_static_dia, $fn = $fn);
89
+
90
+        // cut in order to see through from the side
91
+        if (cut_bearing_holder)
92
+        translate([-bearing_mount_dia,-bearing_mount_dia, -bearing_h*2])
93
+        cube([bearing_mount_dia *2, bearing_mount_dia, bearing_h *3]);
94
+    }
95
+}
96
+
97
+module bearing_holder_m6_vcn320()
98
+{
99
+    l=bearing_h*0.7;
100
+    d=3.18;
101
+    l2=bearing_h-d*0.6;
102
+
103
+    difference()
104
+    {
105
+        union()
106
+        {
107
+            // main holder part for the m6 screw
108
+            translate([0,0,-bearing_h])
109
+            cylinder(d=bearing_mount_dia,h=l);
110
+
111
+            // ball bearing itself
112
+            %union()
113
+            {
114
+                // ball itself
115
+                color("red")
116
+                translate([0,0,-d/2])
117
+                sphere(d = d, $fn = $fn);
118
+
119
+                // metal champer for the ball
120
+                color("silver")
121
+                translate([0,0,-1 + d*0.2 -d/2])
122
+                cylinder(d2 = 3.5,d1 = 6,h=1);
123
+
124
+                // m6 rod
125
+                translate([0,0,-bearing_h+l2/2-$e])
126
+                threaded_rod(d=6, l=l2+$e, pitch=1.0);
127
+            }
128
+        }
129
+        // cut of the rod itself
130
+        translate([0,0,-bearing_h+l2/2-$e])
131
+        threaded_rod(d=6.1, l=l2, pitch=1.0);
132
+
133
+        if (cut_bearing_holder)
134
+        translate([-bearing_mount_dia,-bearing_mount_dia, -bearing_h*2])
135
+        cube([bearing_mount_dia *2, bearing_mount_dia, bearing_h *3]);
136
+    }
137
+}
138
+
139
+module bearing_holder_d3_vcn410()
140
+{
141
+    S=0.6;
142
+    D1=3.6;
143
+    d=2;
144
+    L= 4;
145
+    D=3;
146
+
147
+    // bearing itself
148
+    % color([1,1,1,0.0])
149
+    {
150
+        translate([0,0,-d/2])
151
+        sphere(d=d);
152
+        translate([0,0,-S-1])
153
+        cylinder(d=D1,h=1);
154
+        translate([0,0,-L-S])
155
+        cylinder(d=D,h=L);
156
+    }
157
+
158
+    difference()
159
+    {
160
+        union()
161
+        {
162
+            translate([0,0,-bearing_h])
163
+            cylinder(d=bearing_mount_dia,h=bearing_h-L);
164
+            translate([0,0,-L-S+1/2])
165
+            cylinder(d1=bearing_mount_dia,d2=D+1,h=L-1);
166
+        }
167
+
168
+        // tiny hole through the complete holder to seperate the ball from the holder if needed
169
+        color([0.9,0.5,0.5])// lightred
170
+        translate([0, 0, -bearing_h-$e])
171
+        cylinder(d = bearing_thread_hole, h = bearing_h+$e*2);
172
+
173
+        // cut for the bearing itself
174
+        translate([0,0,-S-1])
175
+        cylinder(d=D1+$c,h=1);
176
+
177
+        translate([0,0,-L-S])
178
+        cylinder(d=D+$c,h=L);
179
+    }
180
+}
181
+
182
+module bearing_holder_mount()
183
+{
184
+    translate([0, 0, -1-bearing_h])
185
+    {
186
+        difference()
187
+        {
188
+            cylinder(d=bearing_mount_dia+wall,h=bearing_h*0.75);
189
+
190
+            translate([0, 0, 1])
191
+            cylinder(d=bearing_mount_dia+$c*2,h=bearing_h+$e);
192
+        }
193
+        // add the flange
194
+        intersection()
195
+        {
196
+            cylinder(d=bearing_mount_dia+wall,h=bearing_h*0.75);
197
+
198
+            // cut of the flange
199
+            translate([0,bearing_mount_flange-$c, 0])// move in by flange
200
+            translate([0,-bearing_mount_dia/2, 0])// move to edge of cylinder
201
+            translate([-bearing_mount_dia,-bearing_mount_dia, -bearing_h*2])// center on on half
202
+            cube([bearing_mount_dia *2, bearing_mount_dia, bearing_h *3]);
203
+        }
204
+    }
205
+}

+ 101
- 0
hardware/config.scad View File

@@ -0,0 +1,101 @@
1
+/*
2
+ * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
3
+ *                           Philipp Schönberger (mail@phschoen.de)
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * See <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+
19
+// https://www.thingiverse.com/thing:421524
20
+use <external/cherry_mx.scad>;
21
+include <mx_switch.scad>;
22
+
23
+// #######################
24
+// #### Configuration ####
25
+// #######################
26
+$fn = 100;//42;
27
+$c = 0.1;  // clearence of 3d printer
28
+$e = 0.01; // smales neglegtable distance
29
+
30
+pico_angle = 55;
31
+pico_off = -60;
32
+
33
+
34
+angle_sensor=[0,0,145]; //  angle of the ball sensor
35
+sensor_type = "mini"; // one of normal or mini
36
+
37
+trackball_dia = 40.0;        // diameter of the trackball itself
38
+
39
+bearing_type="dynamic_m6_vcn320"; // one off:
40
+                                 //  dynamic_3d_vcn410
41
+                                 //  dynamic_m6_vcn320
42
+                                 //  static
43
+bearing_static_dia = 3.0;        // diameter of the roller holder ball if type is "static"
44
+bearing_h = 12;                  // total higth of the bearing holder
45
+
46
+roller_ball_h = trackball_dia / 2 - 5;
47
+bearing_count = 3;
48
+
49
+wall = 3.0;
50
+
51
+left_hand_version = false;
52
+cut_bearing_holder = false;
53
+draw_supports = false;
54
+draw_ball_bearing_holder = true;
55
+draw_trackball = true;
56
+draw_switches = true;
57
+draw_sensor = true;
58
+draw_led= true;
59
+draw_pico = true;
60
+use_external_pico_model = true;
61
+draw_keycap = true;
62
+draw_panel = true;
63
+draw_usb_c = true;
64
+
65
+// ######################
66
+// ### Implementation ###
67
+// ######################
68
+
69
+base_dia = 62;
70
+
71
+grub_screw_dia = 2.8;
72
+grub_channel_dia = 4.0;
73
+
74
+bearing_ball_h_off = 0.4;
75
+bearing_ball_hold_off = 0.5;
76
+
77
+bearing_mount_grub_screw_l = 5;
78
+bearing_mount_angle_off = 25;//90-5;
79
+bearing_mount_dia = 10;
80
+bearing_mount_flange = 1;
81
+
82
+ball_h = 15; // todo
83
+
84
+switch_test_w = 25;
85
+
86
+sensor_pcb_mount_gap = 2.0;
87
+
88
+//         rotate                                     translate
89
+sw = [   // x  z_pre_T  z_post_T
90
+        [ [-25,      0, -33 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 3,-14.5]],// thumb
91
+        [ [-25,    -19,   3 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 3,-14.5]],// thumb
92
+        [ [-25,      0, 146 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 3,-14.5]],// middle
93
+        [ [-25,     19, 106 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 3,-14.5]],// ring
94
+        // [ [-25,    -15, 146 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 3,-14.5]],// middle
95
+        // [ [-25,      0, 106 * (left_hand_version ? -1 : 1)], [0,-base_dia / 2 - 3,-14.5]],// ring
96
+    ];
97
+
98
+sw_mount_w = mx_co_w + 7;
99
+sw_mount_r=4;
100
+
101
+assembly_dist = 20;

+ 45
- 0
hardware/external/led_ring.scad View File

@@ -0,0 +1,45 @@
1
+include<../config.scad>; 
2
+include<../util.scad>;
3
+
4
+led_ring(cutout=true);
5
+
6
+module led_ring(cutout=false,extra =0)
7
+{
8
+    play=(cutout ? 0.1 : 0);
9
+
10
+    // pcb ring
11
+    color(cutout? "green": "gray")
12
+    translate([0,0,-extra + (cutout ? 1.3 : 0)])
13
+    difference()
14
+    {
15
+        
16
+        cylinder(d=48+play*2,h=1.6 + extra);
17
+        eps()
18
+        cylinder(d=30.8-play*2,h=1.6 + extra + $e*2);
19
+    }
20
+
21
+    // leds on the ring
22
+    for(r=[0:360/16:360])
23
+    rotate([0,0,r])
24
+    translate([38.8/2,0,$e])
25
+    if(cutout==false) {
26
+        difference() {
27
+            color("white")
28
+            translate([-5/2,-5/2,0])
29
+            cube([5,5,2.9-$e]);
30
+
31
+            color([(r/4)%1,(r/7)%1,(r/10)%1])
32
+            translate([0,0,2.9-0.3])
33
+            cylinder(d1=2.5,d2=3,h=0.3);
34
+        }
35
+    } else {
36
+        hull() {
37
+            translate([0,0,2.9])
38
+            rotate([0,-30,0])
39
+            cylinder(d1=3,d2=10,h=10);
40
+
41
+            translate([0,0,2.9])
42
+            cylinder(d=3,h=$e);
43
+        }
44
+    }
45
+}

BIN
hardware/external/mouse_scan_v1.stl View File


+ 98
- 0
hardware/mx_switch.scad View File

@@ -0,0 +1,98 @@
1
+/*
2
+ * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
3
+ *                           Philipp Schönberger (mail@phschoen.de)
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * See <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+// ######################
19
+// ## MX Switch Cutout ##
20
+// ######################
21
+
22
+// https://geekhack.org/index.php?topic=70654.0
23
+mx_co_w = 14.0;
24
+mx_co_w_add = 0.8;
25
+mx_co_h = 14.0;
26
+mx_co_keycap_w = mx_co_w + 2.5*2;
27
+mx_co_keycap_h = mx_co_h + 2.5*2;
28
+mx_co_h_off_1 = 1.0;
29
+mx_co_h_off_2 = 3.5;
30
+mx_co_h_off_3 = mx_co_h - 2 * (mx_co_h_off_1 + mx_co_h_off_2);
31
+mx_co_r = 0.4;
32
+mx_co_depth = 5 + 3.3 + 0.2;
33
+
34
+// https://geekhack.org/index.php?topic=71550.0
35
+mx_co_th = 1.5 - 0.1;
36
+mx_co_b_add = 1.0;
37
+mx_co_b_w = mx_co_w + mx_co_b_add;
38
+mx_co_b_h = mx_co_h + mx_co_b_add;
39
+
40
+mx_travel = 3.9;
41
+
42
+module mx_switch_cutout(h) 
43
+{
44
+    translate([-mx_co_w / 2 - mx_co_w_add, -mx_co_h / 2, 0])
45
+    {
46
+        // edge cuts for anti dust
47
+        color("red")
48
+        linear_extrude(h + 1)
49
+        {
50
+            translate([mx_co_w_add, 0])
51
+            {
52
+                square([mx_co_w, mx_co_h]);
53
+
54
+                for (x = [mx_co_r / 2, mx_co_w - mx_co_r / 2])
55
+                for (y = [mx_co_r / 2, mx_co_h - mx_co_r / 2])
56
+                translate([x, y])
57
+                circle(r = mx_co_r);
58
+            }
59
+        }
60
+
61
+        // side cutouts
62
+        color("lightblue")
63
+        linear_extrude(h + 1)
64
+        {
65
+            for (x = [-$e, mx_co_w + mx_co_w_add-$e])
66
+            for (y = [0, mx_co_h_off_2 + mx_co_h_off_3])
67
+            translate([x, mx_co_h_off_1 + y, 0])
68
+            square([mx_co_w_add+$e*2, mx_co_h_off_2]);
69
+        }
70
+
71
+        color("brown")
72
+        translate([mx_co_w_add - mx_co_b_add / 2, -mx_co_b_add / 2, -1])
73
+        cube([mx_co_b_w, mx_co_b_h, h - mx_co_th + 1]);
74
+    }
75
+
76
+    color("cyan")
77
+    translate([-mx_co_keycap_w/2,-mx_co_keycap_h/2, h])
78
+    cube([mx_co_keycap_w, mx_co_keycap_h, 50]);
79
+}
80
+
81
+module mx_switch_test()
82
+{
83
+    difference()
84
+    {
85
+        translate([-switch_test_w / 2, -switch_test_w / 2, 0])
86
+        cube([switch_test_w, switch_test_w, wall]);
87
+
88
+        mx_switch_cutout(wall);
89
+
90
+        translate([0, -switch_test_w / 2 + 1, wall - 1.0])
91
+        linear_extrude(1.1)
92
+        text("switch test", size = 3, halign = "center");
93
+    }
94
+
95
+    %translate([0, 0, wall])
96
+    rotate([0, 0, 180])
97
+    mx_switch($t);
98
+}

+ 79
- 0
hardware/pico.scad View File

@@ -0,0 +1,79 @@
1
+/*
2
+ * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
3
+ *                           Philipp Schönberger (mail@phschoen.de)
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * See <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+// #######################
19
+// ## Raspberry Pi Pico ##
20
+// #######################
21
+
22
+pico_w = 21;
23
+pico_l = 51;
24
+pico_d = 1.0;
25
+pico_hole_d = 2.1;
26
+pico_hole_x = 4.8;
27
+pico_hole_y = 2.0;
28
+pico_hole_d_x = 11.4;
29
+pico_hole_d_y = pico_l - 2 * pico_hole_y;
30
+pico_usb_w = 8.0;
31
+pico_usb_h = 2.8;
32
+pico_usb_d = 6.0;
33
+pico_usb_off = 1.3;
34
+
35
+
36
+pico_co_w = pico_w + 1;
37
+pico_co_l = pico_l + 1;
38
+
39
+reset_button_dia = 4.0;
40
+reset_button_off_x = 7;
41
+reset_button_off_y = 12.15;
42
+
43
+pico_support_w = 6.5;
44
+pico_support_l = 5;
45
+
46
+pico_screw_depth = 6;
47
+pico_screw_d = 1.8;
48
+
49
+use <external/pico_case.scad>
50
+
51
+module pico_wrap()
52
+{
53
+    translate([0,0,3.9])
54
+    rotate([0,180,0])
55
+    if (use_external_pico_model)
56
+        translate([-pico_w / 2, -pico_l / 2, 0])
57
+        pico();
58
+    else
59
+        pico_own();
60
+}
61
+
62
+module pico_own()
63
+{
64
+    translate([-pico_w / 2, -pico_l / 2, 0])
65
+    difference() {
66
+        union() {
67
+            color("green")
68
+            cube([pico_w, pico_l, pico_d]);
69
+
70
+            translate([(pico_w - pico_usb_w) / 2, pico_l - pico_usb_d + pico_usb_off, pico_d])
71
+            cube([pico_usb_w, pico_usb_d, pico_usb_h]);
72
+        }
73
+
74
+        for (x = [0, pico_hole_d_x])
75
+        for (y = [0, pico_hole_d_y])
76
+        translate([pico_hole_x + x, pico_hole_y + y, -1])
77
+        cylinder(d = pico_hole_d, h = pico_d + 2);
78
+    }
79
+}

+ 1
- 0
hardware/pmw3360-breakout

@@ -0,0 +1 @@
1
+Subproject commit 4973405a637cc1754d6a10ec55d36e88998f6726

+ 167
- 0
hardware/sensor_pmw3360.scad View File

@@ -0,0 +1,167 @@
1
+/*
2
+ * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
3
+ *                           Philipp Schönberger (mail@phschoen.de)
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * See <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+include<config.scad>
19
+include<util.scad>
20
+
21
+// ######################
22
+// ### PMW3360 Sensor ###
23
+// ######################
24
+
25
+// https://github.com/jfedor2/pmw3360-breakout
26
+sensor_w = 22;
27
+sensor_l = 27.6;//34;
28
+sensor_r = 2;
29
+
30
+sensor_pcb_h = 1.6;
31
+sensor_hole_dia = 2.2;
32
+sensor_hole_off_x = 3.0;
33
+sensor_hole_off_y = 3.0;
34
+sensor_hole_dist_x = 16.6;
35
+sensor_hole_dist_y = 22.32;
36
+sensor_cut_w = 8.0 + 0.5;
37
+sensor_cut_h = 17.26;
38
+sensor_cut_off_x = 7.0 - 0.25;
39
+sensor_cut_off_y = 5.27;
40
+sensor_cut_edge_to_pin1 = 2.75;
41
+sensor_edge_to_pin1 = 1.52;
42
+
43
+sensor_ball_to_lens_top = 2.4;
44
+sensor_ball_to_chip_bottom = 9.81;
45
+
46
+sensor_chip_w = 9.1;
47
+sensor_chip_l = 16.2;
48
+sensor_chip_h = 2.21;
49
+
50
+sensor_pin_w = 0.5;
51
+sensor_pin_h = 4.51;
52
+sensor_pin_d = 0.2;
53
+sensor_pin_dist = 10.7;
54
+sensor_pin_off_top = 0.5;
55
+sensor_pin_pitch = 0.89;
56
+
57
+sensor_pin1_to_optical_center = 5.66;
58
+
59
+sensor_lens_cutout_r = 2.0;
60
+sensor_lens_cutout_w = 4.0;
61
+sensor_lens_cutout_growth = 0.25;
62
+sensor_lens_cutout_to_chip = 6.71 - 1.60;
63
+sensor_lens_baseplate_h = 2.40;
64
+
65
+sensor_lens_d = 19.0 + 1.0;
66
+sensor_lens_w = 21.35 + 0.2;
67
+sensor_lens_off = 10.97;
68
+
69
+sensor_cutout();
70
+
71
+module sensor_lens_cutout_intern() 
72
+{
73
+    cylinder(d = sensor_lens_cutout_r * 2, h = $e);
74
+    
75
+    translate([-sensor_lens_cutout_r, 0, 0])
76
+    cube([sensor_lens_cutout_r * 2, sensor_lens_cutout_w, $e]);
77
+}
78
+
79
+
80
+module sensor_lens_cutout()
81
+{
82
+    translate([0, 0, sensor_lens_cutout_to_chip])
83
+    hull()
84
+    {
85
+        translate([0, 0, sensor_lens_baseplate_h - $e])
86
+        sensor_lens_cutout_intern();
87
+        
88
+        scale(1 + sensor_lens_cutout_growth * sensor_lens_baseplate_h)
89
+        sensor_lens_cutout_intern();
90
+    }
91
+    
92
+    translate([-sensor_lens_d / 2, -sensor_lens_w + sensor_lens_off, 0])
93
+    rounded_cube(sensor_lens_d, sensor_lens_w, sensor_lens_cutout_to_chip, 6);
94
+    
95
+    translate([-3 / 2, -sensor_lens_w + sensor_lens_off - 0.5, 0])
96
+    cube([3, 0.5, sensor_lens_cutout_to_chip]);
97
+}
98
+
99
+module sensor()
100
+{
101
+    translate([-sensor_w / 2, -sensor_l / 2, 0])
102
+    difference()
103
+    {
104
+        color("green")
105
+        minkowski()
106
+        {
107
+            translate([sensor_r,sensor_r,0])
108
+            cube([sensor_w-sensor_r*2, sensor_l-sensor_r*2, sensor_pcb_h]);
109
+
110
+            cylinder(r=sensor_r,h=$e);
111
+        }
112
+        
113
+        translate([sensor_cut_off_x, sensor_cut_off_y, -1])
114
+        cube([sensor_cut_w, sensor_cut_h, sensor_pcb_h + 2]);
115
+        
116
+        for (x = [0, sensor_hole_dist_x])
117
+        for (y = [0, sensor_hole_dist_y])
118
+        translate([sensor_hole_off_x + x, sensor_hole_off_y + y, -1])
119
+        cylinder(d = sensor_hole_dia, h = sensor_pcb_h + 2);
120
+    }
121
+    
122
+    color("#303030")
123
+    translate([-sensor_chip_w / 2, -sensor_l / 2 - sensor_chip_l + sensor_edge_to_pin1 + sensor_cut_off_y + sensor_cut_h - sensor_cut_edge_to_pin1, -sensor_chip_h])
124
+    cube([sensor_chip_w, sensor_chip_l, sensor_chip_h]);
125
+    
126
+    translate([0, -sensor_l / 2 - 15 * sensor_pin_pitch + sensor_cut_off_y + sensor_cut_h - sensor_cut_edge_to_pin1, 0])
127
+    for (p = [0 : 15])
128
+    translate([0, p * sensor_pin_pitch, 0])
129
+    for (x = [-sensor_pin_dist / 2, sensor_pin_dist / 2])
130
+    if (((p % 2 == 0) && (x < 0)) || ((p % 2 == 1) && (x > 0)))
131
+    translate([-sensor_pin_d / 2 + x, -sensor_pin_w / 2, -sensor_chip_h + sensor_pin_off_top])
132
+    cube([sensor_pin_d, sensor_pin_w, sensor_pin_h]);
133
+    
134
+    translate([0, -sensor_l / 2 + sensor_cut_off_y + sensor_cut_h - sensor_cut_edge_to_pin1 - sensor_pin1_to_optical_center, 0])
135
+    {
136
+        color("cyan")
137
+        translate([0, 0, -sensor_chip_h + 1])
138
+        cylinder(d = 0.2, h = sensor_ball_to_chip_bottom - 1);
139
+        
140
+        %color("blue")
141
+        sensor_lens_cutout();
142
+    }
143
+}
144
+
145
+module sensor_pos() {
146
+    rotate(angle_sensor)
147
+    translate([0, 0, -trackball_dia / 2 ])
148
+    translate([0, sensor_l / 2 - sensor_cut_off_y - sensor_cut_h + sensor_cut_edge_to_pin1 + sensor_pin1_to_optical_center,  sensor_chip_h - sensor_ball_to_chip_bottom])
149
+    translate([0, -sensor_l / 2 + sensor_cut_off_y + sensor_cut_h - sensor_cut_edge_to_pin1 - sensor_pin1_to_optical_center, 0])
150
+    sensor();
151
+}
152
+
153
+module sensor_cutout()
154
+{
155
+    rotate(angle_sensor)
156
+    translate([0, 0, -trackball_dia / 2 ])
157
+    translate([0, sensor_l / 2 - sensor_cut_off_y - sensor_cut_h + sensor_cut_edge_to_pin1 + sensor_pin1_to_optical_center,  sensor_chip_h - sensor_ball_to_chip_bottom])
158
+    translate([0, -sensor_l / 2 + sensor_cut_off_y + sensor_cut_h - sensor_cut_edge_to_pin1 - sensor_pin1_to_optical_center, 0])
159
+    sensor_lens_cutout();
160
+    
161
+    // sensor pcb
162
+    rotate(angle_sensor)
163
+    translate([-1, -1, -trackball_dia / 2 - 20])
164
+    translate([0, sensor_l / 2 - sensor_cut_off_y - sensor_cut_h + sensor_cut_edge_to_pin1 + sensor_pin1_to_optical_center, sensor_chip_h - sensor_ball_to_chip_bottom])
165
+    translate([-sensor_w / 2, -sensor_l / 2, -10])
166
+    cube([sensor_w + 2, sensor_l + 2, sensor_pcb_h + 10 + sensor_pcb_mount_gap+20]);
167
+}

+ 303
- 680
hardware/trackball.scad
File diff suppressed because it is too large
View File


+ 50
- 0
hardware/usbc.scad View File

@@ -0,0 +1,50 @@
1
+/*
2
+ * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
3
+ *                           Philipp Schönberger (mail@phschoen.de)
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * See <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+module usb_c()
19
+{
20
+    // todo 
21
+    color("gray")
22
+    translate([-19.8/2,0,0])
23
+    cube([19.8,1.6,6.6]);
24
+    
25
+    translate([-9.2/2,0.01,1.6])
26
+    cube([9.2,14.5,3.3]);
27
+    translate([-12.6/2,0.01,1.6])
28
+    cube([12.6,3.5,3.3]);
29
+    for(i=[-1,1])
30
+    translate([i*15.75/2,0,6.6/2])
31
+    rotate([-90,0,0])
32
+    cylinder($fn=32,d=1.8,h=1.6+5);
33
+}
34
+
35
+module usb_c_cutout()
36
+{
37
+    // todo 
38
+    color("gray")
39
+    translate([-19.8/2,-20,0])
40
+    cube([19.8,1.6+20,6.6]);
41
+    
42
+    translate([-9.2/2,0.01,1.6])
43
+    cube([9.2,14.5,3.3]);
44
+    translate([-12.6/2,0.01,1.6])
45
+    cube([12.6,3.5,3.3]);
46
+    for(i=[-1,1])
47
+    translate([i*15.75/2,0,6.6/2])
48
+    rotate([-90,0,0])
49
+    cylinder($fn=32,d=1.8,h=1.6+5);
50
+}

+ 53
- 0
hardware/util.scad View File

@@ -0,0 +1,53 @@
1
+/*
2
+ * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de)
3
+ *                           Philipp Schönberger (mail@phschoen.de)
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * See <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+function sphere_r_at_h(h, r) = r * sin(acos(h / r));
19
+function sphere_angle_at_rh(h, r) = acos(h / r);
20
+
21
+
22
+module fully_rounded_cube(p,r,center)
23
+{
24
+    for(x=[r,p[0]-r],
25
+        y=[r,p[1]-r],
26
+        z=[r,p[2]-r])
27
+    {
28
+        translate([x,y,z])
29
+        sphere(r,$fn=$fn/4);
30
+    }
31
+}
32
+
33
+module rounded_cube(x, y, z, r)
34
+{
35
+    hull()
36
+    for (tx = [r, x - r])
37
+    for (ty = [r, y - r])
38
+    translate([tx, ty, 0])
39
+    cylinder(d = r * 2, h = z);
40
+}
41
+
42
+module eps(dir="z")
43
+{
44
+    if(dir== "x")
45
+        tranlate([-$e,0,0])
46
+        children();
47
+    if(dir== "y")
48
+        translate([0,-$e,0])
49
+        children();
50
+    if(dir== "z")
51
+        translate([0,0,-$e])
52
+        children();
53
+}

Loading…
Cancel
Save