summaryrefslogtreecommitdiff
path: root/v1.0/timing-pulley.scad
blob: 514769e253ca968f7f50db7d43ff1d0475e10176 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// By Erik de Bruijn <reprap@erikdebruijn.nl>
// License: GPLv2 or later
//
// Goal: the goal of this parametric model is to generate a high quality custom timing pulley that is printable without support material.
// NOTE: The diameter of the gear parts are determined by the belt's pitch and number of teeth on a pully.
// updates:
// numSetScrews allows you to specify multiple set screws, 1 or 3 are useful values. With 3 you will be able to center the axis.

// //////////////////////////////
// USER PARAMETERS
// //////////////////////////////

// Pulley properties
shaftDiameter = 8; // the shaft at the center, will be subtracted from the pulley. Better be too small than too wide.
hubDiameter = 22; // if the hub or timing pulley is big enough to fit a nut, this will be embedded.
hubHeight = 8; // the hub is the thick cylinder connected to the pulley to allow a set screw to go through or as a collar for a nut.
flanges = 2; // the rims that keep the belt from going anywhere
hubSetScewDiameter = 3; // use either a set screw or nut on a shaft. Set to 0 to not use a set screw.
numSetScrews = 3;
numTeeth = 20; // this value together with the pitch determines the pulley diameter
toothType = 3; // 1 = slightly rounded, 2 = oval sharp, 3 = square. For square, set the toothWith a little low.

// Belt properties:
pitch = 5; // distance between the teeth
beltWidth = 4; // the width/height of the belt. The (vertical) size of the pulley is adapted to this.
beltThickness = 0.65; // thickness of the part excluding the notch depth!
notchDepth = 1.8; // make it slightly bigger than actual, there's an outward curvature in the inner solid part of the pulley
toothWidth = 1.4; // Teeth of the PULLEY, that is.

// //////////////////////////////
// Includes
// //////////////////////////////
<mendel.inc>
<mendel.conf>

// //////////////////////////////
// OpenSCAD SCRIPT
// //////////////////////////////

PI = 3.14159265;
$fs=0.2; // def 1, 0.2 is high res
$fa=3;//def 12, 3 is very nice

pulleyDiameter = pitch*numTeeth/PI;

if(hubSetScewDiameter >= 1) // set screw, no nut
{
	timingPulley( pitch,beltWidth,beltThickness,notchDepth,numTeeth,flanges, shaftDiameter,hubDiameter,hubHeight,hubSetScewDiameter);
}

if(hubSetScewDiameter == 0) // use a nut
{
if(pulleyDiameter >= hubDiameter) // no hub needed
{
	difference()
	{
		timingPulley(
			pitch,beltWidth,beltThickness,notchDepth,numTeeth,flanges,shaftDiameter,hubDiameter,0,hubSetScewDiameter
		);
		translate([0,0,-6]) nut(8,8);
	}
}
if(pulleyDiameter < hubDiameter)
{
	difference()
	{
		timingPulley(
			pitch,beltWidth,beltThickness,notchDepth,numTeeth,flanges,shaftDiameter,hubDiameter,hubHeight,hubSetScewDiameter
		);
		translate([0,0,8]) nut(8,12);
	}
}
}

// also in ~/RepRap/Object Files/nuts.scad
module nut(nutSize,height)
{
// Based on some random measurements:
// M3 = 5.36
// M5 = 7.85
// M8 = 12.87
	hexSize = nutSize + 12.67 - 8; // only checked this for M8 hex nuts!!
	union()
	{
		 for(i=[0:5])
		{
			intersection()
			{
				rotate([0,0,60*i]) translate([0,-hexSize/2,0]) cube([hexSize/2,hexSize,height]);
				rotate([0,0,60*(i+1)]) translate([0,-hexSize/2,0]) cube([hexSize/2,hexSize,height]);
			}
		}
	}
}


module timingPulley(
	pitch, beltWidth, beltThickness, notchDepth, numTeeth, flanges, shaftDiameter, hubDiameter, hubHeight, hubSetScewDiameter
) {
	totalHeight = beltWidth + flanges + hubHeight;

	difference()
	{
		union()
		{
			timingGear(pitch,beltWidth,beltThickness,numTeeth,notchDepth,flanges);
			hub(hubDiameter,hubHeight,hubSetScewDiameter);
		}
		#shaft(40,shaftDiameter);
	}




	module shaft(shaftHeight, shaftDiameter)
	{
		cylinder(h = shaftHeight, r = shaftDiameter/2, center =true);
	}


	module timingGear(pitch,beltWidth,beltThickness,numTeeth,notchDepth,flanges)
	{
		flangeHeight = 0;
		//if(flanges==1)
		{
			flangeHeight = 2;
		}
		
		toothHeight = beltWidth+flangeHeight*2;
		circumference = numTeeth*pitch;
		outerRadius = circumference/PI/2-beltThickness;
		innerRadius = circumference/PI/2-notchDepth-beltThickness;

		union()
		{
			//solid part of gear
			translate([0,0,-toothHeight]) cylinder(h = toothHeight, r = innerRadius, center =false);
			//teeth part of gear
			translate([0,0,-toothHeight/2]) teeth(pitch,numTeeth,toothWidth,notchDepth,toothHeight);
	
			// flanges:
			if(flanges>=1)
			{
				//top flange
				translate([0,0,0]) cylinder(h = 1, r1=outerRadius,r2=outerRadius+1);
				translate([0,0,-flangeHeight]) cylinder(h = flangeHeight, r2=outerRadius,r1=innerRadius);
				//bottom flange
				translate([0,0,-toothHeight-0.5]) cylinder(h = 1, r=outerRadius+3);
				translate([0,0,-toothHeight]) cylinder(h = flangeHeight, r1=outerRadius,r2=innerRadius);
			}
		}

	}

	module teeth(pitch,numTeeth,toothWidth,notchDepth,toothHeight)
	{
		// teeth are apart by the 'pitch' distance
		// this determines the outer radius of the teeth
		circumference = numTeeth*pitch;
		outerRadius = circumference/PI/2-beltThickness;
		innerRadius = circumference/PI/2-notchDepth-beltThickness;
		echo("Teeth diameter is: ", outerRadius*2);
		echo("Pulley inside of teeth radius is: ", innerRadius*2);
		
		for(i = [0:numTeeth-1])
		{
			rotate([0,0,i*360/numTeeth]) translate([innerRadius,0,0]) 
				tooth(toothWidth,notchDepth, toothHeight,toothType);
		}
	}
	module tooth(toothWidth,notchDepth, toothHeight,toothType)
	{
		if(toothType == 1)
		{
			union()
			{
				translate([notchDepth*0.25,0,0]) 
					cube(size = [notchDepth,toothWidth,toothHeight],center = true);
		  		translate([notchDepth*0.75,0,0]) scale([notchDepth/4, toothWidth/2, 1]) 
					cylinder(h = toothHeight, r = 1, center=true);
			}
		}
		if(toothType == 2)
			scale([notchDepth, toothWidth/2, 1]) cylinder(h = toothHeight, r = 1, center=true);

		if(toothType == 3)
		{
			union()
			{
				#translate([notchDepth*0.5-1,0,0]) cube(size = [notchDepth+2,toothWidth,toothHeight],center = true);
		  		//scale([notchDepth/4, toothWidth/2, 1]) cylinder(h = toothHeight, r = 1, center=true);
			}
		}
	}

	module hub(hubDiameter,hubHeight,hubSetScewDiameter)
	{
		if(hubSetScewDiameter == 0)
		{
			cylinder(h = hubHeight, r = hubDiameter/2, center =false);
		}
		if(hubSetScewDiameter >= 0)
		{
			difference()
			{
				
				cylinder(h = hubHeight, r = hubDiameter/2, center =false);
				for(rotZ=[1:numSetScrews])
					rotate([0,0,360*(rotZ/numSetScrews)]) translate([0,0,hubHeight/2]) rotate([0,90,0]) 
						teardrop(hubSetScewDiameter/2, hubDiameter,true);
			}
		}
	}


}