Skip to content

Commit

Permalink
Leg sensor + elec
Browse files Browse the repository at this point in the history
  • Loading branch information
hugokernel committed Feb 3, 2013
1 parent 9adee7b commit f417d11
Show file tree
Hide file tree
Showing 17 changed files with 20,144 additions and 181 deletions.
121 changes: 121 additions & 0 deletions cad/leg_sensor.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@

use <spacer.scad>
use <lib/polyScrewThread.scad>

$fn = 50;

ARM_THICKNESS = 3.8;

ARMS_SPACING = 20;
ARM_WIDTH = 20;

SUPPORT_HEIGHT = 25;
SUPPORT_DIAMETER = 7.7;

SCREW_DIAMETER = 2.7;

module sensor_support_top() {
clear = 0.2;
difference() {
cylinder(r = ARMS_SPACING / 2, h = SUPPORT_HEIGHT);

// 1
translate([0, 0, SUPPORT_HEIGHT - 15]) {
cylinder(r = 3.5, h = 15);
}

// 2
cylinder(r = 2.5, h = SUPPORT_HEIGHT);

// 3
cylinder(r = 6.5, h = 8.5);

holes();

torus(7);
}
}

module sensor() {
clear = 0.98;

scale([clear, clear, clear]) {
cylinder(r = 6.5, h = 8.5);
holes(false);
}

torus();
}

module torus(size = 5.5) {
translate([0, 0, 8.5 / 2]) {
rotate_extrude(convexity = 10, $fn = 100) {
translate([size, 0, 0]) {
circle(r = 1, $fn = 100);
}
}
}
}

module holes(complete = true) {
// Holes
translate([0, 6.3, 0]) {
hole(complete);
}

translate([0, -6.3, 0]) {
hole(complete);
}

translate([6.3, 0, 0]) {
hole(complete);
}

translate([-6.3, 0, 0]) {
hole(complete);
}
}

module hole(complete = true) {
if (complete) {
cylinder(r = 1.5, h = SUPPORT_HEIGHT);
}

cylinder(r = 2.5, h = 15.5);
}

module thread() {
/* Bolt parameters.
*
* Just how thick is the head.
* The other parameters, common to bolt and nut, are defined into k_cyl() module
*/
b_hg=0; //distance of knurled head

$fn = 36;
PI=3.141592;
/* Screw thread parameters
*/
t_od=13; // Thread outer diameter
t_st=2.5; // Step/traveling per turn
t_lf=55; // Step angle degrees
t_ln=7.5; // Length of the threade section
t_rs=PI/2; // Resolution
t_se=1; // Thread ends style
t_gp=0; // Gap between nut and bolt threads

screw_thread(t_od+t_gp, t_st, t_lf, t_ln, t_rs, t_se);
}

module base() {
translate([0, 0, -7.5]) {
//thread();
}

sensor();
}

//base();

sensor_support_top();

172 changes: 172 additions & 0 deletions cad/lib/polyScrewThread.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*
* polyScrewThread.scad by aubenc @ Thingiverse
*
* This script contains the library modules that can be used to generate
* threaded rods, screws and nuts.
*
* http://www.thingiverse.com/thing:8796
*
* CC Public Domain
*/

module screw_thread(od,st,lf0,lt,rs,cs)
{
or=od/2;
ir=or-st/2*cos(lf0)/sin(lf0);
pf=2*PI*or;
sn=floor(pf/rs);
lfxy=360/sn;
ttn=round(lt/st)+1;
zt=st/sn;

intersection()
{
if (cs >= -1)
{
# thread_shape(cs,lt,or,ir,sn,st);
}

full_thread(ttn,st,sn,zt,lfxy,or,ir);
}
}

module hex_nut(df,hg,sth,clf,cod,crs)
{

difference()
{
hex_head(hg,df);

hex_countersink_ends(sth/2,cod,clf,crs,hg);

screw_thread(cod,sth,clf,hg,crs,-2);
}
}

