Skip to content

Instantly share code, notes, and snippets.

@wware
Last active August 29, 2015 14:05
Show Gist options
  • Save wware/b5e80f89fa2191482818 to your computer and use it in GitHub Desktop.
Save wware/b5e80f89fa2191482818 to your computer and use it in GitHub Desktop.
module home_depot_bucket() {
translate([0,0,14.25])
difference() {
cylinder(h=1/4, d=14, $fn=30);
cylinder(h=1/4, d=12, $fn=30);
}
difference() {
cylinder(h=14.5, d1=10.5, d2=12.5, $fn=30);
translate([0,0,1/4])
cylinder(h=14.5, d1=10, d2=12, $fn=30);
}
}
module sprocket_tooth() {
difference() {
union() {
translate([-1/4,0,-1/16])
cube([1/2,3/8,1/8]);
intersection() {
translate([1/4, 0, -1/16])
cylinder(h=1/8, d=1-5/16, $fn=30);
translate([-1/4, 0, -1/16])
cylinder(h=1/8, d=1-5/16, $fn=30);
}
}
translate([1/4, 0, -1/8])
cylinder(h=1/4, d=5/16, $fn=30);
translate([-1/4, 0, -1/8])
cylinder(h=1/4, d=5/16, $fn=30);
multmatrix(m = [
[1, 0, 0, -0.5],
[0, 1, 4, -1.3],
[0, 0, 1, 0],
[0, 0, 0, 1]
])
cube([1, 1, 1]);
multmatrix(m = [
[1, 0, 0, -0.5],
[0, 1, -4, 2.7],
[0, 0, 1, -1],
[0, 0, 0, 1]
])
cube([1, 1, 1]);
}
}
module sprocket(teeth, hub_diameter) {
pitch = 1/2; // bicycle chain, 1/2 - 1/8
theta = 360.0 / teeth;
r = (pitch / 2) / tan(theta / 2);
for (i = [0 : teeth-1])
rotate(theta*i, [0, 0, 1])
translate([0, -r, 0]) sprocket_tooth();
translate([0,0,-1/16])
cylinder(h=1/8, d=2*r-0.5, $fn=20);
translate([0,0,-3/16])
cylinder(h=3/8, d=hub_diameter, $fn=20);
}
module StepperSprocket(teeth, axle_diameter) {
dcut = 0.5 * (0.22/0.250) * axle_diameter;
difference() {
sprocket(teeth, 0.5);
difference() {
translate([0,0,-0.5])
cylinder(h=1, r=axle_diameter/2, $fn=40);
translate([dcut, -0.5, -0.5])
cube([1, 1, 1]);
}
}
}
module HexNutSprocket(teeth, wrench_size) {
difference() {
sprocket(teeth, 0.75);
intersection_for(n = [1 : 3])
rotate(60 * n, [0, 0, 1])
translate([-0.5 * wrench_size, -0.5, -0.5])
cube([wrench_size, 1, 1]);
}
}
module MirrorSupport(width, height) {
translate([-width/2, 0, 0])
difference() {
cube([width, 1/4, height]);
translate([width/2-1/8, 0, height-2])
cube([1/4, 1/2, 2]);
}
}
module CrudeNEMA23() {
translate([-1.15, -1.15, -1/4])
cube([2.3, 2.3, 1/4]);
translate([0, 0, -2.75])
cylinder(h=2.5, d=2.3, $fn=12);
}
// STL files are dimensionless and I usually use inches,
// but the Formlabs machine prefers millimeters, and OpenSCAD
// seems to want them also.
/*
scale([25.4, 25.4, 25.4])
home_depot_bucket();
*/
teeth = 8;
wrench_size = 0.43;
scale([25.4, 25.4, 25.4]) {
home_depot_bucket();
// mirror and supports
translate([0, 0, 18])
rotate([0, 45, 0])
translate([-3, -3, 0])
cube([6, 6, 1/4]);
translate([0, 8.75, 14.75])
MirrorSupport(3, 5);
translate([0, -8, 14.75])
MirrorSupport(3, 5);
// lower support
difference() {
translate([-7, -8, 14.5])
cube([14, 17, 1/4]);
translate([0, 0, 14])
cylinder(h=2, d=8, $fn=30);
}
// stepper and stepper sprocket
rotate([0, 0, 60]) {
translate([8.25, 0, 14+15/16])
StepperSprocket(teeth, 1/4);
translate([8, 0, 14.5])
CrudeNEMA23();
}
// hex nut sprockets
for (i = [0 : 2])
rotate([0, 0, 120*i])
translate([4.5, 0, 14+15/16])
HexNutSprocket(teeth, wrench_size);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment