Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OpenSCAD source code: Bike helmet mirror mount with ball clamp
// Bike helmet mirror mount - ball joint
// Ed Nisley KE4ZNU 2020-09
/* [Layout options] */
Layout = "Build"; // [Build, Show, Plate, Base, Clamp]
//-- Extrusion parameters
// Extrusion parameters
/* [Hidden] */
ThreadThick = 0.25;
ThreadWidth = 0.40;
HoleWindage = 0.2;
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
function IntegerLessMultiple(Size,Unit) = Unit * floor(Size / Unit);
Protrusion = 0.1; // make holes end cleanly
inch = 25.4;
ID = 0;
OD = 1;
LENGTH = 2;
//- Basic dimensions
MountDia = 30.0; // footprint on helmet
BallDia = 10.0;
BallRad = BallDia / 2;
WallThick = IntegerMultiple(2.0,ThreadWidth);
FloorThick = IntegerMultiple(2.0,ThreadThick);
CornerRound = 2.0;
Insert = [3.0,4.0,4.0]; // threaded brass insert
Screw = [3.0,5.5,25.0]; // clamp screw
Washer = [3.7,7.0,0.7]; // washer
ShowGap = 2.0;
BuildGap = 5.0;
//-- Helmet Interface Plate
ScrewOC = BallDia + 2*WallThick + Screw[ID];
echo(str("Screw OC: ",ScrewOC));
Clamp = [ceil(Washer[OD]), // barely holds washer under screw
ScrewOC + Washer[OD], // minimal clearance for washer
BallDia +2*FloorThick // screw fits through insert
];
Kerf = ThreadThick;
echo(str("Clamp: ",Clamp));
HelmetCX = 60.0; // empirical helmet side curve
HelmetMX = 3.0;
HelmetRX = (pow(HelmetMX,2) + pow(HelmetCX,2)/4)/(2*HelmetMX);
HelmetPlateC = MountDia;
HelmetPlateTheta = atan(HelmetPlateC/HelmetRX);
HelmetPlateM = 2*HelmetRX*pow(sin(HelmetPlateTheta/4),2);
echo(str("Plate indent: ",HelmetPlateM));
HelmetPlateThick = max(FloorThick,0.6*Insert[LENGTH]) + HelmetPlateM;
echo(str("Screw length: ",Clamp.z + Insert[LENGTH]));
MountSides = 2*3*4;
//----------------------
// Useful routines
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);
}
//----------------------
// Clamp frame around ball
module ClampFrame() {
difference() {
union() {
hull()
for (i=[-1,1], j=[-1,1]) {
translate([i*(Clamp.x/2 - CornerRound),j*(Clamp.y/2 - CornerRound),Clamp.z/2 - CornerRound])
sphere(r=CornerRound,$fn=24);
translate([i*(Clamp.x/2 - CornerRound),j*(Clamp.y/2 - CornerRound),-Clamp.z/2])
cylinder(r=CornerRound,$fn=24);
}
for (j=[-1,1])
translate([0,j*ScrewOC/2,0])
rotate(180/12)
cylinder(d=Washer[OD],h=Clamp.z/2,$fn=12);
}
sphere(d=BallDia + HoleWindage,$fn=48);
cube([2*MountDia,2*MountDia,Kerf],center=true);
for (j=[-1,1])
translate([0,j*ScrewOC/2,-Screw[LENGTH]])
rotate(180/6)
PolyCyl(Screw[ID],2*Screw[LENGTH],6);
}
}
module ClampSelect(Section) {
XlateZ = (Section == "Top") ? Clamp.z/2 :
(Section == "Bottom") ? -Clamp.z/2 :
0;
intersection(convexity=5) {
ClampFrame();
translate([0,0,XlateZ])
cube([2*Clamp.x,2*Clamp.y,Clamp.z + 2*Protrusion],center=true);
}
}
//----------------------
// Concave plate fitting helmet shell
module HelmetPlate() {
render()
difference() {
cylinder(d=MountDia,h=HelmetPlateThick,$fn=MountSides);
translate([0,0,HelmetPlateThick - HelmetPlateM + HelmetRX])
sphere(r=HelmetRX,$fn=128);
for (j=[-1,1])
translate([0,j*ScrewOC/2,-Protrusion]) {
PolyCyl(Insert[OD],0.6*Insert[LENGTH] + Protrusion,6);
PolyCyl(Screw[ID],2*HelmetPlateThick,6);
}
}
}
//----------------------
// Base of clamp ring
module MountBase() {
difference() {
union() {
cylinder(d=MountDia,h=FloorThick,$fn=MountSides);
translate([0,0,FloorThick + Clamp.z/2])
ClampSelect("Bottom");
}
for (j=[-1,1])
translate([0,j*ScrewOC/2,-Protrusion])
rotate(180/6)
PolyCyl(Insert[OD],0.6*Insert[LENGTH] + Protrusion,6);
}
}
//----------------------
// Lash it together
if (Layout == "Plate") {
HelmetPlate();
}
if (Layout == "Base") {
MountBase();
}
if (Layout == "Clamp") {
ClampFrame();
}
if (Layout == "Show") {
rotate([180,0,0])
HelmetPlate();
translate([0,0,ShowGap]) {
MountBase();
color("Ivory",0.3)
translate([0,0,Clamp.z/2 + FloorThick + ShowGap/2])
sphere(d=BallDia);
translate([0,0,Clamp.z/2 + FloorThick + ShowGap])
ClampSelect("Top");
}
}
if (Layout == "Build") {
translate([MountDia/2 + BuildGap,0,0])
HelmetPlate();
translate([-(MountDia/2 + BuildGap),0,0])
MountBase();
translate([0,MountDia/2 + BuildGap,Clamp.z/2])
rotate([0,180,0])
rotate(90)
ClampSelect("Top");
}
@ednisley

This comment has been minimized.

Copy link
Owner Author

@ednisley ednisley commented Sep 13, 2020

More details on my blog at https://wp.me/poZKh-9oP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.