Skip to content

Commit

Permalink
Servo modification
Browse files Browse the repository at this point in the history
  • Loading branch information
hugokernel committed Aug 16, 2012
1 parent 50b9a66 commit 98a5b57
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 51 deletions.
158 changes: 110 additions & 48 deletions cad/lib/servo_arm.scad
Original file line number Diff line number Diff line change
@@ -1,22 +1,69 @@
$fn = 40;
/**
* Parametric servo arm generator for OpenScad
* Générateur de palonnier de servo pour OpenScad
*
* Copyright (c) 2012 Charles Rincheval. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Last update :
* https://github.com/hugokernel/OpenSCAD_ServoArms
*
* http://www.digitalspirit.org/
*/

HOLDER_THICKNESS = 1.1;
SCREW_DIAMETER = 2.5;
$fn = 40;

// @Todo: add HOLDER_THICKNESS and SCREW_DIAMETER in Spline definition and eventually clear
/**
* Clear between arm head and servo head
* With PLA material, use clear : 0.3, for ABS, use 0.2
*/
SERVO_HEAD_CLEAR = 0.2;

/**
* 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
*
* First array (head related) :
* 0. Head external diameter
* 1. Head heigth
* 2. Head thickness
* 3. Head screw diameter
*
* Second array (tooth related) :
* 0. Tooth count
* 1. Tooth height
* 2. Tooth length
* 3. Tooth width
*/
FUTABA_3F_SPLINE = [5.92, 25, 0.3, 0.7, 0.1, 4];
FUTABA_3F_SPLINE = [
[5.92, 4, 1.1, 2.5],
[25, 0.3, 0.7, 0.1]
];

module servo_futaba_3f(length, count) {
servo_arm(FUTABA_3F_SPLINE, [length, count]);
}

/**
* If you want to support a new servo, juste add a new spline definition array
* and a module named like servo_XXX_YYY where XXX is servo brand and YYY is the
* connection type (3f) or the servo type (s3003)
*/

module servo_standard(length, count) {
servo_futaba_3f(length, count);
}
Expand All @@ -33,36 +80,39 @@ module servo_standard(length, count) {
* - tooth length (l)
* - tooth width (w)
* - tooth height (h)
* - thickness
* - height
*
*/
module servo_head_tooth(length, width, height, thickness) {
linear_extrude(height = thickness) {
module servo_head_tooth(length, width, height, head_height) {
linear_extrude(height = head_height) {
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
* Servo head
*/
module servo_head(params, clear = 0.2) {
module servo_head(params, clear = SERVO_HEAD_CLEAR) {

diameter = params[0];
count = params[1];
height = params[2];
length = params[3];
width = params[4];
thickness = params[5];
head = params[0];
tooth = params[1];

% cylinder(r = diameter / 2, h = thickness + 1);
head_diameter = head[0];
head_heigth = head[1];

cylinder(r = diameter / 2 - height + 0.03 + clear, h = thickness);
tooth_count = tooth[0];
tooth_height = tooth[1];
tooth_length = tooth[2];
tooth_width = tooth[3];

for (i = [0 : count]) {
rotate([0, 0, i * (360 / count)]) {
translate([0, diameter / 2 - height + clear, 0]) {
servo_head_tooth(length, width, height, thickness);
% cylinder(r = head_diameter / 2, h = head_heigth + 1);

cylinder(r = head_diameter / 2 - tooth_height + 0.03 + clear, h = head_heigth);

for (i = [0 : tooth_count]) {
rotate([0, 0, i * (360 / tooth_count)]) {
translate([0, head_diameter / 2 - tooth_height + clear, 0]) {
servo_head_tooth(tooth_length, tooth_width, tooth_height, head_heigth);
}
}
}
Expand All @@ -75,12 +125,16 @@ module servo_head(params, clear = 0.2) {
*/
module servo_arm(params, arms) {

diameter = params[0];
count = params[1];
height = params[2];
length = params[3];
width = params[4];
thickness = params[5];
head = params[0];
tooth = params[1];

head_diameter = head[0];
head_heigth = head[1];
head_thickness = head[2];
head_screw_diameter = head[3];

tooth_length = tooth[2];
tooth_width = tooth[3];

arm_length = arms[0];
arm_count = arms[1];
Expand All @@ -89,28 +143,34 @@ module servo_arm(params, arms) {
* Servo arm
* - length is from center to last hole
*/
module arm(length, width, head_height, thickness, hole_count = 1) {
module arm(tooth_length, tooth_width, head_height, head_heigth, hole_count = 1) {

screw_diameter = 2;
arm_screw_diameter = 2;

difference() {
union() {
cylinder(r = width / 2, h = thickness);
cylinder(r = tooth_width / 2, h = head_heigth);

linear_extrude(height = thickness) {
polygon([[-width / 2, 0], [-width / 3, length], [width / 3, length],[width / 2, 0]]);
linear_extrude(height = head_heigth) {
polygon([
[-tooth_width / 2, 0], [-tooth_width / 3, tooth_length],
[tooth_width / 3, tooth_length], [tooth_width / 2, 0]
]);
}

translate([0, length, 0]) {
cylinder(r = width / 3, h = thickness);
translate([0, tooth_length, 0]) {
cylinder(r = tooth_width / 3, h = head_heigth);
}

if (length >= 12) {
translate([-thickness / 2 + 2, 3.8, -4]) {
if (tooth_length >= 12) {
translate([-head_heigth / 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]]);
linear_extrude(height = head_heigth) {
polygon([
[-tooth_length / 1.7, 4], [0, 4], [0, - head_height + 5],
[-2, - head_height + 5]
]);
}
}
}
Expand All @@ -121,30 +181,32 @@ module servo_arm(params, arms) {
// 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);
translate([0, tooth_length - (4 * i), -1]) {
cylinder(r = arm_screw_diameter / 2, h = 10);
}
}

cylinder(r = SCREW_DIAMETER / 2, h = 10);
cylinder(r = head_screw_diameter / 2, h = 10);
}
}

difference() {
translate([0, 0, 0.1]) {
cylinder(r = diameter / 2 + HOLDER_THICKNESS, h = thickness + 1);
cylinder(r = head_diameter / 2 + head_thickness, h = head_heigth + 1);
}

cylinder(r = SCREW_DIAMETER / 2, h = 10);
cylinder(r = head_screw_diameter / 2, h = 10);

servo_head(params);
}

arm_thickness = head_thickness;

// Arm
translate([0, 0, thickness]) {
translate([0, 0, head_heigth]) {
for (i = [0 : arm_count - 1]) {
rotate([0, 0, i * (360 / arm_count)]) {
arm(arm_length, diameter + HOLDER_THICKNESS * 2, thickness, 2);
arm(arm_length, head_diameter + arm_thickness * 2, head_heigth, 2);
}
}
}
Expand Down
13 changes: 10 additions & 3 deletions cad/servo_arm.scad
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@

use <lib/servo_arm.scad>

rotate([0, 180, 0])
module short() {
servo_standard(8.5, 1);
//servo_standard(14, 1);
}

module long() {
servo_standard(14, 1);
}

rotate([0, 180, 0])
long();
//short();

0 comments on commit 98a5b57

Please sign in to comment.