-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path006 Project Box 2.4.scad
executable file
·393 lines (324 loc) · 13.6 KB
/
006 Project Box 2.4.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
/*#################################################################################*\
006 Project Box 2.4.scad
-----------------------------------------------------------------------------
Developed by: Richard A. Milewski
Description: Project Box for Electric Imp 006 Breakout Board
Version: 2.4
Creation Date: 30 July 2022
Modification Date: 28 Sept 2022
Email: [email protected]
Copyright ©2022 by Richard A. Milewski
License - CC-BY-NC https://creativecommons.org/licenses/by-nc/3.0/
/*################################################################################*\
CONFIGURATION
\*################################################################################*/
/* Measurements labeled <NEC> are from the New Age Enclosures spec sheet pdf.
Dimensions labeled <Measured> were measured on an Imp 006 Breakout Board rev 4.0.
The Origin of the coördinate space is the XY center of the board.
The USB connector overhangs the edge of the rev 4.0 PCB by ≈1.5 mm.
*/
include <BOSL2/std.scad>
include <imp006_logos.scad>
// The part you wish to print
part = "box"; // [antenna, box, gnss, lid, logo]
use_usb = true; // [true, false]
use_grove = true; // [true, false]
use_logo = true; // true prints a top with a cut-out for a logo plate,
// false prints a blank top
parts_headspace = 10; // [10:50]
$slop = 0.1; // printer dependant clearance for nested parts.
breadboard_fudge = [1,2]; // printer dependant fudge factor for press-fit of breadboard PCB
module hidevars () {} // variables below hidden from Customizer
$fn = 64;
pcb_NEC = [2.5 * INCH * 2, 1.28 * INCH * 2, 0.062 * INCH]; // <NEC> Mythical PCB prototype.
pcb = [127, 60, 1.6]; // <Measured>
show_pcb = false; // Set true to show blank pcb for debugging
stackerZ = 8; // Height of the box mating surface
pcb_lift = 11; // For battery space
pcb_headspace = parts_headspace - stackerZ + 7; // Parts clearance above the board
box_shift = [0,6,0]; // Move the box, but keep the board centered on the origin.
// makes room for antenna mounts
box_wall = 3;
baseZ = box_wall/2;
box = [pcb.x + 8.5 , pcb.y + 21, baseZ + pcb_lift + pcb_headspace]; // Note: box.z is only the height of the lower box,
stacker = [box.x, box.y, stackerZ]; // it does not include lid.z or stacker.z.
base = [box.x - box_wall * 1.1, box.y - box_wall * 1.1, baseZ];
wall_iedge = [box.x/2-box_wall/2, box.y/2-box_wall/2];
pcb_edge = [pcb.x/2, pcb.y/2, pcb_lift + pcb.z + base.z];
//Battery Cage
batt = [56,34,9.4];
cage_wall = 2;
batt_position = [-15 - batt.x/2, pcb_edge.y - batt.y/2 - 15, base.z];
// Holes in the box walls -- Fixed numbers are <Measured>... or guessed at.
grove = [box_wall+0.1, 10, 5];
grove_spacing = grove.y + 3;
grove_position1 = [-wall_iedge.x, 3 - box_shift.y, pcb_edge.z];
grove_position2 = [grove_position1.x, grove_position1.y + grove_spacing, grove_position1.z];
led_window = [box_wall, 6, 5];
led_window_position = [wall_iedge.x - box_wall/4, 12 - box_shift.y - led_window.y/2, pcb_edge.z];
usb = [box_wall, 8.5, 4.2] ;
usb_shift = use_usb ? 0 : 0.35;
usb_position = [wall_iedge.x - usb_shift, - 2 - box_shift.y, pcb_edge.z];
pcb_mount_hole_dwg = [-.120 * INCH, undef, 0.062 * INCH]; // Mounting hole from <NEC> PDF.
pcb_mount = [2.1 * INCH, 1.005 * INCH]; // Mounting hole positions from <NEC> pdf.
pcb_mount_spacing = [pcb_mount.x * 2, pcb_mount.y * 2];
pcb_mount_stud = [8, undef, pcb_lift + base.z];
pcb_mount_hole = [2.5, undef, 6];
corner = 0.4 * INCH; // radius of pcb corner 10.16mm
icorner = corner - box_wall;
top = [box.x, box.y, 8]; // Top.z does not include stacker.z
top_pin = [3, undef, box_wall + 3];
top_pin_spread = [top.x - 22, top.y - 21];
top_pin_spacing = [top_pin_spread];
logo_cutout = [box.x-23, box.y-24, box_wall];
deck = [logo_cutout.x + 8, logo_cutout.y + 7, 1];
logo_border = 2;
logo_z = 0.5; //height of the logo in the contrastng color
logo_position = [-deck.x*0.18, deck.y*0.16, logo_cutout.z];
lid_size = [box.x, box.y, 10.5];
lid_mask = [lid_size.x - box_wall, lid_size.y - box_wall, lid_size.z];
antenna_plate = [100, 23, 1.75];
antenna_mount = [108, 6, antenna_plate.y * 0.5];
antenna_slot = [102, 2.25, antenna_mount.z + 1];
antenna_slot_position = [0, box.y/2 - 1.5 * box_wall, base.z];
antenna_mount_position = [0, wall_iedge.y - antenna_mount.y/2, base.z];
gnss = [25,25,6.5];
gnss_mount = [32, 11, antenna_mount.z];
gnss_offset = 30;
gnss_slot = [25, 3.1, antenna_mount.z+1];
gnss_slot_position = [gnss_offset - antenna_slot.x/2 + gnss_slot.x/2, antenna_slot_position.y - 5, base.z];
gnss_mount_position = [gnss_offset - antenna_slot.x/2 + gnss_slot.x/2,wall_iedge.y - box_wall/2 - gnss_mount.y/2, base.z];
gnss_height = 18;
gnss_cavity_wall = 1.5;
gnss_clearance = 11; //height of gnss holder above stacker bottom.
breadboard = [40.33, 60.24, 1.6];
cable_hole = [10,box.y * 0.7, stacker.z * 2];
adjusted_headspace = max(parts_headspace-8,2);
cutout = [breadboard.x - 3, breadboard.y, stacker.z*2];
frame = [breadboard.x + breadboard_fudge.x, breadboard.y + breadboard_fudge.y, base.z/2 + 3];
frame_wall = 1;
/*#### Main #################################################################*/
if (part == "box") box(); // Box Bottom.
if (part == "lid") lid(); // Top with optional cutout for logo plate.
if (part == "logo") logo_plate(); // Logo Plate
if (part == "antenna") antenna(); // Mounting plate for antenna.
if (part == "gnss") gnss_holder(); // GNSS antenna holder
if (part == "breadboard") breadboard(); // Mezzanine for 2 70x40mm breadboard pcb.s
// Test Prints
if (part == "frame") frame_test(); // Test of press-fit breadboard frame size
if (part == "mezzanine") mezzanine(adjusted_headspace); // Mezzanine with solid floor
// Clipped parts of the box to test wall hole locations
if (part == "grove") slice("grove"); // Grove connector partial box
if (part == "usb") slice("usb"); // USB connector partial box
/*#################################################################################*\
Modules
\*#################################################################################*/
module box() {
move(box_shift) {
color_this("skyblue") base();
color_this("goldenrod") antenna_mounts();
color_this("yellow") walls();
color_this("magenta") up(box.z) stacker(true);
}
color_this("lime") stud_set();
color_this("magenta") battery_cage();
color_this("deepskyblue") dummy_pcb();
}
module base () { //the bottom of the box
cuboid (base, rounding = icorner, edges = "Z", anchor = BOT);
}
module walls() {
difference() {
rect_tube (size = [box.x, box.y], wall = box_wall, h = box.z,
rounding = corner, irounding = icorner, anchor = BOT);
union() {
move(led_window_position) recolor("skyblue") cuboid(led_window, rounding = 1, edges = "X", anchor = BOT);
if (use_grove) {
move(grove_position1) recolor("green") cuboid(grove, anchor = BOT);
move(grove_position2) recolor("green") cuboid(grove, anchor = BOT);
}
move(usb_position) recolor("red") cuboid(usb, rounding = 0.2, edges = "X", anchor = BOT);
}
}
}
module antenna_mounts(){ //Mount points inside the box for antennae
difference() {
union() {
move(antenna_mount_position)
cuboid(antenna_mount, rounding = 2, edges = [TOP,FRONT], except = [BOT,BACK], anchor = BOT);
move(gnss_mount_position)
cuboid(gnss_mount, rounding = 2, edges = [TOP,FRONT], except = [BOT,BACK], anchor = BOT);
}
union() {
move(antenna_slot_position)
cuboid(antenna_slot, anchor = BOT);
move(gnss_slot_position)
cuboid(gnss_slot, anchor = BOT);
}
}
}
module stud() { // A single mounting stud.
difference() {
cyl(h = pcb_mount_stud.z, d = pcb_mount_stud.x, rounding1 = -5, rounding2 = 1, anchor = BOT);
down(box_wall/2) cyl(h = pcb_mount_stud.z + pcb_mount_hole.z, d = pcb_mount_hole.x, anchor = BOT);
}
}
module stud_set() {
grid2d(size = pcb_mount_spacing, spacing = pcb_mount_spacing) stud();
}
module battery_cage(){
move(batt_position){
difference() {
rect_tube(h = batt.z * 0.8, isize = [batt.x,batt.y], wall = cage_wall, anchor = LEFT+BOT);
move([batt.x, batt.y/2 + cage_wall/2, batt.z * 0.8]) cuboid(cage_wall, anchor = LEFT+UP);
}
}
}
module dummy_pcb() { // a blank plate the size and shape of the pc board.
if (show_pcb) {
zmove(pcb_lift+base.z) {
difference () {
cuboid(pcb, rounding = icorner, edges = "Z", anchor = BOT);
grid2d(size = pcb_mount_spacing, spacing = pcb_mount_spacing) cyl(h = pcb_mount_hole.z, d = pcb_mount_hole.x);
}
}
}
}
module stacker(is_male) { // Interface ring to stack box
A = [box.x - 2 * box_wall/4, box.y - 2 * box_wall/4];
B = [box.x - 4 * box_wall/4, box.y - 4 * box_wall/4];
C = [box.x - 2 * box_wall, box.y - 2 * box_wall];
if (is_male) {
rect_tube ( size1 = A, size2 = B, isize = C,
h=stacker.z, rounding = corner, irounding = icorner);
} else {
difference() {
rect_tube(h = stacker.z, size = [stacker.x, stacker.y], wall = box_wall,
rounding = corner, irounding = icorner, anchor = BOT);
rect_tube(size1 = A, size2 = B, isize = C,
h=stacker.z, rounding = corner, irounding = icorner);
}
}
}
module lid() {
difference() {
union() {
cuboid(lid_size, rounding = corner, teardrop = 45, except = TOP, anchor = BOT);
up(lid_size.z + stacker.z) yrot(180) stacker(false);
}
union() {
up(box_wall/2)
cuboid(lid_mask, rounding = icorner, teardrop = 45, except = TOP, anchor = BOT);
if (use_logo) cuboid(logo_cutout+[1,1,0], rounding = icorner, edges = "Z", anchor = BOT);
}
}
if (use_logo) {
grid2d(size = top_pin_spread, spacing = top_pin_spacing)
color("red") cyl(h = top_pin.z, d = top_pin.x, anchor = BOT);
}
}
module logo_plate() {
difference() {
color("white")
cuboid([deck.x, deck.y, box_wall/2],
rounding = icorner, edges = "Z", anchor = BOT);
grid2d(size = top_pin_spread, spacing = top_pin_spacing)
cyl(h = top_pin.z, d = top_pin.x+1, anchor = BOT);
}
color("white")
cuboid(logo_cutout, rounding = icorner, edges = "Z", anchor = BOT);
color("black") up(logo_position.z)
rect_tube (size = [logo_cutout.x, logo_cutout.y], h = 2*logo_z,
rounding=icorner, irounding = icorner - 1, wall = 1);
move(logo_position) {
imp006_logo_set(logo_z);
}
}
//Loose Parts ********************************************
module antenna() { cuboid (antenna_plate, edges = "Z", rounding = 3); } // Cellular antenna plate
module gnss_holder() {
wall = gnss_slot.y-$slop;
lift = 5 + pcb_lift;
difference() {
union() {
cuboid ([lift + gnss.z + wall * 1.5, wall, gnss.x - 0.5], // Base
rounding = wall/2, edges = "Z", anchor = LEFT+BOT);
zrot(-3) right(wall/2.6)
cuboid ([wall * 0.75, gnss.y-2, gnss.x - 0.5], // Top Clamp
rounding = wall/3, edges = "Z", anchor = FRONT+BOT);
xmove(gnss.z + wall * 1.25)
cuboid ([wall, gnss.y-2, gnss.x - 0.5], // Shelf
rounding = wall/2, edges = "Z", anchor = FRONT+BOT);
}
back(gnss.x*0.75) up(gnss.x/2) right(1.2) zrot(-3) xrot(-90) yrot(-90) zrot(90)
color("green") text3d("RESET", h = 2.5, size = 5, spacing = 1,
font = "Avenir Next Condensed:style=Heavy", anchor = str("baseline",BOT));
}
}
module mezzanine(headspace) { // Empty adjustable height stacking box to enclose aded parts
union() {
stacker(false);
up(gnss_clearance)
color("skyblue")
cuboid(base, rounding = corner, edges = "Z", anchor = BOT);
up(stacker.z) {
color("red") rect_tube(h=headspace, size = [box.x,box.y], wall = box_wall, rounding = corner, irounding = icorner, anchor = BOT);
up(adjusted_headspace) stacker(true);
}
}
}
module breadboard () { //Mezzanine stacker for 2 40x60mm breadboards
difference () {
union() {
mezzanine(adjusted_headspace);
up(gnss_clearance + base.z) {
left(breadboard.x/2 + 10) down(base.z/2)
rect_tube(h = frame.z, size1 = [frame.x,frame.y],
size2 = [frame.x + 1, frame.y + 1], wall = frame_wall);
right(breadboard.x/2 + 10) down(base.z/2)
rect_tube(h = frame.z, size1 = [frame.x,frame.y],
size2 = [frame.x + 1, frame.y + 1], wall = frame_wall);
}
}
union() {
left(breadboard.x/2 + 10)
cuboid(cutout, anchor = BOT);
right(breadboard.x/2 + 10)
cuboid(cutout, anchor = BOT);
cuboid(cable_hole, rounding = cable_hole.x/2, edges = "Z", anchor = BOT);
left(box.x/2 - cable_hole.x) xscale(0.8)
cuboid(cable_hole, rounding = cable_hole.x/2, edges = "Z", anchor = BOT);
right(box.x/2 - cable_hole.x) xscale(0.8)
cuboid(cable_hole, rounding = cable_hole.x/2, edges = "Z", anchor = BOT);
}
}
}
// Testing Modules *******************************
module slice (side) { // prints a box segment to verify wall hole location
// function arguments are "usb" or "grove"
s = box.x+2;
front_half (s, y = pcb_edge.y+2) {
//back_half(s, y = -pcb_edge.y) {
//top_half(s, z=box_wall/2) {
//bottom_half (s, z=pcb_edge.z+grove.z) {
if (side == "grove") left_half (s, x=-49) box();
if (side == "usb") right_half (s, x=49) box();
//}
//}
//}
}
}
module frame_test() { // Prints a frame to test the fit of the breadboard PCB.
// Adjust the values of breadboard_fudge[] for a press-fit of the PCB.
echo(cutout);
difference() {
cuboid([cutout.x + 15, cutout.y + 15, base.z], rounding = 5, edges = "Z", anchor = BOT); // a small base
cuboid(cutout, anchor = BOT);
}
rect_tube(h = frame.z, size1 = [frame.x,frame.y],
size2 = [frame.x + 1, frame.y + 1], wall = frame_wall);
}
// Misc. Utility Modules
module echo2(arg) {
echo(str("\n\n", arg, "\n\n" ));
}