|
@@ -0,0 +1,138 @@
|
|
1
|
+include <MCAD/polyholes.scad>;
|
|
2
|
+include <MCAD/units.scad>;
|
|
3
|
+
|
|
4
|
+include <sink.scad>;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+/*
|
|
8
|
+ * Mill-Max Series 854 cutout
|
|
9
|
+ *
|
|
10
|
+ * Cutout is centered on the first pin, with the other pins along the positive
|
|
11
|
+ * X axis.
|
|
12
|
+ */
|
|
13
|
+module mill_max_854_cutout(pins, h, clearance) {
|
|
14
|
+ translate([-0.025*inch - 0.115*inch/2 - clearance, -0.0435*inch - clearance, 0])
|
|
15
|
+ cube([pins*.05*inch + 0.115*inch + 2*clearance, .087*inch + 2*clearance, h]);
|
|
16
|
+}
|
|
17
|
+
|
|
18
|
+/*
|
|
19
|
+ * 3D-printed part of a PD Buddy programming jig
|
|
20
|
+ */
|
|
21
|
+module programming_jig(board=sink_0_3, layer_thickness=0.4*mm,
|
|
22
|
+ extrusion_width=0.6*mm, clearance=0.1*mm) {
|
|
23
|
+ /* It would be ridiculous to try to cram enough information into the board
|
|
24
|
+ * objects to properly parameterize this, so the board is only used to set
|
|
25
|
+ * which object we're making. */
|
|
26
|
+ if (board == sink_0_3) {
|
|
27
|
+ /* Pin dimensions */
|
|
28
|
+ pwr_bottom = 0.212*inch;
|
|
29
|
+ pwr_stroke = 0.090*inch;
|
|
30
|
+ pwr_mid = pwr_bottom + pwr_stroke/2;
|
|
31
|
+ swd_bottom = 0.212*inch;
|
|
32
|
+ swd_stroke = 0.055*inch;
|
|
33
|
+ swd_mid = swd_bottom + swd_stroke/2;
|
|
34
|
+
|
|
35
|
+ /* The ideal height for the pin jig: the average of the mid-stroke
|
|
36
|
+ * heights for both types of pin */
|
|
37
|
+ ideal_board_height = (pwr_mid + swd_mid)/2;
|
|
38
|
+
|
|
39
|
+ /* The height of the pin jig, rounded to the nearest layer_thickness */
|
|
40
|
+ board_height = round(ideal_board_height / layer_thickness) * layer_thickness;
|
|
41
|
+
|
|
42
|
+ echo(ideal_board_height=ideal_board_height, board_height=board_height);
|
|
43
|
+ echo(pwr_percent=100-(board_height-pwr_bottom)*100/pwr_stroke);
|
|
44
|
+ echo(swd_percent=100-(board_height-swd_bottom)*100/swd_stroke);
|
|
45
|
+
|
|
46
|
+ /* The board's ideal location */
|
|
47
|
+ /*
|
|
48
|
+# translate([0, 0, ideal_board_height])
|
|
49
|
+ sink(board);
|
|
50
|
+ */
|
|
51
|
+
|
|
52
|
+ /* The board's real location */
|
|
53
|
+ /*
|
|
54
|
+ translate([0, 0, board_height])
|
|
55
|
+ sink(board);
|
|
56
|
+ */
|
|
57
|
+
|
|
58
|
+ /* Lip around the board */
|
|
59
|
+ translate([-2*extrusion_width - clearance, -2*extrusion_width - clearance, board_height])
|
|
60
|
+ cube([4*extrusion_width + 2*clearance + sink_length(board), 2*extrusion_width, sink_thickness(board)]);
|
|
61
|
+ translate([-2*extrusion_width - clearance, sink_width(board) + clearance, board_height])
|
|
62
|
+ cube([4*extrusion_width + 2*clearance + sink_length(board), 2*extrusion_width, sink_thickness(board)]);
|
|
63
|
+ translate([-2*extrusion_width - clearance, -clearance, board_height])
|
|
64
|
+ cube([2*extrusion_width, 2*clearance + sink_width(board), sink_thickness(board)]);
|
|
65
|
+ translate([sink_length(board) + clearance, -clearance, board_height])
|
|
66
|
+ cube([2*extrusion_width, 2*clearance + sink_width(board), sink_thickness(board)]);
|
|
67
|
+
|
|
68
|
+ /* Box under the board
|
|
69
|
+ * Every cutout is extended by clearance in X and Y. Since the board
|
|
70
|
+ * can shift by that much, everything on it can too. */
|
|
71
|
+ difference() {
|
|
72
|
+ translate([-2*extrusion_width - clearance, -2*extrusion_width - clearance, 0])
|
|
73
|
+ cube([4*extrusion_width + 2*clearance + sink_length(board),
|
|
74
|
+ 4*extrusion_width + 2*clearance + sink_width(board),
|
|
75
|
+ board_height]);
|
|
76
|
+
|
|
77
|
+ /* Cutout for the output connector */
|
|
78
|
+ hull() {
|
|
79
|
+ translate([26.5*mm, 11*mm, -epsilon])
|
|
80
|
+ polyhole(d=2*1.75*mm + 2*clearance, h=board_height + 2*epsilon);
|
|
81
|
+ translate([26.5*mm, 14*mm, -epsilon])
|
|
82
|
+ polyhole(d=2*1.75*mm + 2*clearance, h=board_height + 2*epsilon);
|
|
83
|
+ }
|
|
84
|
+
|
|
85
|
+ /* Cutout under the USB connector */
|
|
86
|
+ translate([-clearance, sink_width(board)/2 - sink_connector_cutout(board)/2 - clearance, board_height - 2*layer_thickness])
|
|
87
|
+ cube([2*clearance + sink_connector(board)[0] - sink_connector_extend(board), sink_connector_cutout(board) + 2*clearance, 2*layer_thickness + epsilon]);
|
|
88
|
+
|
|
89
|
+ /* Cutout for the switch */
|
|
90
|
+ switch_cutout_height = ceil((1.4*mm + layer_thickness)/layer_thickness)*layer_thickness;
|
|
91
|
+ translate([12*mm - clearance, 3.5*mm - clearance, board_height - switch_cutout_height])
|
|
92
|
+ cube([9*mm + 2*clearance, 6*mm + 2*clearance, switch_cutout_height + epsilon]);
|
|
93
|
+
|
|
94
|
+ /* Cutout for the power pins */
|
|
95
|
+ translate([11*mm - 0.05*inch - clearance, 2*mm - 0.05*inch - clearance, -epsilon])
|
|
96
|
+ cube([0.2*inch + 2*clearance, 0.1*inch + 2*clearance, board_height + 2*epsilon]);
|
|
97
|
+
|
|
98
|
+ /* Cutout to remove the thin piece between the switch and power
|
|
99
|
+ * pins */
|
|
100
|
+ translate([12*mm - clearance, 2*mm + 0.05*inch - epsilon, board_height - switch_cutout_height])
|
|
101
|
+ cube([-1*mm + 0.15*inch + 2*clearance, 1.5*mm - 0.05*inch + 2*epsilon, switch_cutout_height + epsilon]);
|
|
102
|
+
|
|
103
|
+ /* Cutouts for the SWD pins */
|
|
104
|
+ translate([23.55*mm, 17.96*mm, -epsilon])
|
|
105
|
+ rotate([0, 0, 90])
|
|
106
|
+ mill_max_854_cutout(pins=5, h=board_height + 2*epsilon, clearance=clearance);
|
|
107
|
+ translate([27.45*mm, 17.96*mm, -epsilon])
|
|
108
|
+ rotate([0, 0, 90])
|
|
109
|
+ mill_max_854_cutout(pins=5, h=board_height + 2*epsilon, clearance=clearance);
|
|
110
|
+ }
|
|
111
|
+
|
|
112
|
+ /* Mounting holes */
|
|
113
|
+ difference() {
|
|
114
|
+ translate([sink_length(board) + clearance + 2*extrusion_width,
|
|
115
|
+ -clearance - 2*extrusion_width,
|
|
116
|
+ 0])
|
|
117
|
+ cube([8*mm, 8.5*mm, board_height + sink_thickness(board)]);
|
|
118
|
+
|
|
119
|
+ translate([35*mm, 3*mm, -epsilon])
|
|
120
|
+ polyhole(d=3.3*mm, h=board_height + sink_thickness(board) + 2*epsilon);
|
|
121
|
+ }
|
|
122
|
+
|
|
123
|
+ difference() {
|
|
124
|
+ translate([-clearance - 2*extrusion_width,
|
|
125
|
+ sink_width(board) + clearance + 2*extrusion_width,
|
|
126
|
+ 0])
|
|
127
|
+ rotate([0, 0, 180])
|
|
128
|
+ cube([8*mm, 8.5*mm, board_height + sink_thickness(board)]);
|
|
129
|
+
|
|
130
|
+ translate([-5*mm, 22*mm, -epsilon])
|
|
131
|
+ polyhole(d=3.3*mm, h=board_height + sink_thickness(board) + 2*epsilon);
|
|
132
|
+ }
|
|
133
|
+
|
|
134
|
+ echo(total_height=board_height + sink_thickness(board));
|
|
135
|
+ }
|
|
136
|
+}
|
|
137
|
+
|
|
138
|
+programming_jig();
|