-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharduino.scad
203 lines (187 loc) · 4.13 KB
/
arduino.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
/* arduino.scad
*
* Copyright (C) Jestin Stoffel 2012
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
// Throughout this entire model, (0,0) is the top left mounting hole (nearest the USB port)
use <M3.scad>
// thickness of the PCB
board_height = 1.8;
// solid_holes - specifies if mounting holes should be added to or subtracted from the model
// combined_headers - specifies if space should be left between adjacent female headers, or if they should be rendered as a single header
// extend_ports - extends the USB and power ports by a centimeter, so that holes are more easily made when a model is used as a negative
module Arduino(solid_holes, combined_headers, extend_ports)
{
echo(str("solid_holes: ", solid_holes));
echo(str("combined_headers: ", combined_headers));
echo(str("extend_ports: ", extend_ports));
if (solid_holes == 1)
{
echo("solid holes");
union()
{
Board();
USB(extend_ports);
PowerPlug(extend_ports);
FemaleHeaders(combined_headers);
MaleHeaders();
ResetButton();
ATMega();
MountingHoles();
}
}
else
{
echo("regular holes");
difference()
{
union()
{
Board();
USB(extend_ports);
PowerPlug(extend_ports);
FemaleHeaders(combined_headers);
MaleHeaders();
ResetButton();
ATMega();
}
MountingHoles();
}
}
}
module ResetButton()
{
translate([39, -26, board_height])
{
color([0.8, 0.8, 0.8])
cube([6, 6, 2.2]);
color([0.6, 0.4, 0.2])
translate([3, 3, 0]) cylinder(r=1.4, h=3.5, $fn=25);
}
}
module MaleHeaders()
{
color([0.6, 0.6, 0.6])
translate([0, 0, board_height])
{
translate([0, -7, 0]) cube([7, 5, 9.2]);
translate([47.5, -26, 0]) cube([5, 7, 9.2]);
}
}
module ATMega()
{
color([0.3, 0.3, 0.3])
translate([14, -39, board_height])
{
cube([35.5, 10, 7.5]);
}
}
module FemaleHeaders(combined)
{
color([0.3, 0.3, 0.3])
translate([0, 0, board_height])
{
translate([0, -1, 0])
{
translate([7, 0, 0])
{
if(combined == 1)
{
cube([43, 2, 8.2]);
}
else
{
cube([21, 2, 8.2]);
translate([22, 0, 0]) cube([21, 2, 8.2]);
}
}
}
translate([0, -50, 0])
{
translate([17, 0, 0])
{
if(combined == 1)
{
cube([33, 2, 8.2]);
}
else
{
cube([15.5, 2, 8.2]);
translate([17.5, 0, 0]) cube([15.5, 2, 8.2]);
}
}
}
}
}
module PowerPlug(extended)
{
if(extended == 1)
{
translate([-26.893, -47.4929962, board_height])
color([0.3, 0.3, 0.3])
cube([24, 9, 11]);
}
else
{
translate([-16.893, -47.4929962, board_height])
color([0.3, 0.3, 0.3])
cube([14, 9, 11]);
}
}
module USB(extended)
{
if(extended == 1)
{
translate([-31.465, -18.5623962, board_height])
color([0.8, 0.8, 0.8])
cube([26, 12, 11]);
}
else
{
translate([-21.465, -18.5623962, board_height])
color([0.8, 0.8, 0.8])
cube([16, 12, 11]);
}
}
module Board()
{
color([0, 0.6, 0.8])
linear_extrude(height = board_height, convexity = 10, twist = 0)
{
polygon( points = [ [-15.115, 2.545],
[49.4, 2.545],
[50.925, 1.021],
[50.925, -10.409],
[53.465, -12.949],
[53.465, -45.715],
[50.925, -48.255],
[50.925, -50.795],
[-15.115, -50.795] ],
paths = [[0, 1, 2, 3, 4, 5, 6, 7, 8]],
convexity = 10);
}
}
module MountingHoles()
{
translate([0, 0, -10])
{
M3_hole(depth=25);
M3_hole([-1.0929112, -48.4026972, 0],depth=25);
M3_hole([51, -15.25, 0],depth=25);
M3_hole([51, -43.25, 0],depth=25);
}
}
//Arduino( solid_holes=1, combined_headers=0, extend_ports=1);