]> www.fi.muni.cz Git - things.git/blob - rocket.scad
small control horn for rc plane
[things.git] / rocket.scad
1
2 // The Estes A8-3 and C6-7 motors have diameter of 17.7 mm,
3 // length 69.5 mm. The Estes Alpha launch pad has rod diameter 3.4 mm.
4
5 motor_diam = 17.7 + 1.2; // add some tolerance
6 motor_len  = 69.5 + 0.5;
7
8 segment_overlap = 15;
9
10 loose_fit_diam_diff = 1.1; // cylinder with outer diameter d1
11         // will fit loosely into the hole with inner diameter
12         // d1 + loose_fit_diam_diff
13 tight_fit_diam_diff = 0.4; // cylinder with outer diameter d1
14         // will fit tightly into the hole with inner diameter
15         // d1 + tight_fit_diam_diff
16
17 thin_wall = 1.0; // depends on the print width
18 thick_wall = 2*thin_wall + loose_fit_diam_diff/2;
19         // motor_diam + 2*thick_wall is the outer diameter of the rocket
20 motor_wall = thick_wall; // above the motor
21
22 clip_height = 3.5;
23 clip_width = 1.2;
24 clip_clearance = 1.0;
25 clip_inner_space = motor_diam/2 - 1.5;
26
27 rod_diam = 3.4 + 1;
28 rubber_beam_height = 3;
29 rubber_beam_width = 1.5;
30
31 fin_thickness = 1.5;
32
33 eps = 0.01;
34 infty = 250;
35
36 // rod holder
37
38 module rod_holder() {
39         // rod hole holder
40         hull() {
41                 translate([motor_diam/2 + thick_wall + thin_wall + rod_diam/2, 0, 0])
42                         cylinder(r = rod_diam/2 + thin_wall, h = thick_wall);
43                 translate([motor_diam/2 + thick_wall - thin_wall - rod_diam/2, 0, 0])
44                                 
45                         cylinder(r = rod_diam/2 + thin_wall, h = 3*thick_wall);
46         }
47 }
48
49 module rod_hole() {
50         // rod hole
51         translate([motor_diam/2 + thick_wall + thin_wall + eps + rod_diam/2, 0, 0])
52                 cylinder(r = rod_diam/2, h = infty);
53 }
54
55 //----------------- MOTOR MODULE -----------------------------
56
57 module fin() {
58         assign(h1 = 2*motor_len/3, // near end height
59                 h2 = 20,        // far end height
60                 h_off = motor_len, // height offset of the far height
61                 w = 30, // distance of the far height
62                 fin_w = fin_thickness)
63         translate([0, -fin_w/2, -h1])
64         hull() { 
65                 cube([eps, fin_w, h1]); // near end
66                 translate([w, 0, h_off]) // far end
67                         cube([eps, fin_w, h2]);
68         };
69 };
70
71 // alternative fin layout
72 module fin2() {
73         assign(h1 = motor_len/2, // near end height
74                 w2 = 23,        // bottom/far end width
75                 h_off = 60, // height offset of the far height
76                 w = 30, // distance of the far height
77                 fin_w = fin_thickness)
78         translate([0, -fin_w/2, -h1])
79         hull() { 
80                 cube([eps, fin_w, h1]); // near end
81                 translate([w-w2, 0, h_off]) // far end
82                         cube([w2, fin_w, eps]);
83         };
84 };
85
86 rod_hole_height = 20;
87 rod_hole_side = 1.5*(rod_diam + thin_wall);
88
89 module motor_module_solid()
90 {
91         // cone from loose_fit to tight fit, 1/3 of segment overlap
92         cylinder(r1 = motor_diam/2 + thin_wall,
93                 r2 = motor_diam/2 + thick_wall - thin_wall - tight_fit_diam_diff/2,
94                 h = segment_overlap/3 + eps);
95
96         // tight fit cylinder, 2/3 of segment overlap
97         translate([0, 0, segment_overlap/3])
98                 cylinder(r = motor_diam/2 + thick_wall - thin_wall - tight_fit_diam_diff/2,
99                 h = 2*segment_overlap/3 + eps);
100
101         // conical joint between the two cylinders
102         translate([0, 0, segment_overlap - thick_wall + thin_wall])
103                 cylinder(r1 = motor_diam/2 + thick_wall - thin_wall - tight_fit_diam_diff/2,
104                         r2 = motor_diam/2 + thick_wall,
105                         h = thick_wall - thin_wall + eps);
106
107         // the thick cylinder above it
108         translate([0, 0, segment_overlap])
109                 cylinder(r = motor_diam/2 + thick_wall,
110                 h = motor_len + motor_wall - segment_overlap);
111
112         // fins
113         for (a = [60, 180, 300]) {
114                 rotate([0, 0, a])
115                 translate([motor_diam/2 + thick_wall-thin_wall, 0, motor_wall + motor_len])
116                         // fin();
117                         fin2();
118         };
119
120         // motor clip
121         for (angle = [120, -120]) rotate([0, 0, angle]) intersection() {
122                 translate([clip_inner_space, -infty/2,
123                         motor_len + motor_wall + clip_clearance])
124                         cube([clip_width, infty, clip_height]);
125                 rotate([0, 0, -60])
126                         translate([-infty/2, 0, 0]) cube(infty);
127                 rotate([0, 0, -120])
128                         translate([-infty/2, 0, 0]) cube(infty);
129         };
130
131         translate([0, 0, motor_len + motor_wall])
132                 scale([1, 1, -1])
133                 rod_holder();
134 };
135         
136 module motor_module() {
137         difference() {
138                 motor_module_solid();
139
140                 // top ring to hold the motor inside
141                 translate([0, 0, -eps])
142                         cylinder(r = motor_diam/2 - motor_wall,
143                                 h = motor_wall + 2*eps);
144
145                 // motor hole
146                 translate([0, 0, motor_wall - eps])
147                         cylinder(r = motor_diam/2, h = motor_len + 2*eps);
148
149                 // three rails inside the motor hole
150                 translate([0, 0, segment_overlap + thick_wall]) difference() {
151                         union() {
152                                 cylinder(r = motor_diam/2 + thin_wall,
153                                         h = motor_len - segment_overlap - 2*thick_wall + eps);
154                                 translate([0, 0, motor_len - segment_overlap - 2*thick_wall])
155                                         cylinder(r1 = motor_diam/2 + thin_wall, r2 = motor_diam/2, h = thick_wall + eps);
156                         };
157                         for (a = [0, 120, 240]) rotate([0, 0, a])
158                                 translate([motor_diam/2 + 2.5, 0, -eps])
159                                         cylinder(r = 3, h = infty);
160                 };
161
162                 rod_hole();
163         };
164 };
165
166 // -------------------- CENTRAL TUBE ---------------------
167
168 central_tube_h = 97;
169
170 central_clip_r = 12;
171 central_clip_w = 4;
172 central_clip_wall = 1.5;
173 central_clip_clearance = 2.5;
174
175 module central_tube_solid() {
176         cylinder(r = motor_diam/2 + thick_wall, h = central_tube_h);
177         rod_holder();
178 };
179
180 module central_tube() {
181         difference() {
182                 central_tube_solid();
183                 translate([0, 0, -eps])
184                         cylinder(r = motor_diam/2 + thick_wall - thin_wall,
185                                 h = infty);
186                 rod_hole();
187         };
188 };
189
190 //------------------------- FRONT CONE -----------------------
191 cone_h = 45;
192 cone_resolution = 40;
193 cone_solid_h = 10;
194
195 function bez_i4(t, ctls) =
196         (pow(1-t, 3) * ctls[0])
197         + (3 * t * pow(1-t, 2) * ctls[1])
198         + (3 * pow(t, 2) * (1-t) * ctls[2])
199         + (pow(t, 3) * ctls[3]);
200
201 module bezier_cone(cps, res)
202 {
203         for (t = [0:1:res])
204                 translate([0, 0, (bez_i4(t/res, cps))[0]])
205                         cylinder(r1 = (bez_i4(t/res, cps))[1],
206                                 r2 = (bez_i4((t + 1)/res, cps))[1],
207                                 h = (bez_i4((t + 1)/res, cps))[0]
208                                     - (bez_i4(t/res, cps))[0] + eps);
209 };
210
211 module front_cone_body() {
212         translate([0, 0, segment_overlap])
213                 bezier_cone([
214                         [ 0, motor_diam/2 + thick_wall ], // start
215                         [ cone_h/4, motor_diam/2 + thick_wall ], // cp 1
216                         [ cone_h - motor_diam/2 - thick_wall, motor_diam/2 + thick_wall ], // cp 2
217                         [ cone_h, 0 ],
218                 ], 40);
219
220         translate([0, 0, segment_overlap-thick_wall+thin_wall])
221                 cylinder(r1 = motor_diam/2+thin_wall,
222                         r2 = motor_diam/2 + thick_wall,
223                         h = thick_wall - thin_wall + eps);
224
225         cylinder(r = motor_diam/2+thin_wall, h = segment_overlap + eps);
226 };
227
228 module front_cone() {
229         difference() {
230                 front_cone_body();
231                 intersection() {
232                         translate([0, 0, segment_overlap])
233                                 bezier_cone([
234                                         [ 0.7*thin_wall, motor_diam/2 + thick_wall - thin_wall ], // start
235                                 [ cone_h/4-0.7*thin_wall, motor_diam/2 + thick_wall - thin_wall], // cp 1
236                                 [ cone_h - motor_diam/2 - thick_wall + thin_wall - 1.4*thin_wall, motor_diam/2 + thick_wall - thin_wall ], // cp 2
237                                 [ cone_h - 1.4*thin_wall, 0 ],
238                         ], 40);
239                         cylinder(r = motor_diam/2 + thick_wall + eps,
240                                 h = cone_h + segment_overlap - cone_solid_h);
241                 };
242
243                 translate([0, 0, segment_overlap-thick_wall+1.7*thin_wall])
244                         cylinder(r1 = motor_diam/2,
245                                 r2 = motor_diam/2 + thick_wall-thin_wall,
246                                 h = thick_wall-thin_wall + eps);
247
248                 translate([0, 0, -eps])
249                         cylinder(r = motor_diam/2, h = segment_overlap + 2*eps);
250         };
251 };
252
253 debug = 0;
254
255 if (debug == 1) {
256 // debug
257 difference($fn = 16) {
258         front_cone();
259         central_tube();
260         motor_module();
261
262         translate([0, 0, -infty/2]) cube(infty);
263 };
264
265 } else {
266
267 // production
268 $fn = 128;
269
270 translate([motor_diam + thick_wall, 0, 0])
271         motor_module();
272
273 rotate([0, 0, 120])
274 translate([motor_diam + thick_wall, 0, 0])
275         central_tube();
276
277 rotate([0, 0, 240])
278 translate([motor_diam + thick_wall, 0, 0])
279         front_cone();
280
281 }