module hex_screw(od,st,lf0,lt,rs,cs,df,hg,ntl,ntd)
{
ntr=od/2-(st/2+0.1)*cos(lf0)/sin(lf0);

union()
{
hex_head(hg,df);

translate([0,0,hg])
if ( ntl == 0 )
{
cylinder(h=0.01, r=ntr, center=true);
}
else
{
if ( ntd == -1 )
{
cylinder(h=ntl+0.01, r=ntr, $fn=floor(od*PI/rs), center=false);
}
else if ( ntd == 0 )
{
union()
{
cylinder(h=ntl-st/2,
r=od/2, $fn=floor(od*PI/rs), center=false);

translate([0,0,ntl-st/2])
cylinder(h=st/2,
r1=od/2, r2=ntr,
$fn=floor(od*PI/rs), center=false);
}
}
else
{
cylinder(h=ntl, r=ntd/2, $fn=ntd*PI/rs, center=false);
}
}

translate([0,0,ntl+hg]) screw_thread(od,st,lf0,lt,rs,cs);
}
}

module thread_shape(cs,lt,or,ir,sn,st)
{
if ( cs == 0 )
{
cylinder(h=lt, r=or, $fn=sn, center=false);
}
else
{
union()
{
translate([0,0,st/2])
cylinder(h=lt-st+0.005, r=or, $fn=sn, center=false);

if ( cs == -1 || cs == 2 )
{
cylinder(h=st/2, r1=ir, r2=or, $fn=sn, center=false);
}
else
{
cylinder(h=st/2, r=or, $fn=sn, center=false);
}

translate([0,0,lt-st/2])
if ( cs == 1 || cs == 2 )
{
cylinder(h=st/2, r1=or, r2=ir, $fn=sn, center=false);
}
else
{
cylinder(h=st/2, r=or, $fn=sn, center=false);
}
}
}
}

module full_thread(ttn,st,sn,zt,lfxy,or,ir)
{
for(i=[0:ttn-1])
{
for(j=[0:sn-1])
{
polyhedron(
points=[
[0, 0, i*st-st ],
[ir*cos((j+1)*lfxy), ir*sin((j+1)*lfxy), i*st+(j+1)*zt-st ],
[ir*cos(j*lfxy), ir*sin(j*lfxy), i*st+j*zt-st ],
[or*cos((j+1)*lfxy), or*sin((j+1)*lfxy), i*st+(j+1)*zt-st/2 ],
[or*cos(j*lfxy), or*sin(j*lfxy), i*st+j*zt-st/2 ],
[0, 0, i*st+st ],
[ir*cos((j+1)*lfxy), ir*sin((j+1)*lfxy), i*st+(j+1)*zt ],
[ir*cos(j*lfxy), ir*sin(j*lfxy), i*st+j*zt ]
],
triangles=[
[0,1,2],
[5,6,3],[5,3,0],[0,3,1],
[3,4,1],[1,4,2],
[3,6,4],[4,6,7],
[0,2,4],[0,4,5],[5,4,7],
[5,7,6]
],
convexity=5);
}
}
}

module hex_head(hg,df)
{
cylinder(h=hg, r=df/2/sin(60), $fn=6, center=false);
}

module hex_countersink_ends(chg,cod,clf,crs,hg)
{
translate([0,0,-0.1])
cylinder(h=chg+0.01,
r1=cod/2,
r2=cod/2-(chg+0.1)*cos(clf)/sin(clf),
$fn=floor(cod*PI/crs), center=false);

translate([0,0,hg-chg+0.1])
cylinder(h=chg+0.01,
r1=cod/2-(chg+0.1)*cos(clf)/sin(clf),
r2=cod/2,
$fn=floor(cod*PI/crs), center=false);
}

Loading

0 comments on commit f417d11

Please sign in to comment.