diff --git a/libtest.png b/libtest.png index 937eff5..54c1cd4 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/libtest.scad b/libtest.scad index f215de6..cda2a62 100644 --- a/libtest.scad +++ b/libtest.scad @@ -369,10 +369,10 @@ extrusions_y = panel_meters_y + 80; translate([x3, veroboard_y]) veroboard_test(); -translate([x3 + 70, veroboard_y + 30]) +translate([x3 + 60, veroboard_y + 20]) geared_steppers(); -translate([x3 + 140, veroboard_y + 20]) +translate([x3 + 160, ssrs_y]) pcb_mounts(); translate([x3 + 170, veroboard_y + 16]) diff --git a/readme.md b/readme.md index 85bc55c..4aac62d 100644 --- a/readme.md +++ b/readme.md @@ -1091,23 +1091,23 @@ Geared tin can steppers |:--- |:--- | | `gs_boss_d(type)` | Boss around the shaft diameter | | `gs_boss_h(type)` | Boss around the shaft height | -| `gs_bulge2_d(type)` | Plastic rear bulge depth from centre | -| `gs_bulge2_h(type)` | Plastic rear bulge height | -| `gs_bulge2_w(type)` | Plastic rear bulge width | -| `gs_bulge_d(type)` | Plastic bulge depth from centre | -| `gs_bulge_h(type)` | Plastic bulge height | -| `gs_bulge_w(type)` | Plastic bulge width | +| `gs_bulge(type)` | Plastic bulge width, depth, height, z offset | +| `gs_bulge2(type)` | Plastic rear bulge width, depth, height | | `gs_diameter(type)` | Can diameter | | `gs_flat_length(type)` | Shaft flat length | | `gs_height(type)` | Can height | | `gs_hole_d(type)` | Screw hole diameter | | `gs_lug_t(type)` | Screw lug thickness | | `gs_lug_w(type)` | Screw lug width | +| `gs_motor(type)` | Motor diameter and height if separate from gearbox | | `gs_offset(type)` | Offset of the shaft from the centre of the can | | `gs_pitch(type)` | Screw pitch | +| `gs_radius(type)` | Top - or bottom + corner radius | | `gs_shaft_d(type)` | Shaft diameter | | `gs_shaft_flat(type)` | Shaft width across the flats | | `gs_shaft_length(type)` | Shaft length | +| `gs_wire_d(type)` | Wire diameter | +| `gs_wires(type)` | Wire colours and grouping | ### Modules | Module | Description | @@ -1121,6 +1121,7 @@ Geared tin can steppers | Qty | Module call | BOM entry | | ---:|:--- |:---| | 1 | `geared_stepper(28BYJ_48)` | Geared stepper - 28BYJ-48 5V | +| 1 | `geared_stepper(35BYGHJ75)` | Geared stepper - 35BYGHJ75 0.4A | Top diff --git a/tests/geared_steppers.scad b/tests/geared_steppers.scad index ba9ef57..0ce436a 100644 --- a/tests/geared_steppers.scad +++ b/tests/geared_steppers.scad @@ -21,7 +21,7 @@ include <../vitamins/geared_steppers.scad> use <../utils/layout.scad> module geared_steppers() - layout([for(g = geared_steppers) gs_diameter(g)], 5) + layout([for(g = geared_steppers) max(gs_diameter(g), gs_pitch(g) + gs_lug_w(g) / 2)], 5) geared_stepper(geared_steppers[$i]); geared_steppers(); diff --git a/tests/png/geared_steppers.png b/tests/png/geared_steppers.png index e2e3a46..05e57d6 100644 Binary files a/tests/png/geared_steppers.png and b/tests/png/geared_steppers.png differ diff --git a/vitamins/geared_stepper.scad b/vitamins/geared_stepper.scad index e736645..3f643ae 100644 --- a/vitamins/geared_stepper.scad +++ b/vitamins/geared_stepper.scad @@ -26,89 +26,138 @@ use <../utils/round.scad> function gs_diameter(type) = type[2]; //! Can diameter function gs_height(type) = type[3]; //! Can height -function gs_pitch(type) = type[4]; //! Screw pitch -function gs_lug_w(type) = type[5]; //! Screw lug width -function gs_lug_t(type) = type[6]; //! Screw lug thickness -function gs_hole_d(type) = type[7]; //! Screw hole diameter -function gs_offset(type) = type[8]; //! Offset of the shaft from the centre of the can -function gs_boss_d(type) = type[9]; //! Boss around the shaft diameter -function gs_boss_h(type) = type[10]; //! Boss around the shaft height -function gs_shaft_d(type) = type[11]; //! Shaft diameter -function gs_shaft_flat(type) = type[12]; //! Shaft width across the flats -function gs_shaft_length(type) = type[13]; //! Shaft length -function gs_flat_length(type) = type[14]; //! Shaft flat length -function gs_bulge_w(type) = type[15]; //! Plastic bulge width -function gs_bulge_d(type) = type[16]; //! Plastic bulge depth from centre -function gs_bulge_h(type) = type[17]; //! Plastic bulge height -function gs_bulge2_w(type) = type[18]; //! Plastic rear bulge width -function gs_bulge2_d(type) = type[19]; //! Plastic rear bulge depth from centre -function gs_bulge2_h(type) = type[20]; //! Plastic rear bulge height +function gs_radius(type) = type[4]; //! Top - or bottom + corner radius +function gs_motor(type) = type[5]; //! Motor diameter and height if separate from gearbox +function gs_pitch(type) = type[6]; //! Screw pitch +function gs_lug_w(type) = type[7]; //! Screw lug width +function gs_lug_t(type) = type[8]; //! Screw lug thickness +function gs_hole_d(type) = type[9]; //! Screw hole diameter +function gs_offset(type) = type[10]; //! Offset of the shaft from the centre of the can +function gs_boss_d(type) = type[11]; //! Boss around the shaft diameter +function gs_boss_h(type) = type[12]; //! Boss around the shaft height +function gs_shaft_d(type) = type[13]; //! Shaft diameter +function gs_shaft_flat(type) = type[14]; //! Shaft width across the flats +function gs_shaft_length(type) = type[15]; //! Shaft length +function gs_flat_length(type) = type[16]; //! Shaft flat length +function gs_bulge(type) = type[17]; //! Plastic bulge width, depth, height, z offset +function gs_bulge2(type) = type[18]; //! Plastic rear bulge width, depth, height +function gs_wire_d(type) = type[19]; //! Wire diameter +function gs_wires(type) = type[20]; //! Wire colours and grouping module geared_stepper_screw_positions(type) //! Place children at the screw positions for(side = [-1, 1]) translate([side * gs_pitch(type) / 2, -gs_offset(type)]) children(); +motor_colour = "#9BA2AC"; +gearbox_colour = "#FFF7EE"; + module geared_stepper(type) { //! Draw the specified geared stepper vitamin(str("geared_stepper(", type[0], "): Geared stepper - ", type[1])); radius = gs_diameter(type) / 2; - height = gs_height(type); + motor = gs_motor(type); + height = gs_height(type) - motor.y; offset = gs_offset(type); - color("silver") { - translate([0, -offset]) - rounded_cylinder(r = radius, h = height, r2 = 1); + lug_t = gs_lug_t(type); + bulge = gs_bulge(type); + bulge_z = bulge[3]; + bulge2 = gs_bulge2(type); + wires = gs_wires(type); + + // Gearbox + color(motor.y ? gearbox_colour : motor_colour) { + difference() { + rad = gs_radius(type); + translate([0, -offset]) + if(rad >= 0) + rounded_cylinder(r = radius, h = height, r2 = rad); + else + translate_z(height) + vflip() + rounded_cylinder(r = radius, h = height, r2 = -rad); + + if(!lug_t) + geared_stepper_screw_positions(type) + cylinder(d = gs_hole_d(type), h = 10, center = true); + } cylinder(d = gs_boss_d(type), h = 2 * gs_boss_h(type), center = true); - linear_extrude(gs_lug_t(type)) - difference() { - hull() + if(lug_t) + linear_extrude(lug_t) + difference() { + hull() + geared_stepper_screw_positions(type) + circle(d = gs_lug_w(type)); + geared_stepper_screw_positions(type) - circle(d = gs_lug_w(type)); + circle(d = gs_hole_d(type)); + } - geared_stepper_screw_positions(type) - circle(d = gs_hole_d(type)); - } - - translate([0, -offset - radius, eps]) - cube([gs_bulge_w(type) - 2, 2 * (gs_bulge_d(type) - radius) - 2, 2 * eps], center = true); + if(!bulge_z) + translate([0, -offset - radius, eps]) + cube([bulge.x - 2, 2 * (bulge.y - radius) - 2, 2 * eps], center = true); } + + // Motor + if(motor.y) + color("#9BA2AC") + translate([0, -offset, height]) + rotate_extrude() + union() { + r = motor.x / 2; + rad = motor[2]; + square([r - rad, rad]); + + translate([0, motor.y - rad]) + square([r - rad, rad]); + + hull() + for(y = [2 * rad, motor.y - 2 * rad]) + translate([r - rad, y]) + circle(rad); + } + + // Shaft + f = gs_shaft_flat(type); + two_flats = f < 0; vflip() - color(brass) { + color(two_flats ? brass : gearbox_colour) { d = gs_shaft_d(type); h = gs_shaft_length(type); linear_extrude(h) intersection() { circle(d = d); - square([d + 1, gs_shaft_flat(type)], center = true); + translate([0, two_flats ? 0 : (f - d) / 2]) + square([d + 1, abs(f)], center = true); } cylinder(d = d, h = h - gs_flat_length(type)); } - color("skyblue") { - h1 = gs_bulge_h(type); - translate([0, - offset - radius, eps]) - rounded_rectangle([gs_bulge_w(type), 2 * (gs_bulge_d(type) - radius), h1], 0.5, center = false); + // Wire block + color(bulge_z ? "white" : "skyblue") { + translate([0, - offset - radius, eps + bulge[3]]) + rounded_rectangle([bulge.x, 2 * (bulge.y - radius), bulge.z], 0.5, center = false); - h2 = gs_bulge2_h(type); - translate([0, - offset, h1 + 1 - h2]) - linear_extrude(h2) - round(0.5) - intersection() { - circle(gs_bulge2_d(type)); + if(bulge2.z) + translate([0, - offset, bulge.z + 1 - bulge2.z]) + linear_extrude(bulge2.z) + round(0.5) + intersection() { + circle(bulge2.y); - translate([0, -50]) - square([gs_bulge2_w(type), 100], center = true); - } + translate([0, -50]) + square([bulge2.x, 100], center = true); + } } - translate_z(2.5) - for(i = [0 : 4]) - translate([i - 2.5, 0]) - rotate([90, 0, 0]) - color(["yellow", "orange", "red", "pink", "blue"][i]) - cylinder(d = 1, h = radius + offset + 10); + wire_d = gs_wire_d(type); + for(j = [0 : len(wires) - 1], i = [0 : len(wires[j]) - 1]) + translate([(i - len(wires[j]) / 2 + 0.5) * wire_d, 0, bulge_z + (j ? bulge.z - 2.5 : 2.5)]) + rotate([90, 0, 0]) + color(wires[j][i]) + cylinder(d = wire_d, h = radius + offset + 10); } diff --git a/vitamins/geared_steppers.scad b/vitamins/geared_steppers.scad index 917e89c..ae5bd9e 100644 --- a/vitamins/geared_steppers.scad +++ b/vitamins/geared_steppers.scad @@ -20,8 +20,16 @@ // //! Geared tin can steppers // -28BYJ_48 = ["28BYJ_48", "28BYJ-48 5V", 28, 19, 35, 7, 0.85, 4.2, 8, 9, 1.5, 5, 3, 10, 6, 14.7, 17, 16.5, 17.7, 15.5, 13.8 ]; +// d h r m p l l h o b b s f s f b b w +// i e a o i u u o f o o h l h l u u i +// a i d t t g g l f s s a a a a l l r +// g i o c e s s s f t f t g g e +// h u r h w t e t t e e +// t s d t d h w l 2 d +// d h r d l w d h z w d h +28BYJ_48 = ["28BYJ_48", "28BYJ-48 5V", 28, 19, 1, [ 0, 0, 0], 35, 7, 0.85, 4.2, 8, 9, 1.5, 5,-3.0, 10, 6, [14.7, 17, 16.5, 0], [17.7, 15.5, 13.8], 1, [["yellow", "orange", "red", "pink", "blue"]] ]; +35BYGHJ75 = ["35BYGHJ75", "35BYGHJ75 0.4A",37, 37, -2, [35, 22, 1], 27, 0, 0, 3.0, 7, 12, 3.0, 5, 4.5, 17, 10, [ 7.7, 20.7, 9.25, 21], [ 0, 0, 0], 1.3,[["brown", "red"], ["yellow", "green"]] ]; -geared_steppers = [28BYJ_48]; +geared_steppers = [28BYJ_48, 35BYGHJ75]; use