Wed, 12 Sep 2018 12:48:28 +0200
initial commit of FluidSwitch prototype
0 | 1 | // fluid 1-to-N-way rotation Valve |
2 | // 1 Inlet, N Outlets | |
3 | ||
4 | // Variables: | |
5 | oring_outer = 5.0; | |
6 | oring_inner = 3.0; | |
7 | ||
8 | tube_dia = 2; | |
9 | ||
10 | hole_inner = 1.0; | |
11 | axis_dia = 5; | |
12 | ||
13 | // for color mixer we need 3 base colors + black + white + additional 1 waste and 1 clean water and one output = 8 connectors | |
14 | // cycle will be: | |
15 | // 1) select color 1-5, load syringe, select output, unload syringe, repeat for each other color | |
16 | // 2) select water, load syringe, select waste, unload syringe | |
17 | outlets = 8; | |
18 | ||
19 | // just fiddle around with the following variables: | |
20 | outlet_circle_dia = 13; | |
21 | base_dia = 20; | |
22 | ||
23 | // roundness faces | |
24 | fn = 10; | |
25 | ||
26 | // calculations: | |
27 | oring_dia = (oring_outer - oring_inner) / 2; | |
28 | outlet_angle = 360/outlets; | |
29 | base_height = 6; | |
30 | base_outer_dia = base_dia + 6; | |
31 | outer_thread_height = 10; | |
32 | outer_height = 15; | |
33 | thread_pitch = 2; | |
34 | ||
35 | // START PROGRAM | |
36 | use <../libs/Threading/Threading.scad> | |
37 | ||
38 | valve_lower(); | |
39 | ||
40 | //rotate([180,0,0]) translate([30,0,0]) | |
41 | //valve_inlay(); | |
42 | ||
43 | //rotate([180,0,0]) translate([0,0,-60]) | |
44 | // valve_cap(); | |
45 | ||
46 | // MODULES | |
47 | ||
48 | module valve_inlay() union() { | |
49 | inlay_height = 5; | |
50 | difference() { | |
51 | translate([0,0,0.0001]) | |
52 | cylinder(d=base_dia, h = inlay_height); | |
53 | ||
54 | // cut out the connector tube | |
55 | rotate([90,0,0]) | |
56 | translate([outlet_circle_dia/4,0,0]) | |
57 | rotate_extrude(convexity=10) | |
58 | translate([outlet_circle_dia/4, 0]) circle(d=oring_inner, $fn=fn); | |
59 | ||
60 | // cylinder(d=oring_inner, h=inlay_height / 2, $fn=fn); | |
61 | // translate([outlet_circle_dia/2,0]) | |
62 | // cylinder(d=oring_inner, h=inlay_height / 2, $fn=fn); | |
63 | } | |
64 | ||
65 | // hex drive rod | |
66 | translate([0,0,inlay_height]) | |
67 | cylinder(d=axis_dia, h=20, $fn=6); | |
68 | } | |
69 | ||
70 | module valve_cap() { | |
71 | cap_sides = 50; | |
72 | difference() { | |
73 | union() { | |
74 | translate([0,0,2]) | |
75 | Threading(D = base_outer_dia + 6, pitch = thread_pitch, d=base_outer_dia, windings = (outer_thread_height/thread_pitch), angle = 55, full = true, step = 50, $fn=cap_sides); | |
76 | ||
77 | cylinder(d=base_outer_dia + 6, h=2, $fn=cap_sides); | |
78 | } | |
79 | ||
80 | cylinder(d=axis_dia + 2, h=2 + 0.001, $fn=fn); | |
81 | } | |
82 | } | |
83 | ||
84 | module valve_lower() | |
85 | difference() { | |
86 | union() { | |
87 | valve_base(); | |
88 | valve_casing(); | |
89 | // bottom | |
90 | translate([0,0,-1.5]) cylinder(d=base_outer_dia, h=1.5); | |
91 | } | |
92 | ||
93 | // cut out the OUTLET ring on the side | |
94 | for(i = [1:outlets]) { | |
95 | a = outlet_angle * i; | |
96 | rotate([90,0,a]) { | |
97 | translate([outlet_circle_dia/2 - hole_inner/2,tube_dia/2,0]) | |
98 | rotate([0,90,0]) | |
99 | cylinder(d=tube_dia, h=base_outer_dia, $fn=fn); | |
100 | } | |
101 | } | |
102 | ||
103 | } | |
104 | // TODO: cut out the syringe hole (needs to be conical to fit) | |
105 | ||
106 | ||
107 | module valve_casing() { | |
108 | difference() { | |
109 | union() { | |
110 | translate([0,0,0.001]) | |
111 | cylinder(d=base_outer_dia, h=outer_height - outer_thread_height); | |
112 | ||
113 | translate([0,0,outer_height - outer_thread_height]) | |
114 | threading(pitch = thread_pitch, d=base_outer_dia, windings = (outer_thread_height/thread_pitch)-1, angle = 55, full = true, $fn=fn); | |
115 | } | |
116 | ||
117 | cylinder(d=base_dia, h = outer_height + 0.001); | |
118 | } | |
119 | } | |
120 | ||
121 | module valve_base() difference() { | |
122 | cylinder(d=base_dia, h=base_height); | |
123 | ||
124 | // inlet hole | |
125 | cylinder(d=hole_inner, h=base_height, $fn=fn); | |
126 | translate([0,0,base_height]) | |
127 | oring(); | |
128 | ||
129 | // cut Outlet holes and oring carves | |
130 | for(i = [1:outlets]) { | |
131 | a = outlet_angle * i; | |
132 | rotate([0,0,a]) { | |
133 | translate([outlet_circle_dia/2,0,base_height]) | |
134 | oring(); | |
135 | translate([outlet_circle_dia/2,0]) | |
136 | cylinder(d=hole_inner, h=base_height, $fn=fn); | |
137 | } | |
138 | } | |
139 | ||
140 | } | |
141 | ||
142 | module oring() { | |
143 | rotate_extrude(convexity=10, $fn=fn) | |
144 | translate([oring_inner/2 , 0, 0]) | |
145 | circle(d=oring_dia, $fn=fn); | |
146 | } |