diff --git a/readme.md b/readme.md index 1e3132b..52bfadb 100644 --- a/readme.md +++ b/readme.md @@ -3413,6 +3413,7 @@ NEMA stepper motor model. | ```NEMA_body_radius(type)``` | Body radius | | ```NEMA_boss_height(type)``` | Boss height | | ```NEMA_boss_radius(type)``` | Boss around the spindle radius | +| ```NEMA_cap_heights(type)``` | Height of the end cap at the corner and the side | | ```NEMA_hole_pitch(type)``` | Screw hole pitch | | ```NEMA_length(type)``` | Body length | | ```NEMA_radius(type)``` | End cap radius | diff --git a/tests/png/stepper_motors.png b/tests/png/stepper_motors.png index dec96db..2311a65 100644 Binary files a/tests/png/stepper_motors.png and b/tests/png/stepper_motors.png differ diff --git a/tests/stepper_motors.scad b/tests/stepper_motors.scad index 23747c3..d9706f9 100644 --- a/tests/stepper_motors.scad +++ b/tests/stepper_motors.scad @@ -22,12 +22,12 @@ include <../vitamins/stepper_motors.scad> use <../utils/layout.scad> module stepper_motors() - layout([for(s = stepper_motors) NEMA_width(s)], 5) { + layout([for(s = stepper_motors) NEMA_width(s)], 5) let(m = stepper_motors[$i]) { rotate(180) - NEMA(stepper_motors[$i], 0, $i > 1 && $i < 5); + NEMA(m, 0, m == NEMA17M || m == NEMA17M8); translate_z(4) - NEMA_screws(stepper_motors[$i], M3_pan_screw, n = $i, earth = $i > 4 ? undef : $i - 1); + NEMA_screws(m, M3_pan_screw, n = $i, earth = $i > 4 ? undef : $i - 1); } if($preview) diff --git a/vitamins/stepper_motor.scad b/vitamins/stepper_motor.scad index baa8eca..d7cd7d5 100644 --- a/vitamins/stepper_motor.scad +++ b/vitamins/stepper_motor.scad @@ -26,6 +26,7 @@ include include <../vitamins/pin_headers.scad> use <../utils/tube.scad> use <../utils/thread.scad> +use <../utils/round.scad> use use @@ -38,6 +39,8 @@ function NEMA_boss_height(type) = type[6]; //! Boss height function NEMA_shaft_dia(type) = type[7]; //! Shaft diameter function NEMA_shaft_length(type)= type[8]; //! Shaft length above the face, if a list then a leadscrew: length, lead, starts function NEMA_hole_pitch(type) = type[9]; //! Screw hole pitch +function NEMA_cap_heights(type) = type[10]; //! Height of the end cap at the corner and the side + function NEMA_holes(type) = [-NEMA_hole_pitch(type) / 2, NEMA_hole_pitch(type) / 2]; //! Screw positions for for loop function NEMA_big_hole(type) = NEMA_boss_radius(type) + 0.2; //! Clearance hole for the big boss stepper_body_colour = "black"; @@ -59,12 +62,13 @@ module NEMA(type, shaft_angle = 0, jst_connector = false) { //! Draw specified N boss_rad = NEMA_boss_radius(type); boss_height =NEMA_boss_height(type); shaft_rad = NEMA_shaft_dia(type) / 2; - cap = 8; + cap = NEMA_cap_heights(type)[1]; + cap2 = NEMA_cap_heights(type)[0]; vitamin(str("NEMA(", type[0], "): Stepper motor NEMA", round(NEMA_width(type) / 2.54), " x ", length, "mm")); - thread_d = 3; // Is this always the case? + thread_d = 3; // Is this always the case? module cap_shape(end) - difference() { + round(0.5, $fn = 32) difference() { intersection() { square([side, side], center = true); @@ -92,22 +96,40 @@ module NEMA(type, shaft_angle = 0, jst_connector = false) { //! Draw specified N cap_shape(1); } - tabSize = [16, 4, 2.5]; + pcb_thickness = 1.6; + header = jst_ph_header; + socket_size = hdr_box_size(header); + tabSize = [16, 4, cap - hdr_ra_height(header) - pcb_thickness]; color(stepper_cap_colour) { // aluminium end caps - for(end = [-1, 1]) + for(end = [-1, 1]) { translate_z(-length / 2 + end * (length - cap) / 2) linear_extrude(cap, center = true) cap_shape(end); + translate_z(-length / 2 + end * (length - cap2) / 2) + linear_extrude(cap2, center = true) + difference() { + cap_shape(end); + + circle(body_rad); + } + } + if(jst_connector) translate([-tabSize.x / 2, side / 2, -length]) cube(tabSize); } if(jst_connector) - translate([0, side / 2 - 2, -length + tabSize.z + 5.75 / 2]) - rotate([-90, 0, 0]) - jst_xh_header(jst_xh_header, 6); + translate([0, side / 2, -length + cap - hdr_ra_height(header)]) { + rotate(180) + not_on_bom() + jst_xh_header(header, 6, true); + + translate_z(-pcb_thickness / 2) + color("green") + cube([socket_size.x + 5 * 2, tabSize.y * 2, pcb_thickness], true); + } if(show_threads) for(x = NEMA_holes(type), y = NEMA_holes(type)) diff --git a/vitamins/stepper_motors.scad b/vitamins/stepper_motors.scad index 820ff3a..8f563d6 100644 --- a/vitamins/stepper_motors.scad +++ b/vitamins/stepper_motors.scad @@ -22,14 +22,14 @@ // // corner body boss boss shaft -// side, length, radius, radius, radius, depth, shaft, length, holes -NEMA17 = ["NEMA17", 42.3, 47, 53.6/2, 25, 11, 2, 5, 24, 31]; -NEMA17M = ["NEMA17M", 42.3, 40, 53.6/2, 25, 11, 2, 5, 20, 31]; -NEMA17M8= ["NEMA17M8", 42.3, 40, 53.6/2, 25, 11, 2, 8, [280, 8, 4], 31]; -NEMA17S = ["NEMA17S", 42.3, 34, 53.6/2, 25, 11, 2, 5, 24, 31]; -NEMA16 = ["NEMA16", 39.5, 19.2, 50.6/2, 50.6/2, 11, 2, 5, 12, 31]; -NEMA14 = ["NEMA14", 35.2, 36, 46.4/2, 21, 11, 2, 5, 21, 26]; -NEMA23 = ["NEMA23", 56.4, 51.2, 75.7/2, 35, 38.1/2, 1.6, 6.35, 24, 47.1]; +// side, length, radius, radius, radius, depth, shaft, length, holes, cap heights +NEMA17 = ["NEMA17", 42.3, 47, 53.6/2, 25, 11, 2, 5, 24, 31, [11.5, 9]]; +NEMA17M = ["NEMA17M", 42.3, 40, 53.6/2, 25, 11, 2, 5, 20, 31, [12.5, 11]]; +NEMA17M8= ["NEMA17M8", 42.3, 40, 53.6/2, 25, 11, 2, 8, [280, 8, 4], 31, [12.5, 11]]; +NEMA17S = ["NEMA17S", 42.3, 34, 53.6/2, 25, 11, 2, 5, 24, 31, [8, 8]]; +NEMA16 = ["NEMA16", 39.5, 19.2, 50.6/2, 50.6/2, 11, 2, 5, 12, 31, [8, 8]]; +NEMA14 = ["NEMA14", 35.2, 36, 46.4/2, 21, 11, 2, 5, 21, 26, [8, 8]]; +NEMA23 = ["NEMA23", 56.4, 51.2, 75.7/2, 35, 38.1/2, 1.6, 6.35, 24, 47.1, [8, 8]]; stepper_motors = [NEMA14, NEMA16, NEMA17S, NEMA17M, NEMA17, NEMA23];