Skip to content

Instantly share code, notes, and snippets.

@ednisley
Created February 21, 2018 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ednisley/d1a1980a21143ca59610181a2be6908c to your computer and use it in GitHub Desktop.
Save ednisley/d1a1980a21143ca59610181a2be6908c to your computer and use it in GitHub Desktop.
OpenSCAD source code: MPCNC Z height probe using Makerbot-style endstop
// MPCNC Z Axis Height Probe - MBI endstop in router collet
// Ed Nisley KE4ZNU - 2018-02-17
Layout = "Build"; // Build, Show
/* [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);
}
PCB = [40.0,1.6,16.5]; // endstop PCB, switch downward, facing parts
Touchpoint = [4.8,4.8,-4.5]; // contact point from PCB edges, solder side
TapeThick = 1.0; // foam mounting tape
ShankOD = 0.125 * inch; // rod into tool collet
ShankInsert = 3*ShankOD; // ... insertion into switch holder
WallThick = 3.0; // basic wall & floor thickness
Mount = [PCB.x,
(WallThick + TapeThick + Touchpoint.y) + (ShankOD/2 + WallThick),
PCB.z + ShankInsert
];
NumSides = 2*4;
//-----
// Define shapes
module SwitchMount() {
difference() {
translate([PCB.x/2 - Touchpoint.x, // overall block
Mount.y/2 - (ShankOD/2 + WallThick),
(PCB.z + ShankInsert)/2])
cube(Mount,center=true);
translate([0,0,-Protrusion]) // collet shank hole
PolyCyl(ShankOD,2*Mount.z,NumSides);
translate([PCB.x/2 - Touchpoint.x, // PCB recess
-Mount.y/2 + TapeThick + Touchpoint.y,
PCB.z/2 - Protrusion/2])
cube([Mount.x + 2*Protrusion,
Mount.y,
PCB.z + Protrusion
]
,center=true);
}
}
//-----
// Build it
if (Layout == "Show")
SwitchMount();
if (Layout == "Build") {
translate([0,0,Mount.z])
rotate([180,0,-90])
SwitchMount();
}
@ednisley
Copy link
Author

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

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