From 1c2f4e080d14834f9f5e91f4de7cdd953dc14d0a Mon Sep 17 00:00:00 2001 From: hugo Date: Wed, 15 Aug 2012 16:49:54 +0200 Subject: [PATCH] Servo arm + Thickness bug correction --- cad/leg.scad | 8 +-- cad/lib/servo_arm.scad | 159 +++++++++++++++++++++++++++++++++++++++++ cad/servo_arm.scad | 7 ++ 3 files changed, 170 insertions(+), 4 deletions(-) create mode 100644 cad/lib/servo_arm.scad create mode 100644 cad/servo_arm.scad diff --git a/cad/leg.scad b/cad/leg.scad index 8ed4e01..905cf7d 100755 --- a/cad/leg.scad +++ b/cad/leg.scad @@ -44,7 +44,7 @@ module arm(width, length, height, hole = [5, 5], gap_width = 0, gap_length = 0) // Long arm module long_arm() { difference() { - arm(15, 135, 4, [5, 2], 0, 0); + arm(15, 135, ARM_THICKNESS, [5, 2], 0, 0); translate([0, 12.5, -1]) { cylinder(h = 20, r1 = 2.5, r2 = 2.5); @@ -58,7 +58,7 @@ module long_arm() { module short_arm() { difference() { - arm(15, 80, 4, [5, 5], 0, 0); + arm(15, 80, ARM_THICKNESS, [5, 5], 0, 0); connection(); } } @@ -181,9 +181,9 @@ if (0) { } } } else { - //main_arm(); + main_arm(); //long_arm(); - short_arm(); + //short_arm(); //spacer(ARMS_SPACING, ARM_WIDTH, ARM_THICKNESS); //spacer(ARMS_SPACING + ARM_THICKNESS * 2 - 1, 15, ARM_THICKNESS); } diff --git a/cad/lib/servo_arm.scad b/cad/lib/servo_arm.scad new file mode 100644 index 0000000..942f61a --- /dev/null +++ b/cad/lib/servo_arm.scad @@ -0,0 +1,159 @@ +$fn = 40; + +HOLDER_THICKNESS = 1.1; +SCREW_DIAMETER = 2.5; + +// @Todo: add HOLDER_THICKNESS and SCREW_DIAMETER in Spline definition and eventually clear + +/** + * Head / Tooth parameters + * Futaba 3F Standard Spline + * http://www.servocity.com/html/futaba_servo_splines.html + * external diameter, tooth count, tooth height, tooth length, tooth width, thickness + */ +FUTABA_3F_SPLINE = [5.92, 25, 0.3, 0.7, 0.1, 4]; + +module servo_futaba_3f(length, count) { + servo_arm(FUTABA_3F_SPLINE, [length, count]); +} + +module servo_standard(length, count) { + servo_futaba_3f(length, count); +} + +/** + * Tooth + * + * |<-w->| + * |_____|___ + * / \ ^h + * _/ \_v + * |<--l-->| + * + * - tooth length (l) + * - tooth width (w) + * - tooth height (h) + * - thickness + * + */ +module servo_head_tooth(length, width, height, thickness) { + linear_extrude(height = thickness) { + polygon([[-length / 2, 0], [-width / 2, height], [width / 2, height], [length / 2,0]]); + } +} + +/** + * With PLA material, use clear at 0.3 + * For ABS, use 0.2 + */ +module servo_head(params, clear = 0.2) { + + diameter = params[0]; + count = params[1]; + height = params[2]; + length = params[3]; + width = params[4]; + thickness = params[5]; + + % cylinder(r = diameter / 2, h = thickness + 1); + + cylinder(r = diameter / 2 - height + 0.03 + clear, h = thickness); + + for (i = [0 : count]) { + rotate([0, 0, i * (360 / count)]) { + translate([0, diameter / 2 - height + clear, 0]) { + servo_head_tooth(length, width, height, thickness); + } + } + } +} + +/** + * Servo hold + * - Head / Tooth parameters + * - Arms params (length and count) + */ +module servo_arm(params, arms) { + + diameter = params[0]; + count = params[1]; + height = params[2]; + length = params[3]; + width = params[4]; + thickness = params[5]; + + arm_length = arms[0]; + arm_count = arms[1]; + + /** + * Servo arm + * - length is from center to last hole + */ + module arm(length, width, head_height, thickness, hole_count = 1) { + + screw_diameter = 2; + + difference() { + union() { + cylinder(r = width / 2, h = thickness); + + linear_extrude(height = thickness) { + polygon([[-width / 2, 0], [-width / 3, length], [width / 3, length],[width / 2, 0]]); + } + + translate([0, length, 0]) { + cylinder(r = width / 3, h = thickness); + } + + if (length >= 12) { + translate([-thickness / 2 + 2, 3.8, -4]) { + rotate([90, 0, 0]) { + rotate([0, -90, 0]) { + linear_extrude(height = thickness) { + polygon([[-length / 1.7, 4], [0, 4], [0, - head_height + 5], [-2, - head_height + 5]]); + } + } + } + } + } + } + + // Hole + for (i = [0 : hole_count - 1]) { + //translate([0, length - (length / hole_count * i), -1]) { + translate([0, length - (4 * i), -1]) { + cylinder(r = screw_diameter / 2, h = 10); + } + } + + cylinder(r = SCREW_DIAMETER / 2, h = 10); + } + } + + difference() { + translate([0, 0, 0.1]) { + cylinder(r = diameter / 2 + HOLDER_THICKNESS, h = thickness + 1); + } + + cylinder(r = SCREW_DIAMETER / 2, h = 10); + + servo_head(params); + } + + // Arm + translate([0, 0, thickness]) { + for (i = [0 : arm_count - 1]) { + rotate([0, 0, i * (360 / arm_count)]) { + arm(arm_length, diameter + HOLDER_THICKNESS * 2, thickness, 2); + } + } + } +} + +module demo() { + rotate([0, 180, 0]) + servo_standard(20, 4); +} + +demo(); + diff --git a/cad/servo_arm.scad b/cad/servo_arm.scad new file mode 100644 index 0000000..8b82ff8 --- /dev/null +++ b/cad/servo_arm.scad @@ -0,0 +1,7 @@ + +use + +rotate([0, 180, 0]) + //servo_standard(8.5, 1); + servo_standard(14, 1); +