Skip to content

Instantly share code, notes, and snippets.

@jaydlawrence
Created March 31, 2016 20:27
Show Gist options
  • Save jaydlawrence/34ef49c8bfb15c5422fb0cd57d0b1d72 to your computer and use it in GitHub Desktop.
Save jaydlawrence/34ef49c8bfb15c5422fb0cd57d0b1d72 to your computer and use it in GitHub Desktop.
ZMR250 Camera Mount in OpenSCAD
$fn = 100;
distanceBetweenPoleCentres = 31.5;
poleRadius = 2.7;
thickness = 2;
outerRadius = poleRadius + thickness;
distanceBetweenPoles = distanceBetweenPoleCentres - (2*outerRadius);
poleHeight = 34.8;
cameraDepth = 22;
bottomPlateThickness = thickness;
bottomPlateWidth = cameraDepth;
bottomPlateLength = distanceBetweenPoles + (2*thickness);
loopRadius = 3.5;
loopWidth = 3;
loopCentreHeight = 4;
screwRadius = 1.7;
slopeLength = bottomPlateWidth - (2 * loopRadius);
hexNutRadius = 3.1;
hexNutDepth = loopWidth/2;
cameraRadius = 15.2 / 2;
cameraLoopThickness = 4;
cameraLoopOuterRadius = cameraRadius + cameraLoopThickness;
cameraLoopThicknessPlusExtra = cameraLoopThickness + 2;
cameraNotchWidth = 2.4;
cameraNotchHeight = 1;
module pole() {
difference() {
cylinder(r=outerRadius, h=poleHeight);
translate([0, 0, -1]) {
cylinder(r=poleRadius, h=(poleHeight + thickness));
}
}
}
module sidePlate() {
//cube([thickness, cameraDepth, poleHeight]);
CubePoints = [
[ 0, 0, 0 ], //0
[ thickness, 0, 0 ], //1
[ thickness, slopeLength, 0 ], //2
[ 0, slopeLength, 0 ], //3
[ 0, 0, poleHeight ], //4
[ thickness, 0, poleHeight ], //5
[ thickness, slopeLength, bottomPlateThickness ], //6
[ 0, slopeLength, bottomPlateThickness ]]; //7
CubeFaces = [
[0,1,2,3], // bottom
[4,5,1,0], // front
[7,6,5,4], // top
[5,6,2,1], // right
[6,7,3,2], // back
[7,4,0,3]]; // left
polyhedron( CubePoints, CubeFaces );
}
module loopCircle() {
rotate([90,0,90]) {
cylinder(r=loopRadius, h=loopWidth);
}
}
module screwHole() {
rotate([90,0,90]) {
translate([0,0,-1]) {
cylinder(r=screwRadius, h=loopWidth+2);
}
}
}
module loop() {
translate([0, loopRadius, loopCentreHeight]) {
loopCircle();
}
rotate([90,0,90]) {
cube([loopRadius*2,loopCentreHeight,loopWidth]);
}
}
module loopWithScrewHole() {
difference() {
loop();
translate([0, loopRadius, loopCentreHeight]) {
screwHole();
}
}
}
module loopWithScrewHoleAndHex() {
difference() {
loopWithScrewHole();
translate([0, loopRadius, loopCentreHeight]) {
rotate([0,90,0]) {
cylinder(r=hexNutRadius, h=hexNutDepth ,$fn=6);
}
}
}
}
module loopRack() {
loopWithScrewHoleAndHex();
translate([2 * loopWidth,0,0]) {
loopWithScrewHole();
}
translate([4 * loopWidth,0,0]) {
loopWithScrewHole();
}
}
module bottomPlate() {
cube([bottomPlateLength, bottomPlateWidth, (bottomPlateThickness)]);
translate([(bottomPlateLength/2)-(loopWidth*2.5),bottomPlateWidth - (2*loopRadius),bottomPlateThickness]) {
loopRack();
}
}
module complete() {
pole();
translate([distanceBetweenPoleCentres,0,0]){
pole();
translate([(0 - poleRadius - thickness),0,0]) {
sidePlate();
}
};
translate([poleRadius,0,0]) {
sidePlate();
}
translate([poleRadius, 0, 0]) {
bottomPlate();
}
}
complete();
module cameraSideLoop() {
loopCircle();
translate([0, 0, -loopRadius]) {
cube([loopWidth,cameraLoopThickness + loopRadius, cameraLoopThickness]);
}
}
module cameraSideLoopWithHole() {
difference() {
cameraSideLoop();
screwHole();
}
}
module cameraHolder() {
difference() {
cylinder(r=cameraLoopOuterRadius, h=cameraLoopThickness);
translate([0,0,-1]) {
cylinder(r=cameraRadius, h=cameraLoopThicknessPlusExtra);
}
translate([-cameraNotchWidth/2, cameraRadius - cameraNotchHeight, -1]) {
cube([cameraNotchWidth, cameraNotchHeight*2, cameraLoopThicknessPlusExtra]);
}
translate([-loopWidth/2, -cameraLoopOuterRadius-1, -1]) {
cube([loopWidth, cameraLoopThicknessPlusExtra, cameraLoopThicknessPlusExtra]);
}
}
translate([loopWidth/2, -cameraLoopOuterRadius - loopRadius, loopRadius]) {
cameraSideLoopWithHole();
}
translate([-1.5 * loopWidth, -cameraLoopOuterRadius - loopRadius, loopRadius]) {
cameraSideLoopWithHole();
}
}
/*translate([outerRadius + (distanceBetweenPoles/2),cameraDepth, bottomPlateThickness + loopCentreHeight + cameraLoopOuterRadius + loopRadius]) {
rotate([90,0,0]) {
cameraHolder();
}
}*/
//cameraHolder();
$fn = 100;
distanceBetweenPoleCentres = 31.5;
poleRadius = 2.7;
thickness = 2;
outerRadius = poleRadius + thickness;
distanceBetweenPoles = distanceBetweenPoleCentres - (2*outerRadius);
distanceBetweenOutsideOfPole = distanceBetweenPoleCentres + (2*outerRadius);
poleHeight = 34.8;
cameraDepth = 22 - outerRadius;
screwRadius = 1.5;
cameraLoopCentreHeightFactor = 0.55;
cameraLoopCentreHeight = cameraLoopCentreHeightFactor * poleHeight;
cameraRadius = 15.4 / 2;
cameraLoopThickness = 5;
cameraLoopOuterRadius = cameraRadius + cameraLoopThickness;
cameraLoopThicknessPlusExtra = cameraLoopThickness + 2;
cameraNotchWidth = 2.4;
cameraNotchHeight = 1;
cameraPegRadius = (cameraLoopThickness/2) - 0.2;
cameraPegLength = (distanceBetweenOutsideOfPole/2) - cameraLoopOuterRadius;
cameraPegLengthPlusExtra = (distanceBetweenOutsideOfPole/2) - cameraRadius;
cameraPegPivotOuterRadius = cameraPegRadius + cameraLoopThickness;
centreDepth = (cameraDepth - cameraPegRadius);
slopeLength = centreDepth + cameraPegPivotOuterRadius;
sidePlateThickness = thickness*2.5;
bottomPlateThickness = thickness;
bottomPlateWidth = cameraDepth;
bottomPlateLength = distanceBetweenOutsideOfPole - (2*sidePlateThickness);
py = 0;
pz = poleHeight;
cy = centreDepth;
cz = cameraLoopCentreHeight;
// find tangents
dy = cy - py;
dz = cz - pz;
dd = sqrt((dy * dy) + (dz * dz));
a = asin(cameraPegPivotOuterRadius / dd);
b = atan2(dz, dy);
t = b + a;
tydiff = cameraPegPivotOuterRadius * -sin(t);
tzdiff = cameraPegPivotOuterRadius * cos(t);
ty = cy + tydiff;
tz = cz + tzdiff;
module pole() {
cylinder(r=outerRadius, h=poleHeight);
}
module cameraPeg() {
cylinder(r=cameraPegRadius, h=cameraPegLengthPlusExtra);
}
module sidePlate() {
//cube([thickness, cameraDepth, poleHeight]);
CubePoints = [
[ 0, 0, 0 ], //0
[ sidePlateThickness, 0, 0 ], //1
[ sidePlateThickness, slopeLength, 0 ], //2
[ 0, slopeLength, 0 ], //3
[ 0, 0, poleHeight ], //4
[ sidePlateThickness, 0, poleHeight ], //5
[ sidePlateThickness, slopeLength, cameraLoopCentreHeight ], //6
[ 0, slopeLength, cameraLoopCentreHeight ], //7
[ 0, ty, tz], //8
[ sidePlateThickness, ty, tz]]; //9
CubeFaces = [
[0,1,2,3], // bottom
[4,5,1,0], // front
[8,9,5,4], // top
[5,9,6,2,1], // right
[6,7,3,2], // back
[7,6,9,8], // angle
[7,8,4,0,3] //left
];
polyhedron( CubePoints, CubeFaces );
translate([0,centreDepth, cameraLoopCentreHeight]) {
rotate([0,90,0]){
cylinder(r=cameraPegPivotOuterRadius, h=sidePlateThickness);
}
}
}
module screwHole() {
translate([ outerRadius - (sidePlateThickness/2), centreDepth, cameraLoopCentreHeight]) {
rotate([-90,0,0]) {
cylinder(r=screwRadius, h=cameraPegPivotOuterRadius+2);
}
}
}
module poleAndSidePlate() {
mirror([1,0,0]) {
pole();
translate([outerRadius-sidePlateThickness,0,0]) {
difference() {
sidePlate();
translate([0,centreDepth, cameraLoopCentreHeight]) {
rotate([0,90,0]){
cameraPeg();
}
}
translate([0.2,0,0]) {
screwHole();
}
}
}
}
}
module poleAndSidePlateWithHole() {
difference() {
poleAndSidePlate();
translate([0, 0, -1]) {
cylinder(r=poleRadius, h=(poleHeight + thickness));
}
}
}
module rightSide() {
poleAndSidePlateWithHole();
}
module leftSide() {
translate([distanceBetweenPoleCentres,0,0]){
mirror([1,0,0]) {
poleAndSidePlateWithHole();
}
};
}
module complete() {
rightSide();
leftSide();
/*translate([sidePlateThickness-outerRadius, cameraPegPivotOuterRadius-(cameraLoopThickness/2), 0]) {
cube([bottomPlateLength, bottomPlateWidth, bottomPlateThickness]);
}*/
}
module cameraHolder() {
difference() {
cylinder(r=cameraLoopOuterRadius, h=cameraLoopThickness);
translate([0,0,-1]) {
cylinder(r=cameraRadius, h=cameraLoopThicknessPlusExtra);
}
translate([-cameraNotchWidth/2, cameraRadius - cameraNotchHeight, -1]) {
cube([cameraNotchWidth, cameraNotchHeight*2, cameraLoopThicknessPlusExtra]);
}
}
translate([-cameraRadius, 0, cameraPegRadius]) {
rotate([0,-90,0]) {
cameraPeg();
}
}
translate([+cameraRadius, 0, cameraPegRadius]) {
rotate([0,90,0]) {
cameraPeg();
}
}
}
//for getting the cameraHolder in the correct position and orientation so that it lines up with the sides.
translate([outerRadius + (distanceBetweenPoles/2),cameraDepth, cameraLoopCentreHeight]) {
rotate([90,0,0]) {
cameraHolder();
}
}
rightSide();
leftSide();
//cameraHolder();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment