diff --git a/lib.scad b/lib.scad index 4c9c24d..3b07c7d 100644 --- a/lib.scad +++ b/lib.scad @@ -55,6 +55,7 @@ include include include include +include include include include diff --git a/libtest.png b/libtest.png index 1ca9821..159b1b1 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/libtest.scad b/libtest.scad index 6e07083..aecf635 100644 --- a/libtest.scad +++ b/libtest.scad @@ -92,6 +92,7 @@ use use use use +//use use use use @@ -430,13 +431,14 @@ cable_strip_y = sheets_y; box_sections_y = batteries_y; BLDC_y = steppers_y; +*translate([0, transformers_y]) + servo_motors(); translate([x4 + 200, belts_y + 58]) { belt_test(); translate([0, 60]) opengrab_test(); - } translate([x4 + 175, belts_y, -20]) diff --git a/readme.md b/readme.md index d226579..d54fd28 100644 --- a/readme.md +++ b/readme.md @@ -30,22 +30,22 @@ A list of changes classified as breaking, additions or fixes is maintained in [C Blowers Leadnuts SSRs Door_hinge Gears Teardrops Box_sections Light_strips Screws Door_latch Hanging_hole Bulldogs Linear_bearings Sealing_strip Drag_chain Horiholes - Buttons Magnets Shaft_couplings Fan_guard Layout - Cable_strips Mains_sockets Sheets Fixing_block Maths - Cameras Microswitches Spades Flat_hinge Offset - Circlips Microview Spools Foot Quadrant - Components Modules Springs Handle Round - DIP Nuts Stepper_motors PCB_mount Rounded_cylinder - D_connectors O_ring Swiss_clips PSU_shroud Rounded_polygon - Displays Opengrab Toggles Pocket_handle Rounded_triangle - Extrusion_brackets PCB Transformers Press_fit Sector - Extrusions PCBs Tubings Printed_box Sweep - Fans PSUs Variacs Printed_pulleys Thread - Fuseholder Panel_meters Veroboard Ribbon_clamp Tube - Geared_steppers Pillars Washers SSR_shroud - Green_terminals Pillow_blocks Wire Screw_knob - Hot_ends Pin_headers Zipties Socket_box - Hygrometer Pulleys Strap_handle + Buttons Magnets Servo_motors Fan_guard Layout + Cable_strips Mains_sockets Shaft_couplings Fixing_block Maths + Cameras Microswitches Sheets Flat_hinge Offset + Circlips Microview Spades Foot Quadrant + Components Modules Spools Handle Round + DIP Nuts Springs PCB_mount Rounded_cylinder + D_connectors O_ring Stepper_motors PSU_shroud Rounded_polygon + Displays Opengrab Swiss_clips Pocket_handle Rounded_triangle + Extrusion_brackets PCB Toggles Press_fit Sector + Extrusions PCBs Transformers Printed_box Sweep + Fans PSUs Tubings Printed_pulleys Thread + Fuseholder Panel_meters Variacs Ribbon_clamp Tube + Geared_steppers Pillars Veroboard SSR_shroud + Green_terminals Pillow_blocks Washers Screw_knob + Hot_ends Pin_headers Wire Socket_box + Hygrometer Pulleys Zipties Strap_handle --- @@ -3226,6 +3226,61 @@ Sealing strip from B&Q used to seal around the door of 3D printers. | 1 | `sealing_strip(100)` | Sealing strip 10mm x 4mm x 100mm | +Top + +--- + +## Servo_motors +BLDC servos for CNC machines + +[vitamins/servo_motors.scad](vitamins/servo_motors.scad) Object definitions. + +[vitamins/servo_motor.scad](vitamins/servo_motor.scad) Implementation. + +[tests/servo_motors.scad](tests/servo_motors.scad) Code for this example. + +### Properties +| Function | Description | +|:--- |:--- | +| `faceplate_boss_size(type)` | Centre boss outer d, inner d and height | +| `faceplate_hole_dia(type)` | Screw hole size | +| `faceplate_hole_pitch(type)` | Screw hole pitch | +| `faceplate_thickness(type)` | Thickness of the faceplate | +| `faceplate_width(type)` | Width of faceplate | +| `servo_motor_cap(type)` | Diameter height and corner radius of encoder cover | +| `servo_motor_faceplate(type)` | Face plate type | +| `servo_motor_length(type)` | Total length from the faceplate | +| `servo_motor_shaft(type)` | Shaft type | +| `shaft_diameter(type)` | Shaft diameter | +| `shaft_key_size(type)` | None | +| `shaft_length(type)` | Shaft length | +| `shaft_type(type)` | String to indicate the shaft type | + +### Functions +| Function | Description | +|:--- |:--- | +| `servo_motor_width(type)` | Width of the motor body | + +### Modules +| Module | Description | +|:--- |:--- | +| `faceplate_screw_positions(type)` | Position children at faceplate screw positions | +| `motor_faceplate(type)` | Draw specified motor faceplate | +| `motor_shaft(type)` | Draw the specified motor shaft | +| `servo_motor(type)` | Draw the specified servo | +| `servo_screw_positions(type)` | Position children at screw positions | + +![servo_motors](tests/png/servo_motors.png) + +### Vitamins +| Qty | Module call | BOM entry | +| ---:|:--- |:---| +| 1 | `servo_motor(Lichuan_M01330_80ST) ` | Servo Lichuan LCMT07L02NB-80M01330B 80ST mount 80 x 123mm | +| 1 | `servo_motor(Lichuan_M02430_80ST) ` | Servo Lichuan LCMT07L02NB-80M02430B 80ST mount 80 x 150mm | +| 1 | `servo_motor(Lichuan_M03530_80ST) ` | Servo Lichuan LCMT07L02NB-80M03530B 80ST mount 80 x 178mm | +| 1 | `servo_motor(Lichuan_M04030_80ST) ` | Servo Lichuan LCMT07L02NB-80M04030B 80ST mount 80 x 190mm | + + Top --- diff --git a/tests/png/servo_motors.png b/tests/png/servo_motors.png new file mode 100644 index 0000000..8e78380 Binary files /dev/null and b/tests/png/servo_motors.png differ diff --git a/tests/servo_motors.scad b/tests/servo_motors.scad new file mode 100644 index 0000000..09be68e --- /dev/null +++ b/tests/servo_motors.scad @@ -0,0 +1,31 @@ +// +// NopSCADlib Copyright Chris Palmer 2021 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> +use <../utils/layout.scad> + +include <../vitamins/servo_motors.scad> + +module servo_motors() + layout([for(s = servo_motors) servo_motor_width(s)], 10) let(s = servo_motors[$i]) { + rotate(-90) // Show the keyway + servo_motor(s); + } + +if($preview) + servo_motors(); diff --git a/vitamins/servo_motor.scad b/vitamins/servo_motor.scad new file mode 100644 index 0000000..208e0fe --- /dev/null +++ b/vitamins/servo_motor.scad @@ -0,0 +1,140 @@ +// +// NopSCADlib Copyright Niclas Hedhman 2018 +// niclas@hedhman.org +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . + +// +//! BLDC servos for CNC machines +// + +include <../core.scad> +include <../utils/tube.scad> +include <../utils/round.scad> +include <../utils/quadrant.scad> +include <../utils/rounded_cylinder.scad> + +function servo_motor_cap(type) = type[2]; //! Diameter height and corner radius of encoder cover +function servo_motor_length(type) = type[3]; //! Total length from the faceplate +function servo_motor_shaft(type) = type[4]; //! Shaft type +function servo_motor_faceplate(type) = type[5]; //! Face plate type + +function faceplate_width(type) = type[1]; //! Width of faceplate +function faceplate_thickness(type) = type[2]; //! Thickness of the faceplate +function faceplate_boss_size(type) = type[3]; //! Centre boss outer d, inner d and height +function faceplate_hole_pitch(type) = type[4]; //! Screw hole pitch +function faceplate_hole_dia(type) = type[5]; //! Screw hole size + +function servo_motor_width(type) = faceplate_width(servo_motor_faceplate(type)); //! Width of the motor body + +function shaft_type(type) = type[0]; //! String to indicate the shaft type +function shaft_diameter(type) = type[1]; //! Shaft diameter +function shaft_length(type) = type[2]; //! Shaft length +function shaft_key_size(type) = type[3]; //! Keyway [length, width, depth] + +module servo_motor(type) { //! Draw the specified servo + fplate = servo_motor_faceplate(type); + t = faceplate_thickness(fplate); + w = servo_motor_width(type); + inset = (w - faceplate_hole_pitch(fplate)) / 2; + cap = servo_motor_cap(type); + l = servo_motor_length(type); + + vitamin(str("servo_motor(", type[0], ") : Servo ", type[1], " ", fplate[0], " mount ", servo_motor_width(type), " x ", servo_motor_length(type), "mm")); + + color(grey(20)) + translate_z(-l + cap.z) { + linear_extrude(l - t - cap.z) + round(2) + difference() { + square([w, w], center = true); + + faceplate_screw_positions(fplate) + rotate($i * 90 + 180) + quadrant(w = 2 * inset, r = inset, center = true); + } + + vflip() + rounded_cylinder(r = cap.x / 2, r2 = cap.y, h = cap.z); + } + + motor_shaft(servo_motor_shaft(type)); + + motor_faceplate(fplate); +} + +module motor_shaft(type) { //! Draw the specified motor shaft + diameter = shaft_diameter(type); + length = shaft_length(type); + key_size = shaft_key_size(type); + key_r = key_size.y / 2; + + color("silver") + if( shaft_type(type) == "keyed" ) { + render() difference() { + cylinder(h = length, d = diameter); + + translate([diameter / 2, 0, length]) + rotate([0, 90, 0]) + slot(r = key_r, l = 2 * (key_size.x - key_r), h = 2 * key_size.z); + } + } +} + +module servo_screw_positions(type) //! Position children at screw positions + faceplate_screw_positions(servo_motor_faceplate(type)) + children(); + +module faceplate_screw_positions(type) //! Position children at faceplate screw positions + for($i = [0 : 3]) + let(corner = [[1, 1], [-1, 1], [-1,-1], [1, -1]][$i], pitch = faceplate_hole_pitch(type)) + translate(corner * pitch / 2) + children(); + +module motor_faceplate(type) { //! Draw specified motor faceplate + w = faceplate_width(type); + t = faceplate_thickness(type); + boss = faceplate_boss_size(type); + boss_r = boss[0] / 2; + boss_ir = boss[1] / 2; + boss_t = boss.z; + rad = 5; // corner radius + + translate_z(-t) { + color(silver) + linear_extrude(t) + difference() { + rounded_square([w - eps, w - eps], rad); + + faceplate_screw_positions(type) + circle(d = faceplate_hole_dia(type)); + } + + color(grey(10)) + translate_z(eps) + linear_extrude(t - 2 * eps) + difference() { + rounded_square([w, w], rad); + + faceplate_screw_positions(type) + circle(d = faceplate_hole_dia(type) + eps); + } + } + + color(grey(10)) + tube(h = boss_t, or = boss_r - eps, ir = boss_ir + eps, center = false); + + color(silver) + tube(h = boss_t - eps, or = boss_r, ir = boss_ir, center = false); +} diff --git a/vitamins/servo_motors.scad b/vitamins/servo_motors.scad new file mode 100644 index 0000000..9955ad8 --- /dev/null +++ b/vitamins/servo_motors.scad @@ -0,0 +1,33 @@ +// +// NopSCADlib Copyright Niclas Hedhman 2018 +// niclas@hedhman.org +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . + + +// type w, t, boss, pitch, screw dia +80ST_faceplate = [ "80ST", 80, 8, [70, 34, 3], 63.63, 6 ]; + +// type, dia, len, key length, width, depth +Shaft_19mm_keyed = [ "keyed", 19, 35, [25, 6, 3.5] ]; + +// Code, Description, Cap, Length, Shaft, Faceplate +Lichuan_M01330_80ST = [ "Lichuan_M01330_80ST", "Lichuan LCMT07L02NB-80M01330B", [70, 3, 38], 123, Shaft_19mm_keyed, 80ST_faceplate ]; +Lichuan_M02430_80ST = [ "Lichuan_M02430_80ST", "Lichuan LCMT07L02NB-80M02430B", [70, 3, 38], 150, Shaft_19mm_keyed, 80ST_faceplate ]; +Lichuan_M03530_80ST = [ "Lichuan_M03530_80ST", "Lichuan LCMT07L02NB-80M03530B", [70, 3, 38], 178, Shaft_19mm_keyed, 80ST_faceplate ]; +Lichuan_M04030_80ST = [ "Lichuan_M04030_80ST", "Lichuan LCMT07L02NB-80M04030B", [70, 3, 38], 190, Shaft_19mm_keyed, 80ST_faceplate ]; + +servo_motors = [Lichuan_M01330_80ST, Lichuan_M02430_80ST, Lichuan_M03530_80ST, Lichuan_M04030_80ST]; + +use