Migrate motor modules to their own library file, may have cascading effects throughout different projects.

This commit is contained in:
mmcwilliams 2023-04-14 01:16:34 -04:00
parent bcb4625818
commit 9fffe97e6e
2 changed files with 116 additions and 83 deletions

View File

@ -137,76 +137,18 @@ module trap_cube(height = 19, top_x = 30, top_y = 34, bottom_x = 45, bottom_y =
} }
} }
module NEMA17_motor_shaft (L = 22.75) { // switch module
//shaft module optoswitch() {
difference(){ difference(){
cylinder(r = R(5), h = L, center = true, $fn = 30); union (){
translate([0, 4.5, 4.7]) cube([5, 5, L+1], center = true); color("gray") cube([24.5,3.5,6.4]);
color("gray")translate([6.63,0,0]) cube([4.45,11.3,6.3]);
color("gray")translate([13.63,0,0]) cube([4.45,11.3,6.3]);
}
for ( hole = [2.75,24.5-2.75] ){
rotate([90,0,0]) translate([hole,6.4/2,-4]) cylinder(r=1.5, h=4.5,$fn=40);
} }
} }
//NEMA17 Stepper
module NEMA17 ( H = 33 ) { //alt = 47.5
difference () {
cube([42, 42, H], center = true);
for (i = [0 : 3]) {
rotate([0, 0, (i * 90) + 45]) translate([29.7, 0, 0]) cube([5.5, 5.5, H + 1], center = true);
}
translate([31/2, 31/2, (H/2)-1.9]) cylinder(r = R(3), h = 4, center = true, $fn=30);
translate([-31/2, 31/2, (H/2)-1.9]) cylinder(r = R(3), h = 4, center = true, $fn=30);
translate([31/2, -31/2, (H/2)-1.9]) cylinder(r = R(3), h = 4, center = true, $fn=30);
translate([-31/2, -31/2, (H/2)-1.9]) cylinder(r = R(3), h = 4, center = true, $fn=30);
}
//pad
translate([0, 0, (H/2) + (1.9/2)]) {
cylinder(r = R(22), h = 1.9, center = true, $fn = 100);
}
//shaft
translate([0, 0, (H/2) + (22.75/2)]) {
NEMA17_motor_shaft();
}
}
module geared_motor_shaft () {
MOTOR_SHAFT_D = 6;
MOTOR_SHAFT_H = 16;
MOTOR_SHAFT_HOBBLE = 1;
difference () {
cylinder(r = R(MOTOR_SHAFT_D), h = MOTOR_SHAFT_H, center = true, $fn = 60);
translate([MOTOR_SHAFT_D - MOTOR_SHAFT_HOBBLE, 0, 0]) cube([MOTOR_SHAFT_D, MOTOR_SHAFT_D, MOTOR_SHAFT_H + 1], center = true);
}
}
//Geartisan Worm Gear Motor - JSX40-370
module geared_motor () {
MOTOR_MOUNT_X = 32.5;
MOTOR_MOUNT_Y = 17.5;
module motor_mount_pad (D, Z) {
difference () {
cylinder(r = R(D), h = Z, center = true, $fn = 40);
//bolt void
cylinder(r = R(2.5), h = Z + 1, center = true, $fn = 40);
}
}
module motor_mounts () {
Z = 1.5;
D = 7.5;
translate([MOTOR_MOUNT_X / 2, MOTOR_MOUNT_Y / 2, 0]) motor_mount_pad(D, Z);
translate([-MOTOR_MOUNT_X / 2, MOTOR_MOUNT_Y / 2, 0]) motor_mount_pad(D, Z);
translate([MOTOR_MOUNT_X / 2, -MOTOR_MOUNT_Y / 2, 0]) motor_mount_pad(D, Z);
translate([-MOTOR_MOUNT_X / 2, -MOTOR_MOUNT_Y / 2, 0]) motor_mount_pad(D, Z);
}
cube([46, 32, 21], center = true);
translate([(46 / 2) + (30 / 2), 0, 1.5]) rotate([0, 90, 0]) cylinder(r = 24 / 2, h = 30, center = true, $fn = 80);
translate([-(46 / 2) + 14.5, 0, -18.5]) rotate([0, 0, 90]) geared_motor_shaft();
//pad
translate([-(46 / 2) + 14.5, 0, -(1 / 2) - 10.5]) cylinder(r = 13 / 2, h = 1, center = true, $fn = 60);
//mount pads
translate([-0.5, 0, -(1.5 / 2) - 10.5]) motor_mounts();
} }
module opto_endstop () { module opto_endstop () {
@ -228,17 +170,3 @@ module opto_endstop () {
} }
} }
} }
// switch module
module optoswitch() {
difference(){
union (){
color("gray") cube([24.5,3.5,6.4]);
color("gray")translate([6.63,0,0]) cube([4.45,11.3,6.3]);
color("gray")translate([13.63,0,0]) cube([4.45,11.3,6.3]);
}
for ( hole = [2.75,24.5-2.75] ){
rotate([90,0,0]) translate([hole,6.4/2,-4]) cylinder(r=1.5, h=4.5,$fn=40);
}
}
}

