-
Notifications
You must be signed in to change notification settings - Fork 0
/
project-box.scad
214 lines (184 loc) · 8.97 KB
/
project-box.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
$fn=50;
// ********************************************************************7
// Paremeters
// *********************************************************************
fudge=0.004;
// screw dimenstions
m2_screw_diameter = 2.2;
m3_screw_diameter = 3.2;
screw_length = 10;
screw_diameter = m2_screw_diameter;
screw_head_height = 1.5;
screw_head_diameter = 3.5;
screw_column_width = screw_diameter * 2;
// PCB dimensions
pcb_width = 88.9;
pcb_length = 52.1;
pcb_height = 1.6;
pcb_radius = 6;
mounting_hole_width = 78.7;
mounting_hole_length = 35.6;
// box interior dimensions
width = pcb_width + 2 * screw_column_width;
length = pcb_length + 2 * screw_column_width;
height = 30;
// case exterior dimensions
wall_thickness = 2;
wall_radius = wall_thickness;
case_width = width + 2 * wall_thickness;
case_length = length + 2 * wall_thickness;
case_height = height + 2 * wall_thickness;
// lid dimensions
lid_thickness = 4;
lid_clearance = 0.2;
// position of standoff for PCB
pcb_hole_x_offset = wall_thickness + (width - mounting_hole_width) / 2;
pcb_hole_y_offset = wall_thickness + (length - mounting_hole_length) / 2;
pcb_hole_diam = 2.2;
pcb_standoff_diameter = 5;
pcb_standoff_height = 5;
// sizes of penetrations
usb_width = 12;
usb_height = 8;
usb_height_from_pcb = 1;
thermocouple_diameter = 3;
// ********************************************************************7
// Build
// *********************************************************************
// Render the project box
project_box();
// You can render your pcb to show it inside the case
color("blue") translate([wall_thickness - wall_radius / 2 + screw_column_width + pcb_radius, wall_thickness - wall_radius / 2 + screw_column_width + pcb_radius,wall_thickness+pcb_standoff_height]) pcb();
// Render the lid
#translate([0,0,wall_thickness + height + lid_thickness / 2 + 5])
project_lid();
// Render the lid for printing
*project_lid();
// ********************************************************************7
// Modules
// *********************************************************************
module project_box()
{
difference()
{
// make the outside box
linear_extrude(case_height)
{
minkowski()
{
square([case_width - wall_radius, case_length - wall_radius]);
circle(wall_radius);
}
}
// remove the interior
translate([wall_thickness - wall_radius / 2, wall_thickness - wall_radius / 2, wall_thickness])
cube([width, length, height + wall_thickness + fudge]);
// make a hole centered on the usb port above the PCB
translate([- wall_radius - fudge, (case_length - wall_radius - usb_width) / 2, wall_thickness + pcb_standoff_height + pcb_height + usb_height_from_pcb - usb_height / 2])
cube([wall_thickness + wall_radius / 2 + 2 * fudge, usb_width, usb_height]);
// make a hole for the temperature probe
translate([- wall_radius - fudge, case_length / 4 - wall_radius / 2, wall_thickness + case_height - lid_thickness - thermocouple_diameter / 2])
rotate([0, 90, 0])
union()
{
cylinder(h = wall_thickness + wall_radius / 2 + fudge * 2, d = thermocouple_diameter);
translate([-lid_thickness, -thermocouple_diameter / 2, 0])
cube([lid_thickness, thermocouple_diameter, wall_thickness + wall_radius / 2 + fudge * 2]);
}
}
// add columns to hold lid screws
translate([wall_thickness - wall_radius / 2, wall_thickness - wall_radius / 2, wall_thickness])
screw_column(screw_column_width, height, screw_diameter, screw_length);
translate([width + wall_thickness - wall_radius / 2 - screw_column_width, wall_thickness - wall_radius / 2, wall_thickness])
screw_column(screw_column_width, height, screw_diameter, screw_length);
translate([wall_thickness - wall_radius / 2, length + wall_thickness - wall_radius / 2 - screw_column_width, wall_thickness])
screw_column(screw_column_width, height, screw_diameter, screw_length);
translate([width + wall_thickness - wall_radius / 2 - screw_column_width, length + wall_thickness - wall_radius / 2 - screw_column_width, wall_thickness])
screw_column(screw_column_width, height, screw_diameter, screw_length);
// add standoff for PCB
translate([pcb_hole_x_offset - wall_radius / 2, pcb_hole_y_offset - wall_radius / 2, wall_thickness])
round_stand_off(pcb_standoff_diameter, pcb_standoff_height, screw_length, screw_diameter);
translate([pcb_hole_x_offset - wall_radius / 2 + mounting_hole_width, pcb_hole_y_offset - wall_radius / 2, wall_thickness])
round_stand_off(pcb_standoff_diameter, pcb_standoff_height, screw_length, screw_diameter);
translate([pcb_hole_x_offset - wall_radius / 2, pcb_hole_y_offset - wall_radius / 2 + mounting_hole_length, wall_thickness])
round_stand_off(pcb_standoff_diameter, pcb_standoff_height, screw_length, screw_diameter);
translate([pcb_hole_x_offset - wall_radius / 2 + mounting_hole_width, pcb_hole_y_offset - wall_radius / 2 + mounting_hole_length, wall_thickness])
round_stand_off(pcb_standoff_diameter, pcb_standoff_height, screw_length, screw_diameter);
}
module project_lid()
{
difference()
{
union()
{
linear_extrude(lid_thickness / 2)
{
minkowski()
{
square([case_width - wall_radius, case_length - wall_radius]);
circle(wall_radius);
}
}
translate([wall_thickness - wall_radius / 2, wall_thickness - wall_radius / 2, -lid_thickness / 2 + lid_clearance])
cube([width, length, lid_thickness / 2 - lid_clearance]);
}
// TODO: mounting screw holes
translate([screw_column_width / 2 + wall_thickness - wall_radius / 2, screw_column_width / 2 + wall_thickness - wall_radius / 2, - lid_thickness / 2 + lid_clearance / 2 - fudge])
cylinder(h = lid_thickness + fudge * 2, d = screw_diameter);
translate([-screw_column_width / 2 + wall_thickness - wall_radius / 2 + width, screw_column_width / 2 + wall_thickness - wall_radius / 2, - lid_thickness / 2 + lid_clearance / 2 - fudge])
cylinder(h = lid_thickness + fudge * 2, d = screw_diameter);
translate([screw_column_width / 2 + wall_thickness - wall_radius / 2, length - screw_column_width / 2 + wall_thickness - wall_radius / 2, - lid_thickness / 2 + lid_clearance / 2 - fudge])
cylinder(h = lid_thickness + fudge * 2, d = screw_diameter);
translate([-screw_column_width / 2 + wall_thickness - wall_radius / 2 + width, length - screw_column_width / 2 + wall_thickness - wall_radius / 2, - lid_thickness / 2 + lid_clearance / 2 - fudge])
cylinder(h = lid_thickness + fudge * 2, d = screw_diameter);
// TODO: mounting screw hole counter sinks
translate([screw_column_width / 2 + wall_thickness - wall_radius / 2, screw_column_width / 2 + wall_thickness - wall_radius / 2, lid_thickness / 2 - screw_head_height + fudge])
cylinder(h = screw_head_height + fudge, d = screw_head_diameter);
translate([-screw_column_width / 2 + wall_thickness - wall_radius / 2 + width, screw_column_width / 2 + wall_thickness - wall_radius / 2, lid_thickness / 2 - screw_head_height + fudge])
cylinder(h = screw_head_height + fudge * 2, d = screw_head_diameter);
translate([screw_column_width / 2 + wall_thickness - wall_radius / 2, length - screw_column_width / 2 + wall_thickness - wall_radius / 2, lid_thickness / 2 - screw_head_height + fudge])
cylinder(h = screw_head_height + fudge * 2, d = screw_head_diameter);
translate([-screw_column_width / 2 + wall_thickness - wall_radius / 2 + width, length - screw_column_width / 2 + wall_thickness - wall_radius / 2, lid_thickness / 2 - screw_head_height + fudge])
cylinder(h = screw_head_height + fudge * 2, d = screw_head_diameter);
}
}
module pcb()
{
linear_extrude(pcb_height)
{
minkowski()
{
square([pcb_width - 2 * pcb_radius, pcb_length - 2 * pcb_radius]);
circle(pcb_radius);
}
}
}
module screw_column(width, height, screw_diameter, screw_length)
{
difference()
{
cube([width, width, height]);
translate([width / 2, width / 2, height - screw_length])
cylinder(h = screw_length + fudge, d = screw_diameter);
}
}
module round_stand_off(diam, height, screw_length, screw_diam)
{
difference()
{
translate([0,0,height/2])
cylinder(h=height,r=diam/2, center=true);
translate([0,0,height-screw_length])
cylinder(h=screw_length+fudge,r=screw_diam/2);
}
}
module stand_off(width, height, screw_diam, screw_length)
{
difference()
{
translate([0,0,height/2])
cube([width,width,height], center=true);
translate([0,0,height-screw_length])
cylinder(h=screw_length+fudge,r=screw_diam/2);
}
}