diff --git a/libtest.png b/libtest.png index c1b9058..d58d74e 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/readme.md b/readme.md index 0932099..c4d41c3 100644 --- a/readme.md +++ b/readme.md @@ -3422,7 +3422,7 @@ NEMA stepper motor model. ### Modules | Module | Description | |:--- |:--- | -| ```NEMA(type, shaft_angle = 0)``` | Draw specified NEMA stepper motor | +| ```NEMA(type, shaft_angle = 0, jst_connector = false)``` | Draw specified NEMA stepper motor | | ```NEMA_outline(type)``` | 2D outline | | ```NEMA_screw_positions(type, n = 4)``` | Positions children at the screw holes | | ```NEMA_screws(type, screw, n = 4, screw_length = 8, earth = undef)``` | Place screws and optional earth tag | diff --git a/tests/png/stepper_motors.png b/tests/png/stepper_motors.png index eaea647..dec96db 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 68cc665..23747c3 100644 --- a/tests/stepper_motors.scad +++ b/tests/stepper_motors.scad @@ -24,7 +24,7 @@ use <../utils/layout.scad> module stepper_motors() layout([for(s = stepper_motors) NEMA_width(s)], 5) { rotate(180) - NEMA(stepper_motors[$i]); + NEMA(stepper_motors[$i], 0, $i > 1 && $i < 5); translate_z(4) NEMA_screws(stepper_motors[$i], M3_pan_screw, n = $i, earth = $i > 4 ? undef : $i - 1); diff --git a/vitamins/stepper_motor.scad b/vitamins/stepper_motor.scad index e97d892..baa8eca 100644 --- a/vitamins/stepper_motor.scad +++ b/vitamins/stepper_motor.scad @@ -23,6 +23,7 @@ include <../core.scad> include +include <../vitamins/pin_headers.scad> use <../utils/tube.scad> use <../utils/thread.scad> use @@ -39,7 +40,6 @@ function NEMA_shaft_length(type)= type[8]; //! Shaft length above the face, if a function NEMA_hole_pitch(type) = type[9]; //! Screw hole pitch 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"; stepper_cap_colour = grey(50); stepper_machined_colour = grey(90); @@ -52,7 +52,7 @@ module NEMA_outline(type) //! 2D outline circle(NEMA_radius(type)); } -module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor +module NEMA(type, shaft_angle = 0, jst_connector = false) { //! Draw specified NEMA stepper motor side = NEMA_width(type); length = NEMA_length(type); body_rad = NEMA_body_radius(type); @@ -92,12 +92,23 @@ module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor cap_shape(1); } - color(stepper_cap_colour) // aluminium end caps + tabSize = [16, 4, 2.5]; + color(stepper_cap_colour) { // aluminium end caps for(end = [-1, 1]) translate_z(-length / 2 + end * (length - cap) / 2) linear_extrude(cap, center = true) cap_shape(end); + 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); + if(show_threads) for(x = NEMA_holes(type), y = NEMA_holes(type)) translate([x, y, -cap / 2]) @@ -111,15 +122,16 @@ module NEMA(type, shaft_angle = 0) { //! Draw specified NEMA stepper motor cylinder(r = shaft_rad, h = shaft + 5); // shaft else not_on_bom() - leadscrew(shaft_rad * 2, shaft.x + 5, shaft.y, shaft.z, center = false) + leadscrew(shaft_rad * 2, shaft.x + 5, shaft.y, shaft.z, center = false); - translate([0, side / 2, -length + cap / 2]) - rotate([90, 0, 0]) - for(i = [0 : 3]) - rotate(225 + i * 90) - color(["red", "blue","green","black"][i]) - translate([1, 0, 0]) - cylinder(r = 1.5 / 2, h = 12, center = true); + if(!jst_connector) + translate([0, side / 2, -length + cap / 2]) + rotate([90, 0, 0]) + for(i = [0 : 3]) + rotate(225 + i * 90) + color(["red", "blue","green","black"][i]) + translate([1, 0, 0]) + cylinder(r = 1.5 / 2, h = 12, center = true); } module NEMA_screw_positions(type, n = 4) { //! Positions children at the screw holes diff --git a/vitamins/stepper_motors.scad b/vitamins/stepper_motors.scad index c27e3fd..820ff3a 100644 --- a/vitamins/stepper_motors.scad +++ b/vitamins/stepper_motors.scad @@ -23,13 +23,13 @@ // 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 ]; +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]; stepper_motors = [NEMA14, NEMA16, NEMA17S, NEMA17M, NEMA17, NEMA23];