5 changed files with 391 additions and 1 deletions
-
21config.scad
-
77constant.scad
-
37pcb/pmw3360_sensor.scad
-
21pcb/rp2040.scad
-
236trackball/trackball.scad
@ -0,0 +1,37 @@ |
|||
|
|||
include <../config.scad> |
|||
include <../constant.scad> |
|||
|
|||
pmw3360_sensor(); |
|||
module pmw3360_sensor() { |
|||
translate([-sensor_w / 2, -sensor_l / 2, 0]) |
|||
difference() { |
|||
color("green") |
|||
cube([sensor_w, sensor_l, sensor_pcb_h]); |
|||
|
|||
translate([sensor_cut_off_x, sensor_cut_off_y, -1]) |
|||
cube([sensor_cut_w, sensor_cut_h, sensor_pcb_h + 2]); |
|||
|
|||
for (x = [0, sensor_hole_dist_x]) |
|||
for (y = [0, sensor_hole_dist_y]) |
|||
translate([sensor_hole_off_x + x, sensor_hole_off_y + y, -1]) |
|||
cylinder(d = sensor_hole_dia, h = sensor_pcb_h + 2); |
|||
} |
|||
|
|||
color("#303030") |
|||
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]) |
|||
cube([sensor_chip_w, sensor_chip_l, sensor_chip_h]); |
|||
|
|||
translate([0, -sensor_l / 2 - 15 * sensor_pin_pitch + sensor_cut_off_y + sensor_cut_h - sensor_cut_edge_to_pin1, 0]) |
|||
for (p = [0 : 15]) |
|||
translate([0, p * sensor_pin_pitch, 0]) |
|||
for (x = [-sensor_pin_dist / 2, sensor_pin_dist / 2]) |
|||
if (((p % 2 == 0) && (x < 0)) |
|||
|| ((p % 2 == 1) && (x > 0))) |
|||
translate([-sensor_pin_d / 2 + x, -sensor_pin_w / 2, -sensor_chip_h + sensor_pin_off_top]) |
|||
cube([sensor_pin_d, sensor_pin_w, sensor_pin_h]); |
|||
|
|||
color("cyan") |
|||
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 + 1]) |
|||
cylinder(d = 0.2, h = sensor_ball_to_chip_bottom - 1); |
|||
} |
@ -1,6 +1,27 @@ |
|||
|
|||
include <../config.scad> |
|||
include <../constant.scad> |
|||
module rp2040_pcb() { |
|||
rotate([90,0,0]) |
|||
import("../stl/pcb/rp2040.stl"); |
|||
} |
|||
|
|||
rp2040_pcb(); |
|||
|
|||
module pico() { |
|||
translate([-pico_w / 2, -pico_l / 2, 0]) |
|||
difference() { |
|||
union() { |
|||
color("green") |
|||
cube([pico_w, pico_l, pico_d]); |
|||
|
|||
translate([(pico_w - pico_usb_w) / 2, pico_l - pico_usb_d + pico_usb_off, pico_d]) |
|||
cube([pico_usb_w, pico_usb_d, pico_usb_h]); |
|||
} |
|||
|
|||
for (x = [0, pico_hole_d_x]) |
|||
for (y = [0, pico_hole_d_y]) |
|||
translate([pico_hole_x + x, pico_hole_y + y, -1]) |
|||
cylinder(d = pico_hole_d, h = pico_d + 2); |
|||
} |
|||
} |
@ -0,0 +1,236 @@ |
|||
/* |
|||
* Trackball |
|||
* Copyright 2022 Thomas Buck - thomas@xythobuz.de |
|||
* |
|||
* Required parts: |
|||
* - 1x Raspberry Pi Pico |
|||
* - 5x Cherry MX compatible switches and keycaps |
|||
* - 1x Billard ball, diameter 38mm |
|||
* - 3x Si3N4 static bearing balls, diameter 3mm |
|||
* - 3x spring, diameter 2mm, length 10mm |
|||
* - 1x PMW3360 sensor with breakout board |
|||
* - 8x M2 screw, length 5mm |
|||
* - 8x M2 heat melt insert, length 4mm |
|||
* |
|||
* For the PMW3360 breakout board get this: |
|||
* https://github.com/jfedor2/pmw3360-breakout |
|||
* |
|||
* The "Threads" library used by this project is: |
|||
* Copyright 2022 Dan Kirshner - dan_kirshner@yahoo.com |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* See <http://www.gnu.org/licenses/>. |
|||
*/ |
|||
|
|||
include <../config.scad> |
|||
include <../constant.scad> |
|||
|
|||
use <../pcb/pmw3360_sensor.scad> |
|||
use <../pcb/rp2040.scad> |
|||
|
|||
// ###################### |
|||
// ## Rendering Select ## |
|||
// ###################### |
|||
|
|||
//roller_holder(); |
|||
//roller_mount_test(); |
|||
//roller_mount_tri(); |
|||
//ball_and_roller(); |
|||
trackball(); |
|||
|
|||
// ####################### |
|||
// #### Configuration #### |
|||
// ####################### |
|||
|
|||
base_dia = pico_l + 9; |
|||
wall = 3.0; |
|||
|
|||
cut_roller_holder = false; |
|||
|
|||
|
|||
// ###################### |
|||
// ## MX Switch Cutout ## |
|||
// ###################### |
|||
|
|||
// https://geekhack.org/index.php?topic=70654.0 |
|||
mx_co_w = 14.0; |
|||
mx_co_w_add = 0.8; |
|||
mx_co_h = 14.0; |
|||
mx_co_h_off_1 = 1.0; |
|||
mx_co_h_off_2 = 3.5; |
|||
mx_co_h_off_3 = mx_co_h - 2 * (mx_co_h_off_1 + mx_co_h_off_2); |
|||
mx_co_r = 0.4; |
|||
|
|||
// https://geekhack.org/index.php?topic=71550.0 |
|||
mx_co_th = 1.5 - 0.1; |
|||
mx_co_b_add = 1.0; |
|||
mx_co_b_w = mx_co_w + mx_co_b_add; |
|||
mx_co_b_h = mx_co_h + mx_co_b_add; |
|||
|
|||
mx_travel = 3.9; |
|||
|
|||
// ###################### |
|||
// ### Implementation ### |
|||
// ###################### |
|||
|
|||
roller_thread_dia = roller_dia + 5.0; |
|||
roller_h = roller_dia + 7.0; |
|||
roller_ball_h_off = 0.4; |
|||
roller_ball_hold_off = 0.5; |
|||
roller_thread_hole = roller_dia - 1; |
|||
roller_small_hole = sphere_r_at_h(roller_ball_hold_off, roller_dia / 2) * 2; |
|||
|
|||
roller_ridge_h = 1.5; |
|||
roller_mount_angle_off = 90; |
|||
roller_mount_dia = roller_thread_dia + 2.0; |
|||
|
|||
function sphere_r_at_h(h, r) = r * sin(acos(h / r)); |
|||
function sphere_angle_at_rh(h, r) = acos(h / r); |
|||
|
|||
|
|||
module roller_holder() { |
|||
|
|||
echo(roller_h); |
|||
translate([0, 0, -roller_h + roller_dia / 2]) |
|||
difference() { |
|||
color("magenta") |
|||
union() { |
|||
// top screw part |
|||
translate([0, 0, roller_h-roller_dia/2 + roller_ball_h_off-3]) |
|||
cylinder(d1 = roller_mount_dia, d2=roller_dia+1, h = 3); |
|||
cylinder(d = roller_mount_dia, h = roller_h-roller_dia/2 + roller_ball_h_off-3); |
|||
|
|||
} |
|||
|
|||
translate([0, 0, -$e]) { |
|||
cylinder(d = roller_thread_hole, h = $e+ roller_h - roller_dia / 2 + roller_ball_h_off + roller_ball_hold_off); |
|||
} |
|||
|
|||
translate([0, 0, roller_h - roller_dia / 2]) |
|||
sphere(d = roller_dia , $fn=$fn*4 ); |
|||
|
|||
|
|||
if (cut_roller_holder) { |
|||
translate([-roller_thread_dia / 2 - 1, -roller_thread_dia, -1]) |
|||
cube([roller_thread_dia + 2, roller_thread_dia, roller_h + 2]); |
|||
} |
|||
} |
|||
|
|||
%color("blue") |
|||
sphere(d = roller_dia); |
|||
} |
|||
|
|||
module roller_mount() { |
|||
echo(roller_h); |
|||
translate([0, 0, -1-roller_h + roller_dia / 2]) { |
|||
difference() { |
|||
cylinder(d=roller_mount_dia+wall,h=roller_h/2); |
|||
translate([0,0,1]) |
|||
cylinder(d=roller_mount_dia+$c*2,h=roller_h/2+$e); |
|||
} |
|||
} |
|||
} |
|||
|
|||
module roller_mount_test() { |
|||
roller_holder(); |
|||
roller_mount(); |
|||
} |
|||
|
|||
module roller_mount_tri() { |
|||
|
|||
difference() { |
|||
union(){ |
|||
difference() { |
|||
hull() { |
|||
translate([0, 0, 0]) |
|||
for (r = [0 : roller_count - 1]) |
|||
rotate([0, 0, roller_mount_angle_off + 360 / roller_count * r]) |
|||
translate([sphere_r_at_h(roller_ball_h - ball_dia / 2, ball_dia / 2), 0, -ball_dia / 2 + roller_ball_h]) |
|||
rotate([0, 180 + sphere_angle_at_rh(roller_ball_h - ball_dia / 2, ball_dia / 2), 0]) |
|||
translate([0, 0, -roller_h]) |
|||
cylinder(d=roller_mount_dia+wall+1,h=roller_h+1); |
|||
|
|||
translate([0,0,-ball_dia/2-5]) |
|||
cylinder(d=base_dia,h=$e); |
|||
} |
|||
|
|||
for (r = [0 : roller_count - 1]) |
|||
rotate([0, 0, roller_mount_angle_off + 360 / roller_count * r]) |
|||
translate([sphere_r_at_h(roller_ball_h - ball_dia / 2, ball_dia / 2), 0, -ball_dia / 2 + roller_ball_h]) |
|||
rotate([0, 180 + sphere_angle_at_rh(roller_ball_h - ball_dia / 2, ball_dia / 2), 0]) |
|||
translate([0, 0, -roller_h]) |
|||
cylinder(d=roller_mount_dia+0.2,h=ball_dia/2+roller_h); |
|||
|
|||
sphere($fn=$fn*4, d=ball_dia+$c*2+1); |
|||
|
|||
} |
|||
for (r = [0 : roller_count - 1]) |
|||
rotate([0, 0, roller_mount_angle_off + 360 / roller_count * r]) |
|||
translate([sphere_r_at_h(roller_ball_h - ball_dia / 2, ball_dia / 2), 0, -ball_dia / 2 + roller_ball_h]) |
|||
rotate([0, 180 + sphere_angle_at_rh(roller_ball_h - ball_dia / 2, ball_dia / 2), 0]) |
|||
translate([0, 0, 0]) |
|||
roller_mount(); |
|||
} |
|||
|
|||
translate([0, 0, 0]) |
|||
for (r = [0 : roller_count - 1]) |
|||
rotate([0, 0, roller_mount_angle_off + 360 / roller_count * r]) |
|||
translate([sphere_r_at_h(roller_ball_h - ball_dia / 2, ball_dia / 2), 0, -ball_dia / 2 + roller_ball_h]) |
|||
rotate([0, 180 + sphere_angle_at_rh(roller_ball_h - ball_dia / 2, ball_dia / 2), 0]) |
|||
translate([0, 0, -roller_h/2]) |
|||
rotate([0,-90,0]) |
|||
translate([0,0,2]) |
|||
{ |
|||
cylinder(d=m2_thread,h=ball_dia); |
|||
translate([0,0,roller_mount_dia/4+wall]) |
|||
cylinder(d=m2_thread+1,h=ball_dia); |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
module ball_and_roller() { |
|||
color("red") |
|||
sphere(d = ball_dia, $fn = 200); |
|||
|
|||
for (r = [0 : roller_count - 1]) |
|||
rotate([0, 0, roller_mount_angle_off + 360 / roller_count * r]) |
|||
translate([sphere_r_at_h(roller_ball_h - ball_dia / 2, ball_dia / 2), 0, -ball_dia / 2 + roller_ball_h]) |
|||
rotate([0, 180 + sphere_angle_at_rh(roller_ball_h - ball_dia / 2, ball_dia / 2), 0]) |
|||
translate([0, 0, -roller_dia / 2]) |
|||
roller_holder(); |
|||
} |
|||
|
|||
module trackball() { |
|||
%translate([0, 0, ball_dia / 2 + ball_h]) |
|||
ball_and_roller(); |
|||
|
|||
%rotate([0, 180, 0]) |
|||
pico(); |
|||
|
|||
%translate([0, sensor_l / 2 - sensor_cut_off_y - sensor_cut_h + sensor_cut_edge_to_pin1 + sensor_pin1_to_optical_center, ball_h + sensor_chip_h - sensor_ball_to_chip_bottom]) |
|||
pmw3360_sensor(); |
|||
|
|||
translate([0, 0, ball_dia / 2 + ball_h]) |
|||
for (r = [0 : roller_count - 1]) |
|||
rotate([0, 0, roller_mount_angle_off + 360 / roller_count * r]) |
|||
translate([sphere_r_at_h(roller_ball_h - ball_dia / 2, ball_dia / 2), 0, -ball_dia / 2 + roller_ball_h]) |
|||
rotate([0, 180 + sphere_angle_at_rh(roller_ball_h - ball_dia / 2, ball_dia / 2), 0]) |
|||
translate([0, 0, -roller_dia / 2]) |
|||
translate([0, 0, -roller_h + roller_dia / 2 - roller_ball_h_off]) |
|||
roller_mount(); |
|||
|
|||
color("grey") |
|||
translate([0, 0, -8]) |
|||
cylinder(d = base_dia, h = wall); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue