Instantly share code, notes, and snippets.

Embed
What would you like to do?
OpenSCAD source code: Z-axis height probe to fit DW660 collet
// MPCNC Z Axis Height Probe for router collet
// Ed Nisley KE4ZNU - 2018-02-14
Layout = "Build"; // Build, Show
Section = false;
/* [Extrusion] */
ThreadThick = 0.25; // [0.20, 0.25]
ThreadWidth = 0.40; // [0.40]
/* [Hidden] */
Protrusion = 0.1; // [0.01, 0.1]
HoleWindage = 0.2;
inch = 25.4;
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
ID = 0;
OD = 1;
LENGTH = 2;
//- Adjust hole diameter to make the size come out right
module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
FixDia = Dia / cos(180/Sides);
cylinder(r=(FixDia + HoleWindage)/2,h=Height,$fn=Sides);
}
/* [Switch] */
SwitchBody = [7.8,6.8,7.0]; // PCB mount hardware extends infinitely to +Y
SwitchButton = [3.5,5.0,1.0]; // OD allows some clearance
SwitchClear = 5.0; // room for pad atop probe rod
SwitchZ = SwitchBody.z + SwitchButton.z + SwitchClear;
Sleeve = [1.5,2.5,15.0]; // tube around pogo pin
ShankOD = 0.25 * inch; // rod into tool collet
/* [Hidden] */
WallThick = 3.0; // basic wall & floor thickness
ProbeBody = [Sleeve[OD],
2*WallThick + sqrt(pow(SwitchBody.x,2) + pow(SwitchBody.y,2)),
3*ShankOD + SwitchZ + Sleeve[LENGTH]];
echo(str("Probe Body: ",ProbeBody));
NumSides = 2*4;
//-----
// Define shapes
module Switch() {
union() {
translate([0,0,SwitchBody.z/2])
cube(SwitchBody,center=true);
translate([0,ProbeBody[OD]/2 - SwitchBody.y/2,(SwitchBody.z + SwitchButton.z)/2])
cube([SwitchBody.x,ProbeBody[OD],SwitchBody.z + SwitchButton[LENGTH]],center=true);
translate([0,0,SwitchBody.z])
PolyCyl(SwitchButton[OD],SwitchButton[LENGTH] + SwitchClear,6);
}
}
module ProbeHolder() {
difference() {
hull() {
PolyCyl(Sleeve[OD] + 6*ThreadWidth,Protrusion,NumSides);
translate([0,0,Sleeve.z])
rotate(180/8)
PolyCyl(ProbeBody[OD],SwitchZ,NumSides);
translate([0,0,Sleeve.z + SwitchZ + 3*ShankOD - Protrusion])
PolyCyl(ShankOD + 10*ThreadWidth,Protrusion,NumSides);
}
translate([0,0,SwitchZ + Sleeve[LENGTH]])
rotate([0,180,0])
Switch();
translate([0,0,-Protrusion])
PolyCyl(Sleeve[OD],Sleeve[LENGTH] + 2*Protrusion,NumSides);
translate([0,0,Sleeve.z + SwitchZ - Protrusion])
PolyCyl(ShankOD,3*ShankOD + 2*Protrusion,NumSides);
if (Section)
translate([ProbeBody[OD]/2,0,ProbeBody[LENGTH]/2])
cube([ProbeBody[OD],2*ProbeBody[OD],ProbeBody[LENGTH] + 2*Protrusion],center=true);
}
}
//-----
// Build it
if (Layout == "Show")
ProbeHolder();
if (Layout == "Build") {
translate([0,0,ProbeBody.z])
rotate([0,180,0])
ProbeHolder();
}
@ednisley

This comment has been minimized.

Copy link
Owner

ednisley commented Feb 16, 2018

More details on my blog at https://wp.me/poZKh-7lS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment