/
buspirate_v36.scad
147 lines (129 loc) · 4.26 KB
/
buspirate_v36.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
include <util.scad>
FontMajorShift3D02="Major Snafu:style=3D\\_03";
Font=FontMajorShift3D02;
mil = 25.4/1000;
// DP6037 dimensions (mm)
w = 60;
h = 37;
corner_r = 2;
hole_ofs = 4;
hole_r = 3.2/2;
pcb_thk = 1.6;
// Connectors and LEDs
// TODO: Currently hardcoded in lid module
// Fasteners
nut_d = 6.1 + 0.5; // M3
nut_h = 2.25; // M3 (normal: 2.25mm; jam nut: 1.8mm)
screw_d = 5.55 + 0.15; // M3 cap
screw_h = 2.9 + 0.2; // M3 cap
// Case parameters
thk = 2.1;
standoff_h = 1.5;
standoff_thk = thk;
top_h = 6;
slack = 0.5;
hole_slack = 0.2;
module usb_mini_inner_profile() {
// TODO: fix 3.1*{0.6,0.4}
polygon([[-6.9/2, 3.1], [6.9/2, 3.1],
[6.9/2, 3.1*0.6], [5.87/2, 3.1*0.4], [5.87/2, 0],
[-5.87/2, 0], [-5.87/2, 3.1*0.4], [-6.9/2, 3.1*0.6]]);
}
usb_mini_thick = 0.5;
usb_mini_ih = 3.1;
module usb_mini_profile(h, ext=0) {
translate([0, usb_mini_thick+ext, 0])
linear_extrude(height=h) minkowski() {
usb_mini_inner_profile();
circle(r = usb_mini_thick+ext, $fn=18);
}
}
module case() {
d = standoff_h + pcb_thk + top_h;
difference() {
union() {
// Main shell
difference() {
translate([0, 0, -thk])
roundedCube4([w + 2*slack + 2*thk,
h + 2*slack + 2*thk,
d + thk],
r = corner_r + thk,
center = [true, true, false],
$fn=36);
roundedCube4([w + 2*slack, h + 2*slack, d+1],
r = corner_r,
center = [true, true, false],
$fn=36);
}
// Standoffs
for (i = [-1,+1], j=[-1,+1])
translate([i*(w/2-hole_ofs), j*(h/2-hole_ofs), -thk])
cylinder(r = hole_r + hole_slack + standoff_thk,
h = thk + standoff_h, $fn=27);
}
// Standoff holes
for (i = [-1,+1], j=[-1,+1])
translate([i*(w/2-hole_ofs), j*(h/2-hole_ofs), -thk-1]) {
cylinder(r = hole_r + hole_slack,
h = thk + standoff_h + 2, $fn=27);
cylinder(r = nut_d/2 + hole_slack, h = 1 + nut_h, $fn=6);
}
// Mini-USB
translate([-w/2-slack+1, 0, standoff_h + pcb_thk]) rotate([90, 0, -90]) usb_mini_profile(thk+2, ext = hole_slack);
}
}
module lid(name=true) {
difference() {
union() {
roundedCube4([w + 2*slack + 2*thk,
h + 2*slack + 2*thk,
thk],
r = corner_r + thk,
center = [true, true, false],
$fn=36);
// Standoffs
for (i = [-1,+1], j=[-1,+1])
translate([i*(w/2-hole_ofs), j*(h/2-hole_ofs), 0])
cylinder(r = hole_r + hole_slack + standoff_thk,
h = thk + top_h, $fn=27);
}
if(name==true)
rotate([180,0,180]) translate([-20,-2.6,-thk-0.1]) linear_extrude(thk+0.2)
text("BP 3.6",size=7,font=Font);
// Standoff holes
for (i = [-1,+1], j=[-1,+1])
translate([i*(w/2-hole_ofs), j*(h/2-hole_ofs), -1]) {
cylinder(r = hole_r + hole_slack,
h = thk + top_h + 2, $fn=27);
cylinder(r = screw_d/2 + hole_slack, h = 1 + screw_h, $fn=27);
}
// ICSP header hole (center is 3.5mm from board edge)
translate([0, -h/2 + 3.5, -1])
roundedCube4([500*mil + 2*hole_slack,
100*mil + 2*hole_slack,
thk + 2],
r = 20*mil,
center = [true, true, false],
$fn = 18);
// Main header hole (center is 8.5mm from board edge)
translate([-w/2 + 8.5, 0, -1])
roundedCube4([350*mil + 2*hole_slack,
800*mil + 2*hole_slack,
thk + 2],
r = 10*mil,
center = [true, true, false],
$fn = 18);
// LED holes (0805 chip, 2.5mm from top edge, spaced 10mm)
for (i = [-3, -1, +1, +3])
translate([i*10/2, h/2 - 2.5, -1])
roundedCube4([80*mil + 2*hole_slack,
50*mil + 2*hole_slack,
thk+2],
r = 10*mil,
center = [true, true, false], $fn=18);
}
}
echo("M3 cap screw length: ", thk + standoff_h + pcb_thk + top_h + thk - screw_h);
translate([0, h/2 + 5, thk]) case();
translate([0, -h/2 - 5, 0]) lid();