-
Notifications
You must be signed in to change notification settings - Fork 0
/
Longboard Case.scad
338 lines (255 loc) · 8.2 KB
/
Longboard Case.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
// Longboard Ground Effect Lighting Controller Case
// Ed Nisley KE4ZNU
// Karen Nisley KC2SYU
// October 2012
// Layout options
Layout = "Build1";
// Overall layout: Fit Show
// Printing plates: Build1 .. Buildn (see bottom!)
// Parts: BatteryLayer PCBLayer1 PCBLayer2
// Shapes: CaseShell PCBEnvelope
ShowGap = 5; // spacing between parts in Show layout
//-----
// Extrusion parameters must match reality!
ThreadThick = 0.25;
ThreadWidth = 2.0 * ThreadThick;
HoleWindage = 0.2;
//-- Handy stuff
function IntegerMultiple(Size,Unit) = Unit * ceil(Size / Unit);
Protrusion = 0.1; // make holes end cleanly
inch = 25.4;
Tap10_32 = 0.159 * inch;
Clear10_32 = 0.190 * inch;
Head10_32 = 0.373 * inch;
Head10_32Thick = 0.110 * inch;
Nut10_32Dia = 0.433 * inch;
Nut10_32Thick = 0.130 * inch;
Washer10_32OD = 0.381 * inch;
Washer10_32ID = 0.204 * inch;
//----------------------
// Dimensions
FlangeWidth = IntegerMultiple(5.0,ThreadWidth);
FlangeThick = 2*ThreadThick;
CellWidth = 50.0; // Lithium-ion cell dimensions
CellLength = 60.0;
CellThick = 6.0;
CellClearance = 1.5; // on all sides
CellTabClearance = 15.0; // for connections
CellHoldWidth = 6.0; // edge to tabs
CellHoldLength = 4*ThreadWidth;
CellCount = 4; // cells in the battery
BatteryHeight = CellCount*CellThick + 2*CellClearance;
BatteryLength = CellLength + 2*CellClearance;
BatteryWidth = CellWidth + 2*CellClearance;
PCMWidth = 16.0; // Battery protection module
PCMLength = 51.0;
PCMThick = 4.0; // at terminal end of cells
PillarOD = Washer10_32OD + 2*1.0; // screw pillar diameter
PillarOffset = (PillarOD/2) / sqrt(2.0); // distance to case inside corner
WallThick = 7.5; // case wall thickness
PinOD = 1.4; // alignment pin size
CaseInsideLength = BatteryLength + CellTabClearance + PCMThick;
CaseOALength = CaseInsideLength + 2*WallThick;
echo("Box Length outside: ",CaseOALength);
echo(" inside: ",CaseInsideLength);
WiringLength = CaseInsideLength - CellLength - CellHoldLength - PCMThick; // wiring space at PCM
echo("Wiring length: ",WiringLength);
CaseInsideWidth = BatteryWidth;
CaseOAWidth = CaseInsideWidth + 2*WallThick;
echo("Box Width outside: ",CaseOAWidth);
echo(" inside: ",CaseInsideWidth);
echo("Screw OC length: ",CaseInsideLength + 2*PillarOffset);
echo(" width: ",CaseInsideWidth + 2*PillarOffset);
PCBThick = 2.0; // PCB thickness
PCBMargin = 3.0; // clamping margin around PCB edge
PartHeight = 17.0; // height of components above PCB (mind the switch!)
WiringThick = 5.0; // wiring below PCB
echo("PCB thickness:",PCBThick);
echo(" clamp margin: ",PCBMargin);
echo(" wiring: ",WiringThick);
echo(" components: ",PartHeight);
PCBLayer1Thick = IntegerMultiple(WiringThick + PCBThick/2,ThreadThick);
PCBLayer2Thick = IntegerMultiple(PartHeight + PCBThick/2,ThreadThick);
echo("Battery compartment height: ",BatteryHeight);
echo("PCB Layer 1 height: ",PCBLayer1Thick);
echo("PCB Layer 2 height: ",PCBLayer2Thick);
PlateThick = 1/16 * inch; // aluminum mount / armor plates
echo("Total height: ",2*PlateThick + BatteryHeight + PCBLayer1Thick + PCBLayer2Thick);
ChargePlugOD = 11.5; // battery charger plug
ChargeJackHeightOC = 6.5; // coaxial jack center pin height from PCB
SwitchLength = 20.0; // master power switch
SwitchWidth = 13.0;
WheelCableOD = 3.0; // 3-conductor from wheel rotation sensor
LEDCableWidth = 10.0; // 6 conductor loose wires to LED strips
LEDCableThick = 2.0;
//----------------------
// Useful routines
module PolyCyl(Dia,Height,ForceSides=0) { // based on nophead's polyholes
Sides = (ForceSides != 0) ? ForceSides : (ceil(Dia) + 2);
FixDia = Dia / cos(180/Sides);
cylinder(r=(FixDia + HoleWindage)/2,
h=Height,
$fn=Sides);
}
module ShowPegGrid(Space = 10.0,Size = 1.0) {
Range = floor(50 / Space);
for (x=[-Range:Range])
for (y=[-Range:Range])
translate([x*Space,y*Space,Size/2])
%cube(Size,center=true);
}
//-------------------
// Shapes
module CaseShell(h=1.0) {
difference() {
union() {
translate([0,0,h/2])
cube([CaseOALength,CaseOAWidth,h],center=true);
for (x=[-1,1])
for (y=[-1,1])
translate([x*(PillarOffset + CaseInsideLength/2),
y*(PillarOffset + CaseInsideWidth/2),
h/2])
cylinder(r=PillarOD/2,h,center=true,$fn=4*6);
}
for (x=[-1,1]) // screw holes on corners
for (y=[-1,1])
translate([x*(PillarOffset + CaseInsideLength/2),
y*(PillarOffset + CaseInsideWidth/2),
-Protrusion])
PolyCyl(Clear10_32,(h + 2*Protrusion),8);
for (x=[-1,1]) // alignment pins in width walls
translate([x*(CaseOALength - WallThick)/2,0,-Protrusion])
rotate(45)
PolyCyl(PinOD,(h + 2*Protrusion));
for (y=[-1,1]) // alignment pins in length walls
translate([0,y*(CaseOAWidth - WallThick)/2,-Protrusion])
rotate(45)
PolyCyl(PinOD,(h + 2*Protrusion));
}
}
module BatteryLayer() {
difference() {
CaseShell(BatteryHeight);
translate([0,0,BatteryHeight/2]) {
union() {
translate([-(CaseInsideLength/2 - BatteryLength/2),0,0])
cube([BatteryLength,
BatteryWidth,
BatteryHeight + 2*Protrusion],
center=true);
cube([CaseInsideLength,
(BatteryWidth - 2*CellHoldWidth),
BatteryHeight + 2*Protrusion],
center = true);
translate([(CaseInsideLength/2 - WiringLength/2),0,0])
cube([WiringLength,
max(BatteryWidth,PCMLength),
BatteryHeight + 2*Protrusion],
center=true);
}
}
}
}
module PCBEnvelope() {
union() {
translate([0,0,WiringThick + PCBThick + PartHeight/2])
cube([CaseInsideLength - 2*PCBMargin,
CaseInsideWidth - 2*PCBMargin,
PartHeight + 2*Protrusion],
center=true);
translate([0,0,WiringThick + PCBThick/2])
cube([CaseInsideLength,CaseInsideWidth,PCBThick],center=true);
translate([0,0,WiringThick/2])
cube([CaseInsideLength - 2*PCBMargin,
CaseInsideWidth - 2*PCBMargin,
WiringThick + 2*Protrusion],
center=true);
}
}
module PCBLayer1() {
difference() {
CaseShell(PCBLayer1Thick);
PCBEnvelope();
}
}
module PCBLayer2() {
difference() {
CaseShell(PCBLayer2Thick);
translate([0,0,-(WiringThick + PCBThick/2)])
PCBEnvelope();
translate([25,0,(PCBThick/2 + ChargeJackHeightOC)])
rotate([90,0,0])
PolyCyl(ChargePlugOD,CaseOAWidth);
translate([25,CaseOAWidth/2,PCBLayer2Thick/2])
rotate([90,0,0])
cube([SwitchLength,SwitchWidth,CaseOAWidth],center=true);
translate([-CaseOALength/2,0,PCBThick/2])
rotate([0,-90,0])
cube([2*WheelCableOD,WheelCableOD,CaseOALength],center=true);
translate([CaseOALength/2,0,PCBThick/2])
rotate([90,0,90])
cube([LEDCableWidth,2*LEDCableThick,CaseOALength],center=true);
}
}
module Aluminum() {
translate([0,0,PlateThick/2])
cube([1.1*CaseOALength,1.1*CaseOAWidth,PlateThick - Protrusion],center=true);
}
module MouseEars() {
for (x=[-1,1])
for (y=[-1,1])
translate([x*(PillarOffset + CaseInsideLength/2),
y*(PillarOffset + CaseInsideWidth/2),
FlangeThick/2])
difference() {
cylinder(r=(PillarOD/2 + FlangeWidth),FlangeThick,center=true,$fn=8*4);
translate([0,0,-FlangeThick/2 - Protrusion])
PolyCyl(Clear10_32,(FlangeThick + 2*Protrusion),8);
}
}
//-------------------
// Build things...
ShowPegGrid();
if ("Battery" == Layout)
Battery();
//if ("CaseShell" == Layout)
// CaseShell(something here!!!);
if ("BatteryLayer" == Layout)
BatteryLayer();
if ("PCBEnvelope" == Layout)
PCBEnvelope();
if ("PCBLayer1" == Layout)
PCBLayer1();
if ("PCBLayer2" == Layout)
PCBLayer2();
if ("Fit" == Layout) {
color("LightBlue") BatteryLayer();
translate([0,0,BatteryHeight + PlateThick])
color("Green") PCBLayer1();
translate([0,0,BatteryHeight + PlateThick + PCBLayer1Thick])
color("Cyan") PCBLayer2();
}
if ("Show" == Layout) {
color("LightBlue") BatteryLayer();
translate([0,0,BatteryHeight + PlateThick + ShowGap])
color("Green") PCBLayer1();
translate([0,0,BatteryHeight + PlateThick + PCBLayer1Thick + 2*ShowGap])
color("Cyan") PCBLayer2();
}
if ("Build1" == Layout)
rotate(90) {
BatteryLayer();
MouseEars();
}
if ("Build2" == Layout)
rotate(90) {
PCBLayer1();
MouseEars();
}
if ("Build3" == Layout) {
translate([0,0,PCBLayer2Thick])
rotate([0,180,90])
PCBLayer2();
rotate(90) MouseEars();
}