105
motors.scad Normal file
View File

@ -0,0 +1,105 @@
include <./common.scad>;
//NEMA 17 Constants
NEMA17OuterWidth = 42;
NEMA17BoltD = 3;
NEMA17BoltSpacing = 31;
NEMA17BoltOffsetZ = -1.9;
NEMA17ShaftD = 5;
NEMA17PadD = 22;
NEMA17ShaftHobble = 4.5;
NEMA17ShaftHobbleZ = 4.7;
//Geared Motor Constants
GearedMotorBoxX = 46;
GearedMotorBoxY = 32;
GearedMotorBoxZ = 21;
GearedMotorMountX = 32.5;
GearedMotorMountY = 17.5;
GearedMotorShaftD = 6;
GearedMotorShaftH = 16;
GearedMotorShaftHobble = 1;
module NEMA17_motor_shaft (pos = [0, 0, 0], L = 22.75) {
//shaft
translate(pos) difference () {
cylinder(r = R(NEMA17ShaftD), h = L, center = true, $fn = 30);
translate([0, NEMA17ShaftHobble, NEMA17ShaftHobbleZ]) cube([NEMA17ShaftD, NEMA17ShaftD, L+1], center = true);
}
}
module NEMA17_bolt_void (pos = [0, 0, 0]) {
translate(pos) cylinder(r = R(NEMA17BoltD), h = 4, center = true, $fn=30);
}
module NEMA17_pad (pos = [0, 0, 0]) {
translate(pos) {
cylinder(r = R(NEMA17PadD), h = 1.9, center = true, $fn = 100);
}
}
//NEMA17 Stepper
module NEMA17 (pos = [0, 0, 0], H = 33 ) { //alt = 47.5
BoltX = NEMA17BoltSpacing / 2;
BoltY = NEMA17BoltSpacing / 2;
BoltZ = (H / 2) + NEMA17BoltOffsetZ;
translate(pos) {
difference () {
cube([NEMA17OuterWidth, NEMA17OuterWidth, H], center = true);
//corners
for (i = [0 : 3]) {
rotate([0, 0, (i * 90) + 45]) translate([29.7, 0, 0]) cube([5.5, 5.5, H + 1], center = true);
}
NEMA17_bolt_void([BoltX, BoltY, BoltZ]);
NEMA17_bolt_void([-BoltX, BoltY, BoltZ]);
NEMA17_bolt_void([BoltX, -BoltY, BoltZ]);
NEMA17_bolt_void([-BoltX, -BoltY, BoltZ]);
}
//pad
NEMA17_pad([0, 0, (H/2) + (1.9/2)]);
//shaft
NEMA17_motor_shaft([0, 0, (H/2) + (22.75/2)]);
}
}
module geared_motor_shaft (pos = [0, 0, 0], rot = [0, 0, 0]) {
translate(pos) rotate(rot) difference () {
cylinder(r = R(GearedMotorShaftD), h = GearedMotorShaftH, center = true, $fn = 60);
translate([GearedMotorShaftD - GearedMotorShaftHobble, 0, 0]) cube([GearedMotorShaftD, GearedMotorShaftD, GearedMotorShaftH + 1], center = true);
}
}
module geared_motor_mount_pad (pos = [0, 0, 0], D, Z) {
translate(pos) difference () {
cylinder(r = R(D), h = Z, center = true, $fn = 40);
//bolt void
cylinder(r = R(2.5), h = Z + 1, center = true, $fn = 40);
}
}
module geared_motor_mounts (pos = [0, 0, 0], MountX, MountY) {
MountX = GearedMotorMountX / 2;
MountY = GearedMotorMountY / 2;
Z = 1.5;
D = 7.5;
translate(pos) {
geared_motor_mount_pad([MountX, MountY, 0], D, Z);
geared_motor_mount_pad([-MountX, MountY, 0], D, Z);
geared_motor_mount_pad([MountX, -MountY, 0], D, Z);
geared_motor_mount_pad([-MountX, -MountY, 0], D, Z);
}
}
//Geartisan Worm Gear Motor - JSX40-370
module geared_motor (pos = [0, 0, 0]) {
translate(pos) {
cube([GearedMotorBoxX, GearedMotorBoxY, GearedMotorBoxZ], center = true);
translate([(GearedMotorBoxX / 2) + (30 / 2), 0, 1.5]) rotate([0, 90, 0]) cylinder(r = 24 / 2, h = 30, center = true, $fn = 80);
geared_motor_shaft([-(46 / 2) + 14.5, 0, -18.5], [0, 0, 90]);
//pad
translate([-(46 / 2) + 14.5, 0, -(1 / 2) - 10.5]) cylinder(r = 13 / 2, h = 1, center = true, $fn = 60);
//mount pads
geared_motor_mounts([-0.5, 0, -(1.5 / 2) - 10.5]);
}
}
geared_motor();