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