Quellcode durchsuchen

Reorganize, add programming jig

The Sink is now in its own file, with a module to render the board.

I added the programming jig plastic part.  It looks like it fits the jig
PCB correctly, so there's not much holding me back from releasing v0.3
at this point.
Clara Hobbs vor 7 Jahren
Ursprung
Commit
62217d9612
3 geänderte Dateien mit 197 neuen und 10 gelöschten Zeilen
  1. 138
    0
      programming-jig.scad
  2. 58
    0
      sink.scad
  3. 1
    10
      sink_bracket.scad

+ 138
- 0
programming-jig.scad Datei anzeigen

@@ -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();

+ 58
- 0
sink.scad Datei anzeigen

@@ -0,0 +1,58 @@
1
+include <MCAD/polyholes.scad>;
2
+include <MCAD/units.scad>;
3
+
4
+
5
+usb_conn_amphenol = [10.4*mm, 9.4*mm, 3.4*mm];
6
+
7
+sink_0_1 = [26*mm, 49*mm, 0.8*mm, 1*mm, 18*mm, 4*mm, 10*mm, 0.5*mm,
8
+		 usb_conn_amphenol];
9
+sink_0_2 = [26*mm, 48*mm, 0.8*mm, 1*mm, 18*mm, 4*mm, 10*mm, 1.25*mm,
10
+		 usb_conn_amphenol];
11
+sink_0_3 = [25*mm, 30*mm, 1.6*mm, 1*mm, 17*mm, 4*mm, 10*mm, 1.25*mm,
12
+		 usb_conn_amphenol];
13
+
14
+function sink_width(board) = board[0];
15
+function sink_length(board) = board[1];
16
+function sink_thickness(board) = board[2];
17
+function sink_corner_radius(board) = board[3];
18
+function sink_screw_spacing(board) = board[4];
19
+function sink_screw_distance(board) = board[5];
20
+function sink_connector_cutout(board) = board[6];
21
+function sink_connector_extend(board) = board[7];
22
+function sink_connector(board) = board[8];
23
+
24
+/*
25
+ * A simple representation of a PD Buddy Sink circuit board
26
+ */
27
+module sink(board=sink_0_3, board_color="indigo", copper_color="gold",
28
+		connector_color="silver") {
29
+	difference() {
30
+		color(board_color)
31
+			hull() {
32
+				for (x = [sink_corner_radius(board),
33
+						sink_length(board) - sink_corner_radius(board)]) {
34
+					for (y = [sink_corner_radius(board),
35
+							sink_width(board) - sink_corner_radius(board)]) {
36
+						translate([x, y, 0])
37
+							cylinder(r=sink_corner_radius(board),
38
+									h=sink_thickness(board),
39
+									$fn=($fn<3) ? 8 : ceil($fn/4)*4);
40
+					}
41
+				}
42
+			}
43
+
44
+		color(copper_color)
45
+			for (y = [-1, 1]) {
46
+				translate([sink_screw_distance(board),
47
+						sink_width(board)/2 + y*sink_screw_spacing(board)/2,
48
+						-epsilon])
49
+					polyhole(d=3.5, h=sink_thickness(board) + 2*epsilon);
50
+			}
51
+	}
52
+
53
+	color(connector_color)
54
+		translate([-sink_connector_extend(board),
55
+				sink_width(board)/2 - sink_connector(board)[1]/2,
56
+				sink_thickness(board)])
57
+		cube(sink_connector(board));
58
+}

+ 1
- 10
sink_bracket.scad Datei anzeigen

@@ -3,16 +3,7 @@ include <MCAD/units.scad>;
3 3
 
4 4
 include <truncated_teardrop.scad>;
5 5
 
6
-
7
-sink_0_1 = [26*mm, 49*mm, 18*mm, 4*mm, 10*mm];
8
-sink_0_2 = [26*mm, 48*mm, 18*mm, 4*mm, 10*mm];
9
-sink_0_3 = [25*mm, 30*mm, 17*mm, 4*mm, 10*mm];
10
-
11
-function sink_width(board) = board[0];
12
-function sink_length(board) = board[1];
13
-function sink_screw_spacing(board) = board[2];
14
-function sink_screw_distance(board) = board[3];
15
-function sink_connector_cutout(board) = board[4];
6
+include <sink.scad>;
16 7
 
17 8
 
18 9
 /*

Laden…
Abbrechen
Speichern