-
Notifications
You must be signed in to change notification settings - Fork 0
/
droneFrame.scad
430 lines (360 loc) · 12.1 KB
/
droneFrame.scad
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
// Tristan Van Cise
// CS 680 - 3D Printing and Robotics
// Homework 2 - OpenSCAD
// 09/16/2018
//
// Modularish drone frame draft designed for racing
// sized quad-copters with CC3D sized flight
// controllers (3mm X 3mm) and KV2600 BR2205 motors.
//
/*******************************************************************
* // Change to true to see a rough model of the assembled frame *
* *
*/ show_assembled_model = false; /*
* *
********************************************************************/
// General Variables
screwSize = 3; // m3 by default
enclosure_extrude_height = 2;
// CAUTION: Smaller thickness could lead to
// screws boring through motor coils
drone_arm_thickness = 4;
// Circle Edge Smoothness
$fa = 1;
$fs = 0.1;
// Motor mount
motor_key_radius = 4;
motor_mount_radius = 15.5;
motor_screw_distance_from_center = 6;
motor_mount_to_arm_transition_length = 27;
// Arm
arm_width = 20;
arm_length = 60;
distance_to_arm_end = 1.5*motor_mount_to_arm_transition_length+(arm_length);
// Body
body_width = 45;
body_height = 90;
arm_angle_from_body = 45;
// Enclosure
enclosure_width = 60;
enclosure_height = 45;
enclosure_thickness = 2;
antenna_radius = 2;
/*************/
/** Modules **/
/*************/
module motor_mount_base() {
difference() {
hull() {
circle(r=motor_mount_radius);
motor_mount_to_arm_transition_piece();
}
circle(r=motor_key_radius);
}
}
module motor_mount_to_arm_transition_piece() {
translate([0,motor_mount_to_arm_transition_length,0])
square([arm_width,motor_mount_to_arm_transition_length],center=true);
}
// The holes for the motors are ellipses due to
// varying motor screw hole distances from
// different manufacturers.
module motor_screw_holes() {
translate([-motor_screw_distance_from_center,-motor_screw_distance_from_center]) {
motor_screw_ellipse(screwSize+2,screwSize);
translate([2*motor_screw_distance_from_center,0])
mirror([0,1,0])
motor_screw_ellipse(screwSize+2,screwSize);
}
translate([motor_screw_distance_from_center,motor_screw_distance_from_center]) {
motor_screw_ellipse(screwSize+2,screwSize);
translate([-2*motor_screw_distance_from_center,0])
mirror([0,1,0])
motor_screw_ellipse(screwSize+2,screwSize);
}
}
module motor_screw_ellipse(radiusX,radiusY) {
rotate([0,0,45])
resize([radiusX,radiusY])
circle(r=10);
}
module motor_mount() {
difference() {
motor_mount_base();
motor_screw_holes();
}
}
module arm() {
translate([0,1.5*motor_mount_to_arm_transition_length+(0.5*arm_length),0])
square([arm_width,arm_length],center=true);
}
module arm_to_body_screw_holes() {
align_to_corners_on_body() {
linear_extrude(height = 7, center = true, convexity = 10) {
translate([5,distance_to_arm_end-5])
circle(r=0.5*screwSize,center=true);
translate([-5,distance_to_arm_end-5])
circle(r=0.5*screwSize,center=true);
translate([0,distance_to_arm_end-10])
circle(r=0.5*screwSize,center=true);
}
}
}
module cc3d_screw_holes() {
translate([15,15])
circle(r=0.5*screwSize,center=true);
translate([-15,15])
circle(r=0.5*screwSize,center=true);
translate([15,-15])
circle(r=0.5*screwSize,center=true);
translate([-15,-15])
circle(r=0.5*screwSize,center=true);
}
module arm_end_screw_holes() {
translate([5,distance_to_arm_end-5])
circle(r=0.5*screwSize,center=true);
translate([-5,distance_to_arm_end-5])
circle(r=0.5*screwSize,center=true);
translate([0,distance_to_arm_end-10])
circle(r=0.5*screwSize,center=true);
}
module drone_arm(extrude=true) {
motor_mount();
difference() {
arm();
if(extrude) {
linear_extrude(height = 7, center = true, convexity = 10)
arm_end_screw_holes();
} else {
arm_end_screw_holes();
}
}
}
module align_arm(x=1,y=1,angle) {
translate([x*(0.5*body_width+arm_length),y*(0.5*body_height+arm_length),0]) {
rotate([0,0,angle]) {
children();
}
}
}
module body_base() {
difference() {
square([body_width,body_height],center=true);
cc3d_screw_holes();
}
}
module align_to_corners_on_body() {
align_arm(1,-1,arm_angle_from_body)
children();
align_arm(-1,-1,-arm_angle_from_body)
children();
align_arm(-1,1,180+arm_angle_from_body)
children();
align_arm(1,1,-180-arm_angle_from_body)
children();
}
module body_and_arms() {
body_base();
align_to_corners_on_body() {
translate([0,0,-0.32*3])
drone_arm();
}
}
module body_and_arms_difference() {
difference() {
linear_extrude(height = drone_arm_thickness+1, center = true, convexity = 5)
body_base();
align_to_corners_on_body() {
translate([0,0,-0.35*3])
linear_extrude(height = drone_arm_thickness, convexity = 5)
drone_arm();
}
}
}
module square_screw_bracket() {
square([5,5]);
}
module screw_size_cylinder(height=5) {
cylinder(r=0.5*screwSize, h=height, center=true);
}
module enclosure_wall() {
difference() {
union() {
linear_extrude(height = enclosure_extrude_height, convexity = 10, center=true)
square([enclosure_height,enclosure_width],center=true);
rotate([0,90,0]) {
translate([0.5*enclosure_extrude_height, 0.5*enclosure_width-5, 0.5*enclosure_height-2]) {
difference() {
linear_extrude(height = 4, convexity = 10, center=true)
square_screw_bracket();
translate([2.5,2.5])
screw_size_cylinder(5);
}
translate([0, -enclosure_width+5,0]){
difference() {
linear_extrude(height = 4, convexity = 10, center=true)
square_screw_bracket();
translate([2.5,2.5])
screw_size_cylinder(5);
}
}
}
}
translate([-13.35+4*(13.35/20),20+0.25*(20/13.35),-0.5*enclosure_extrude_height]) {
rotate([-15,90,0]){
difference() {
linear_extrude(height = 4, convexity = 10, center=true)
square_screw_bracket();
translate([2.5,2.5])
screw_size_cylinder(5);
}
translate([0,-50,0]) {
difference() {
linear_extrude(height = 4, convexity = 10, center=true)
square_screw_bracket();
translate([2.5,2.5])
screw_size_cylinder(5);
}
}
}
}
}
difference() {
translate([enclosure_height/4,0,0])
linear_extrude(height = 20, convexity = 10, center=true)
square([(enclosure_height/2)+1,enclosure_width/1.5],center=true);
translate([7,-25,0])
rotate([0,0,15])
linear_extrude(height = 20, convexity = 10, center=true) {
square([5,50]);
}
}
// side slice
translate([-40,0,0])
rotate([0,0,15])
linear_extrude(height = 20, convexity = 10, center=true) {
square([55,80],center=true);
}
// velcro
translate([-7+0.5*1.75,4+(4/14),0])
rotate([0,90,15])
linear_extrude(height = 1, convexity = 10, center=true)
square([22,22],center=true);
}
}
module counter_sunk_screw_hole() {
translate([0,0,-2.5])
cylinder(r=0.75*screwSize, h=2);
screw_size_cylinder(5);
}
module enclosure_roof_and_screws(shift_factor=0) {
difference() {
translate([0,0,31.5+shift_factor]) {
rotate([15,0,0]) {
linear_extrude(height = 2, center = true, convexity = 10)
difference() {
square([30-enclosure_extrude_height,62],center=true);
translate([0,-25,0])
circle(r=antenna_radius, center=true);
}
}
}
translate([15,0,22.5]) {
rotate([0,90,0]) {
translate([-13.35-shift_factor,20,-0.5]) {
rotate([-15,90,0]) {
translate([2.5+1,2.5]){
counter_sunk_screw_hole();
translate([24-2,0,0])
counter_sunk_screw_hole();
translate([24-2,-50,0])
counter_sunk_screw_hole();
translate([0,-50,0])
counter_sunk_screw_hole();
}
}
}
}
}
}
}
module body_enclosure(shift_factor=0) {
difference() {
translate([15,0,22.5+shift_factor]) {
rotate([0,90,0])
enclosure_wall();
mirror([0,0,1]) {
rotate([0,-90,0])
translate([0,0,30])
enclosure_wall();
}
}
}
enclosure_roof_and_screws(shift_factor);
}
module enclosure_to_body_screw_holes(){
translate([15-enclosure_extrude_height-1.25,0.5*enclosure_height+5,0])
screw_size_cylinder(7);
translate([15-enclosure_extrude_height-1.25,-0.5*enclosure_height-5,0])
screw_size_cylinder(7);
mirror([1,0,0])
translate([15-enclosure_extrude_height-1.25,0.5*enclosure_height+5,0])
screw_size_cylinder(7);
mirror([1,0,0])
translate([15-enclosure_extrude_height-1.25,-0.5*enclosure_height-5,0])
screw_size_cylinder(7);
}
module four_arms_separated() {
translate([73,40-arm_length/2]) {
linear_extrude(height=drone_arm_thickness, center=true, convexity=5) {
drone_arm(false);
translate([-35,40+distance_to_arm_end/2 - 7])
rotate([0,0,180])
drone_arm(false);
mirror([1,0,0]) {
translate([146,40-distance_to_arm_end/2 + 7]){
drone_arm(false);
translate([-35,40+distance_to_arm_end/2 - 7])
rotate([0,0,180])
drone_arm(false);
}
}
}
}
}
module two_enclosure_walls_separated() {
translate([40,-50,0])
rotate([0,180,-45]) {
enclosure_wall();
}
mirror([0,0,1]) {
translate([-40,-50,0])
rotate([0,0,45])
enclosure_wall();
}
}
module segmented_drone_frame() {
difference() {
body_and_arms_difference();
arm_to_body_screw_holes();
enclosure_to_body_screw_holes();
}
two_enclosure_walls_separated();
translate([0,70,-30])
rotate([-15,0,0])
enclosure_roof_and_screws();
four_arms_separated();
}
module drone_frame() {
difference() {
linear_extrude(height = 5, center = true, convexity = 5)
body_and_arms();
arm_to_body_screw_holes();
enclosure_to_body_screw_holes();
}
body_enclosure(drone_arm_thickness-1.5);
}
if(show_assembled_model)
drone_frame();
else
segmented_drone_frame();