From fe87b29f79da4cde2d467bcc3c6fcaafbc263117 Mon Sep 17 00:00:00 2001 From: lukas Date: Wed, 6 Jan 2021 00:50:35 +0100 Subject: [PATCH] add motor model add linear rail --- 3dprinter.scad | 29 ++++- Motor.scad | 312 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 335 insertions(+), 6 deletions(-) create mode 100644 Motor.scad diff --git a/3dprinter.scad b/3dprinter.scad index c0b207f..7501dee 100644 --- a/3dprinter.scad +++ b/3dprinter.scad @@ -2,6 +2,7 @@ use ; use ; use ; use ; +use ; bottmoutline(); bottomAngleBrackets(); @@ -10,6 +11,7 @@ horizontalProfile(); YAxis(); printBed(); +zMotor(); module bottmoutline() { @@ -19,6 +21,10 @@ module bottmoutline() { translate([0, - 40, 0]) rotate([0, 0, 90]) aluProfile(480); translate([440, - 40, 0]) rotate([0, 0, 90]) aluProfile(480); + + // linear rails + translate([70, 0, 20]) rotate([-90, 0, 0]) linear_rail(400); + translate([330, 0, 20]) rotate([-90, 0, 0]) linear_rail(400); } module bottomAngleBrackets() { @@ -44,20 +50,27 @@ module horizontalProfile() { // angle brackets up translate([- 40, 220, height]) rotate([90, 90, 0]) angle_bracket(); - translate([440, 180, height]) rotate([-90, 90, 0]) angle_bracket(); + translate([440, 180, height]) rotate([- 90, 90, 0]) angle_bracket(); } module YAxis() { translate([160, 0, 0]) Motorhalter(); translate([214, 400, 0]) rotate([0, 0, 180]) YRollHolder(); + + translate([202.5, 26.6, 21]) rotate([0, -90, 0]) Nema17(); } -module printBed(){ - translate([50,50,50]) halfAluProfile(300); - translate([50,300,50]) halfAluProfile(300); - translate([90,90,50]) rotate([0,0,90]) halfAluProfile(220); - translate([350,90,50]) rotate([0,0,90]) halfAluProfile(220); +module printBed() { + translate([50, 50, 50]) halfAluProfile(300); + translate([50, 300, 50]) halfAluProfile(300); + translate([90, 90, 50]) rotate([0, 0, 90]) halfAluProfile(220); + translate([350, 90, 50]) rotate([0, 0, 90]) halfAluProfile(220); +} + +module zMotor(){ + translate([20, 200, 41]) rotate([0, 180, 0]) Nema17(); + translate([380, 200, 41]) rotate([0, 180, 0]) Nema17(); } // -- MODULES -- // @@ -68,4 +81,8 @@ module aluProfile(length) { module halfAluProfile(length) { color("#dddddd") cube([length, 40, 20]); +} + +module linear_rail(length) { + color("#cccccc") cylinder(h = length, d = 8, $fn=33); } \ No newline at end of file diff --git a/Motor.scad b/Motor.scad new file mode 100644 index 0000000..dde0124 --- /dev/null +++ b/Motor.scad @@ -0,0 +1,312 @@ +mm = 1; +cm = 10 * mm; +dm = 100 * mm; +m = 1000 * mm; + +inch = 25.4 * mm; + +X = [1, 0, 0]; +Y = [0, 1, 0]; +Z = [0, 0, 1]; + + +// When a small distance is needed to overlap shapes for boolean cutting, etc. +//epsilon = 0.01*mm; +/* + * Material colors. + * + * Originally by Hans Häggström, 2010. + * Dual licenced under Creative Commons Attribution-Share Alike 3.0 and LGPL2 or later + */ + +// Material colors +Oak = [0.65, 0.5, 0.4]; +Pine = [0.85, 0.7, 0.45]; +Birch = [0.9, 0.8, 0.6]; +FiberBoard = [0.7, 0.67, 0.6]; +BlackPaint = [0.2, 0.2, 0.2]; +Iron = [0.36, 0.33, 0.33]; +Steel = [0.65, 0.67, 0.72]; +Stainless = [0.45, 0.43, 0.5]; +Aluminum = [0.77, 0.77, 0.8]; +Brass = [0.88, 0.78, 0.5]; +Transparent = [1, 1, 1, 0.2]; + + +// Parameters: +NemaModel = 0; +NemaLengthShort = 1; +NemaLengthMedium = 2; +NemaLengthLong = 3; +NemaSideSize = 4; +NemaDistanceBetweenMountingHoles = 5; +NemaMountingHoleDiameter = 6; +NemaMountingHoleDepth = 7; +NemaMountingHoleLip = 8; +NemaMountingHoleCutoutRadius = 9; +NemaEdgeRoundingRadius = 10; +NemaRoundExtrusionDiameter = 11; +NemaRoundExtrusionHeight = 12; +NemaAxleDiameter = 13; +NemaFrontAxleLength = 14; +NemaBackAxleLength = 15; +NemaAxleFlatDepth = 16; +NemaAxleFlatLengthFront = 17; +NemaAxleFlatLengthBack = 18; + +NemaA = 1; +NemaB = 2; +NemaC = 3; + +NemaShort = NemaA; +NemaMedium = NemaB; +NemaLong = NemaC; + +// TODO: The small motors seem to be a bit too long, I picked the size specs from all over the place, is there some canonical reference? +Nema08 = [ + [NemaModel, 8], + [NemaLengthShort, 33*mm], + [NemaLengthMedium, 43*mm], + [NemaLengthLong, 43*mm], + [NemaSideSize, 20*mm], + [NemaDistanceBetweenMountingHoles, 15.4*mm], + [NemaMountingHoleDiameter, 2*mm], + [NemaMountingHoleDepth, 1.75*mm], + [NemaMountingHoleLip, -1*mm], + [NemaMountingHoleCutoutRadius, 0*mm], + [NemaEdgeRoundingRadius, 2*mm], + [NemaRoundExtrusionDiameter, 16*mm], + [NemaRoundExtrusionHeight, 1.5*mm], + [NemaAxleDiameter, 4*mm], + [NemaFrontAxleLength, 13.5*mm], + [NemaBackAxleLength, 9.9*mm], + [NemaAxleFlatDepth, -1*mm], + [NemaAxleFlatLengthFront, 0*mm], + [NemaAxleFlatLengthBack, 0*mm] + ]; + +Nema11 = [ + [NemaModel, 11], + [NemaLengthShort, 32*mm], + [NemaLengthMedium, 40*mm], + [NemaLengthLong, 52*mm], + [NemaSideSize, 28*mm], + [NemaDistanceBetweenMountingHoles, 23*mm], + [NemaMountingHoleDiameter, 2.5*mm], + [NemaMountingHoleDepth, 2*mm], + [NemaMountingHoleLip, -1*mm], + [NemaMountingHoleCutoutRadius, 0*mm], + [NemaEdgeRoundingRadius, 2.5*mm], + [NemaRoundExtrusionDiameter, 22*mm], + [NemaRoundExtrusionHeight, 1.8*mm], + [NemaAxleDiameter, 5*mm], + [NemaFrontAxleLength, 13.7*mm], + [NemaBackAxleLength, 10*mm], + [NemaAxleFlatDepth, 0.5*mm], + [NemaAxleFlatLengthFront, 10*mm], + [NemaAxleFlatLengthBack, 9*mm] + ]; + +Nema14 = [ + [NemaModel, 14], + [NemaLengthShort, 26*mm], + [NemaLengthMedium, 28*mm], + [NemaLengthLong, 34*mm], + [NemaSideSize, 35.3*mm], + [NemaDistanceBetweenMountingHoles, 26*mm], + [NemaMountingHoleDiameter, 3*mm], + [NemaMountingHoleDepth, 3.5*mm], + [NemaMountingHoleLip, -1*mm], + [NemaMountingHoleCutoutRadius, 0*mm], + [NemaEdgeRoundingRadius, 5*mm], + [NemaRoundExtrusionDiameter, 22*mm], + [NemaRoundExtrusionHeight, 1.9*mm], + [NemaAxleDiameter, 5*mm], + [NemaFrontAxleLength, 18*mm], + [NemaBackAxleLength, 10*mm], + [NemaAxleFlatDepth, 0.5*mm], + [NemaAxleFlatLengthFront, 15*mm], + [NemaAxleFlatLengthBack, 9*mm] + ]; + +Nema17 = [ + [NemaModel, 17], + [NemaLengthShort, 33*mm], + [NemaLengthMedium, 39*mm], + [NemaLengthLong, 47*mm], + [NemaSideSize, 42.20*mm], + [NemaDistanceBetweenMountingHoles, 31.04*mm], + [NemaMountingHoleDiameter, 4*mm], + [NemaMountingHoleDepth, 4.5*mm], + [NemaMountingHoleLip, -1*mm], + [NemaMountingHoleCutoutRadius, 0*mm], + [NemaEdgeRoundingRadius, 7*mm], + [NemaRoundExtrusionDiameter, 22*mm], + [NemaRoundExtrusionHeight, 1.9*mm], + [NemaAxleDiameter, 5*mm], + [NemaFrontAxleLength, 18*mm], + [NemaBackAxleLength, 15*mm], + [NemaAxleFlatDepth, 0.5*mm], + [NemaAxleFlatLengthFront, 15*mm], + [NemaAxleFlatLengthBack, 14*mm] + ]; + +Nema23 = [ + [NemaModel, 23], + [NemaLengthShort, 39*mm], + [NemaLengthMedium, 54*mm], + [NemaLengthLong, 76*mm], + [NemaSideSize, 56.4*mm], + [NemaDistanceBetweenMountingHoles, 47.14*mm], + [NemaMountingHoleDiameter, 4.75*mm], + [NemaMountingHoleDepth, 5*mm], + [NemaMountingHoleLip, 4.95*mm], + [NemaMountingHoleCutoutRadius, 9.5*mm], + [NemaEdgeRoundingRadius, 2.5*mm], + [NemaRoundExtrusionDiameter, 38.10*mm], + [NemaRoundExtrusionHeight, 1.52*mm], + [NemaAxleDiameter, 6.36*mm], + [NemaFrontAxleLength, 18.80*mm], + [NemaBackAxleLength, 15.60*mm], + [NemaAxleFlatDepth, 0.5*mm], + [NemaAxleFlatLengthFront, 16*mm], + [NemaAxleFlatLengthBack, 14*mm] + ]; + +Nema34 = [ + [NemaModel, 34], + [NemaLengthShort, 66*mm], + [NemaLengthMedium, 96*mm], + [NemaLengthLong, 126*mm], + [NemaSideSize, 85*mm], + [NemaDistanceBetweenMountingHoles, 69.58*mm], + [NemaMountingHoleDiameter, 6.5*mm], + [NemaMountingHoleDepth, 5.5*mm], + [NemaMountingHoleLip, 5*mm], + [NemaMountingHoleCutoutRadius, 17*mm], + [NemaEdgeRoundingRadius, 3*mm], + [NemaRoundExtrusionDiameter, 73.03*mm], + [NemaRoundExtrusionHeight, 1.9*mm], + [NemaAxleDiameter, 0.5*inch], + [NemaFrontAxleLength, 37*mm], + [NemaBackAxleLength, 34*mm], + [NemaAxleFlatDepth, 1.20*mm], + [NemaAxleFlatLengthFront, 25*mm], + [NemaAxleFlatLengthBack, 25*mm] + ]; + + + +function motorWidth(model=Nema23) = lookup(NemaSideSize, model); +function motorLength(model=Nema23, size=NemaMedium) = lookup(size, model); + + +module motor(model=Nema23, size=NemaMedium, pos=[0,0,0], orientation = [0,0,0]) { + + length = lookup(size, model); + + echo(str(" Motor: Nema",lookup(NemaModel, model),", length= ",length,"mm")); + + stepperBlack = BlackPaint; + stepperAluminum = Aluminum; + + side = lookup(NemaSideSize, model); + + cutR = lookup(NemaMountingHoleCutoutRadius, model); + lip = lookup(NemaMountingHoleLip, model); + holeDepth = lookup(NemaMountingHoleDepth, model); + + axleLengthFront = lookup(NemaFrontAxleLength, model); + axleLengthBack = lookup(NemaBackAxleLength, model); + axleRadius = lookup(NemaAxleDiameter, model) * 0.5; + + extrSize = lookup(NemaRoundExtrusionHeight, model); + extrRad = lookup(NemaRoundExtrusionDiameter, model) * 0.5; + + holeDist = lookup(NemaDistanceBetweenMountingHoles, model) * 0.5; + holeRadius = lookup(NemaMountingHoleDiameter, model) * 0.5; + + mid = side / 2; + + roundR = lookup(NemaEdgeRoundingRadius, model); + + axleFlatDepth = lookup(NemaAxleFlatDepth, model); + axleFlatLengthFront = lookup(NemaAxleFlatLengthFront, model); + axleFlatLengthBack = lookup(NemaAxleFlatLengthBack, model); + + color(stepperBlack){ + translate(pos) rotate(orientation) { + translate([-mid, -mid, 0]) + difference() { + cube(size=[side, side, length + extrSize]); + + // Corner cutouts + if (lip > 0) { + translate([0, 0, lip]) cylinder(h=length, r=cutR); + translate([side, 0, lip]) cylinder(h=length, r=cutR); + translate([0, side, lip]) cylinder(h=length, r=cutR); + translate([side, side, lip]) cylinder(h=length, r=cutR); + + } + + // Rounded edges + if (roundR > 0) { + translate([mid+mid, mid+mid, length/2]) + rotate([0,0,45]) + cube(size=[roundR, roundR*2, 4+length + extrSize+2], center=true); + translate([mid-(mid), mid+(mid), length/2]) + rotate([0,0,45]) + cube(size=[roundR*2, roundR, 4+length + extrSize+2], center=true); + translate([mid+mid, mid-mid, length/2]) + rotate([0,0,45]) + cube(size=[roundR*2, roundR, 4+length + extrSize+2], center=true); + translate([mid-mid, mid-mid, length/2]) + rotate([0,0,45]) + cube(size=[roundR, roundR*2, 4+length + extrSize+2], center=true); + + } + + // Bolt holes + color(stepperAluminum, $fs=holeRadius/8) { + translate([mid+holeDist,mid+holeDist,-1*mm]) cylinder(h=holeDepth+1*mm+extrSize, r=holeRadius); + translate([mid-holeDist,mid+holeDist,-1*mm]) cylinder(h=holeDepth+1*mm+extrSize, r=holeRadius); + translate([mid+holeDist,mid-holeDist,-1*mm]) cylinder(h=holeDepth+1*mm+extrSize, r=holeRadius); + translate([mid-holeDist,mid-holeDist,-1*mm]) cylinder(h=holeDepth+1*mm+extrSize, r=holeRadius); + + } + + // Grinded flat + color(stepperAluminum) { + difference() { + translate([-1*mm, -1*mm, -1*mm]) + cube(size=[side+2*mm, side+2*mm, extrSize + 1*mm]); + translate([side/2, side/2, -1*mm]) + cylinder(h=extrSize + 1*mm, r=extrRad); + } + } + + } + + // Axle + translate([0, 0, extrSize-axleLengthFront]) color(stepperAluminum) + difference() { + + cylinder(h=axleLengthFront + 1*mm , r=axleRadius, $fs=axleRadius/10); + + // Flat + if (axleFlatDepth > 0) + translate([axleRadius - axleFlatDepth,-5*mm,-extrSize*mm -(axleLengthFront-axleFlatLengthFront)] ) cube(size=[5*mm, 10*mm, axleLengthFront]); + } + } + } +} + +module roundedBox(size, edgeRadius) { + cube(size); + +} + + +module Nema17(){ + motor(model=Nema17, size=NemaMedium, pos=[0,0,0], orientation = [0,0,0]); +}