-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
448 lines (390 loc) · 17.4 KB
/
index.html
File metadata and controls
448 lines (390 loc) · 17.4 KB
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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Electrical Engineering Toolkit</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #2d3436 0%, #1e272e 100%);
color: #e4e4e4;
padding: 20px;
min-height: 100vh;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
h1 {
text-align: center;
color: #00b8d4;
margin-bottom: 30px;
font-size: 2.5em;
text-shadow: 0 2px 4px rgba(0,0,0,0.3);
display: flex;
align-items: center;
justify-content: center;
gap: 15px;
}
.lightning-icon {
width: 50px;
height: 50px;
filter: drop-shadow(0 0 10px rgba(0,184,212,0.8)) drop-shadow(0 0 20px rgba(0,184,212,0.5));
}
.input-section {
background: #3a4448;
padding: 30px;
border-radius: 12px;
box-shadow: 0 8px 16px rgba(0,0,0,0.4);
margin-bottom: 30px;
}
.input-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-bottom: 25px;
}
.input-group {
display: flex;
flex-direction: column;
}
label {
color: #b0bec5;
margin-bottom: 8px;
font-weight: 500;
font-size: 0.95em;
}
input {
padding: 12px;
border: 2px solid #546e7a;
border-radius: 6px;
background: #2d3436;
color: #e4e4e4;
font-size: 1em;
transition: all 0.3s;
}
input:focus {
outline: none;
border-color: #00b8d4;
box-shadow: 0 0 0 3px rgba(0,184,212,0.1);
}
button {
padding: 15px 40px;
background: linear-gradient(135deg, #00b8d4 0%, #0097a7 100%);
color: white;
border: none;
border-radius: 6px;
font-size: 1.1em;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
box-shadow: 0 4px 8px rgba(0,184,212,0.3);
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(0,184,212,0.4);
}
button:active {
transform: translateY(0);
}
.results {
display: none;
}
.results.show {
display: block;
}
.result-section {
background: #3a4448;
padding: 25px;
border-radius: 12px;
margin-bottom: 20px;
box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}
.result-section h2 {
color: #00b8d4;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #546e7a;
font-size: 1.5em;
}
.result-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 15px;
}
.result-item {
background: #2d3436;
padding: 15px;
border-radius: 8px;
border-left: 4px solid #00b8d4;
}
.result-label {
color: #90a4ae;
font-size: 0.9em;
margin-bottom: 5px;
}
.result-value {
color: #e4e4e4;
font-size: 1.3em;
font-weight: 600;
}
.standards-note {
margin-top: 15px;
padding-top: 10px;
font-size: 0.85em;
color: #6b7a82;
font-style: italic;
}
</style>
</head>
<body>
<div class="container">
<h1>
<svg class="lightning-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13 2L3 14h8l-1 8 10-12h-8l1-8z" fill="#00b8d4" stroke="#00e5ff" stroke-width="1" stroke-linejoin="round"/>
</svg>
Electrical Engineering Toolkit
</h1>
<div class="input-section">
<div class="input-grid">
<div class="input-group">
<label for="current">Current (A)</label>
<input type="number" id="current" step="0.1" value="1">
</div>
<div class="input-group">
<label for="ambient">Ambient Temperature (°C)</label>
<input type="number" id="ambient" step="1" value="25">
</div>
<div class="input-group">
<label for="thickness">Copper Thickness (oz/ft²)</label>
<input type="number" id="thickness" step="0.5" value="1">
</div>
<div class="input-group">
<label for="tempRise">Max Temp Rise (°C)</label>
<input type="number" id="tempRise" step="1" value="10">
</div>
</div>
<button onclick="calculate()">Calculate</button>
</div>
<div id="results" class="results">
<div class="result-section">
<h2>Wire Gauge</h2>
<div class="result-grid">
<div class="result-item">
<div class="result-label">NASA (MIL-STD-975)</div>
<div class="result-value" id="nasaAwg">-</div>
</div>
<div class="result-item">
<div class="result-label">UL 758</div>
<div class="result-value" id="ul758Awg">-</div>
</div>
<div class="result-item">
<div class="result-label">NEC (Latest)</div>
<div class="result-value" id="necAwg">-</div>
</div>
</div>
<div class="standards-note">
Wire gauges shown in AWG with diameter in mm
</div>
</div>
<div class="result-section">
<h2>Rigid PCB Trace Width</h2>
<div class="result-grid">
<div class="result-item">
<div class="result-label">Internal Layer (IPC-2221)</div>
<div class="result-value" id="internalTrace">-</div>
</div>
<div class="result-item">
<div class="result-label">External Coated (IPC-2221)</div>
<div class="result-value" id="externalCoated">-</div>
</div>
<div class="result-item">
<div class="result-label">External Uncoated (IPC-2221)</div>
<div class="result-value" id="externalUncoated">-</div>
</div>
</div>
<div class="standards-note">
IPC-2221 calculations based on standard temperature rise and copper weight
</div>
</div>
<div class="result-section">
<h2>Flex Circuit Trace Width</h2>
<div class="result-grid">
<div class="result-item">
<div class="result-label">Flex Trace (IPC-2223)</div>
<div class="result-value" id="flexTrace">-</div>
</div>
</div>
<div class="standards-note">
IPC-2223 calculations for flexible circuits with polyimide substrate
</div>
</div>
<div class="result-section">
<h2>Additional Information</h2>
<div class="result-grid">
<div class="result-item">
<div class="result-label">Component Lead Spacing</div>
<div class="result-value" id="leadSpacing">-</div>
</div>
<div class="result-item">
<div class="result-label">Minimum Gap</div>
<div class="result-value" id="minGap">-</div>
</div>
<div class="result-item">
<div class="result-label">Trace Gap</div>
<div class="result-value" id="traceGap">-</div>
</div>
</div>
</div>
</div>
</div>
<script>
// AWG wire data (gauge: {diameter_mm, area_mm2, resistance_ohm_per_km})
const awgData = {
0: {dia: 8.251, area: 53.48, ohm: 0.3224},
1: {dia: 7.348, area: 42.41, ohm: 0.4066},
2: {dia: 6.544, area: 33.63, ohm: 0.5127},
3: {dia: 5.827, area: 26.67, ohm: 0.6465},
4: {dia: 5.189, area: 21.15, ohm: 0.8152},
5: {dia: 4.621, area: 16.77, ohm: 1.028},
6: {dia: 4.115, area: 13.30, ohm: 1.296},
7: {dia: 3.665, area: 10.55, ohm: 1.634},
8: {dia: 3.264, area: 8.366, ohm: 2.061},
9: {dia: 2.906, area: 6.634, ohm: 2.599},
10: {dia: 2.588, area: 5.261, ohm: 3.277},
11: {dia: 2.305, area: 4.172, ohm: 4.132},
12: {dia: 2.053, area: 3.309, ohm: 5.211},
13: {dia: 1.828, area: 2.624, ohm: 6.571},
14: {dia: 1.628, area: 2.081, ohm: 8.286},
15: {dia: 1.450, area: 1.650, ohm: 10.45},
16: {dia: 1.291, area: 1.309, ohm: 13.17},
17: {dia: 1.150, area: 1.038, ohm: 16.61},
18: {dia: 1.024, area: 0.8231, ohm: 20.95},
19: {dia: 0.912, area: 0.6527, ohm: 26.42},
20: {dia: 0.812, area: 0.5176, ohm: 33.31},
21: {dia: 0.723, area: 0.4105, ohm: 42.00},
22: {dia: 0.644, area: 0.3255, ohm: 52.96},
23: {dia: 0.573, area: 0.2582, ohm: 66.79},
24: {dia: 0.511, area: 0.2047, ohm: 84.22},
25: {dia: 0.455, area: 0.1624, ohm: 106.2},
26: {dia: 0.405, area: 0.1288, ohm: 133.9},
27: {dia: 0.361, area: 0.1021, ohm: 168.9},
28: {dia: 0.321, area: 0.08098, ohm: 212.9},
29: {dia: 0.286, area: 0.06422, ohm: 268.5},
30: {dia: 0.255, area: 0.05067, ohm: 340.2}
};
function calculate() {
const current = parseFloat(document.getElementById('current').value);
const ambient = parseFloat(document.getElementById('ambient').value);
const thickness = parseFloat(document.getElementById('thickness').value);
const tempRise = parseFloat(document.getElementById('tempRise').value);
// Calculate wire gauges
calculateWireGauges(current);
// Calculate PCB traces
calculatePCBTraces(current, tempRise, thickness);
// Calculate flex traces
calculateFlexTraces(current, tempRise, thickness);
// Calculate additional info
calculateAdditionalInfo(current);
document.getElementById('results').classList.add('show');
}
function calculateWireGauges(current) {
// NASA MIL-STD-975 - Conservative aerospace standard
let nasaGauge = findWireGauge(current, 'nasa');
// UL 758 - More permissive for appliance wiring
let ulGauge = findWireGauge(current, 'ul758');
// NEC - National Electrical Code
let necGauge = findWireGauge(current, 'nec');
document.getElementById('nasaAwg').textContent =
`${nasaGauge} AWG (${awgData[nasaGauge].dia.toFixed(2)} mm)`;
document.getElementById('ul758Awg').textContent =
`${ulGauge} AWG (${awgData[ulGauge].dia.toFixed(2)} mm)`;
document.getElementById('necAwg').textContent =
`${necGauge} AWG (${awgData[necGauge].dia.toFixed(2)} mm)`;
}
function findWireGauge(current, standard) {
// Current capacity tables for different standards
const capacities = {
nasa: { // Conservative aerospace ratings
30: 0.5, 28: 0.8, 26: 1.3, 24: 2.0, 22: 3.0, 20: 5.0, 18: 7.0,
16: 10, 14: 15, 12: 20, 10: 30, 8: 40, 6: 55, 4: 70, 2: 95, 0: 125
},
ul758: { // UL appliance wire ratings
30: 0.86, 28: 1.4, 26: 2.2, 24: 3.5, 22: 5.0, 20: 7.5, 18: 10,
16: 13, 14: 17, 12: 23, 10: 33, 8: 46, 6: 60, 4: 80, 2: 115, 0: 150
},
nec: { // NEC Table 310.16 for 75°C insulation
30: 0.5, 28: 0.8, 26: 1.3, 24: 2.1, 22: 3.0, 20: 5.0, 18: 7.0,
16: 10, 14: 15, 12: 20, 10: 30, 8: 40, 6: 55, 4: 70, 2: 95, 0: 125
}
};
const table = capacities[standard];
const gauges = Object.keys(table).map(Number).sort((a, b) => b - a);
for (let gauge of gauges) {
if (current <= table[gauge]) {
return gauge;
}
}
return 0; // Default to 0 AWG if current exceeds all values
}
function calculatePCBTraces(current, tempRise, thickness) {
// IPC-2221 formulas
// Area = (Current / (k * (TempRise)^0.44))^(1/0.725)
// Width = Area / (thickness * 1.378) [mils]
// k values for different conditions
const kInternal = 0.024; // Internal layers
const kExternal = 0.048; // External layers
// Calculate required cross-sectional area in mils²
const areaInternal = Math.pow(current / (kInternal * Math.pow(tempRise, 0.44)), 1/0.725);
const areaExternal = Math.pow(current / (kExternal * Math.pow(tempRise, 0.44)), 1/0.725);
// Convert to width in mils (thickness in oz converts to mils as: 1 oz = 1.378 mils)
const thicknessMils = thickness * 1.378;
let widthInternalMils = areaInternal / thicknessMils;
let widthExternalCoatedMils = areaExternal / thicknessMils;
let widthExternalUncoatedMils = areaExternal / thicknessMils * 0.85; // Slightly better cooling
// Convert to mm
const milsToMm = 0.0254;
document.getElementById('internalTrace').textContent =
`${widthInternalMils.toFixed(1)} mils (${(widthInternalMils * milsToMm).toFixed(2)} mm)`;
document.getElementById('externalCoated').textContent =
`${widthExternalCoatedMils.toFixed(1)} mils (${(widthExternalCoatedMils * milsToMm).toFixed(2)} mm)`;
document.getElementById('externalUncoated').textContent =
`${widthExternalUncoatedMils.toFixed(1)} mils (${(widthExternalUncoatedMils * milsToMm).toFixed(2)} mm)`;
}
function calculateFlexTraces(current, tempRise, thickness) {
// IPC-2223 for flex circuits - typically requires wider traces than rigid
// Uses similar formula but with adjusted constants for polyimide substrate
const kFlex = 0.020; // Lower k value due to poorer heat dissipation in flex
const areaFlex = Math.pow(current / (kFlex * Math.pow(tempRise, 0.44)), 1/0.725);
const thicknessMils = thickness * 1.378;
let widthFlexMils = areaFlex / thicknessMils;
const milsToMm = 0.0254;
document.getElementById('flexTrace').textContent =
`${widthFlexMils.toFixed(1)} mils (${(widthFlexMils * milsToMm).toFixed(2)} mm)`;
}
function calculateAdditionalInfo(current) {
// IPC-2221 spacing recommendations based on voltage
// For low voltage (<50V), typical spacings:
// Component lead spacing - typically 0.1" (100 mils) for standard DIP
const leadSpacingMils = 100;
// Minimum gap for Class 3 (high reliability) - typically 8 mils minimum
const minGapMils = 8;
// Trace gap - varies with voltage, using conservative 10 mils for <50V
const traceGapMils = 10;
const milsToMm = 0.0254;
document.getElementById('leadSpacing').textContent =
`${leadSpacingMils} mils (${(leadSpacingMils * milsToMm).toFixed(2)} mm)`;
document.getElementById('minGap').textContent =
`${minGapMils} mils (${(minGapMils * milsToMm).toFixed(2)} mm)`;
document.getElementById('traceGap').textContent =
`${traceGapMils} mils (${(traceGapMils * milsToMm).toFixed(2)} mm)`;
}
</script>
</body>
</html>