|
1 |
| -# Nitrate sensor |
| 1 | +// Nitrate sensor |
| 2 | +// |
| 3 | +// This is housing for an optical nitrate sensor that's meant to hang out underwater. |
| 4 | +// |
| 5 | +// There are two main parts: The emitter module and the photodiode module. |
| 6 | +// Both sit behind quartz discs that allow UV light to pass through. |
| 7 | + |
| 8 | +quartz_radius = 5 + 0.1; // Radius of quartz disc, plus a bit extra for tolerance |
| 9 | +quartz_thickness = 0.8; // Thickness of quartz disc |
| 10 | +wall_thickness = 1.2; |
| 11 | +gap_distance = 10; // Gap between emitter and photodiode |
| 12 | +extra_height = 5; |
| 13 | +base_height = 3; // Height of base |
| 14 | +compartment_height = 20; // Height of compartment (enough to fit electronics) |
| 15 | + |
| 16 | +x = 100/2; |
| 17 | +y = 63/2; |
| 18 | + |
| 19 | +r = quartz_radius; |
| 20 | +t = wall_thickness; |
| 21 | +g = gap_distance; |
| 22 | +$fn = 50; |
| 23 | + |
| 24 | + translate([0, 0, base_height]) difference() { |
| 25 | + base(); |
| 26 | + carveout(); |
| 27 | + emitter_negatives(); |
| 28 | +} |
| 29 | + |
| 30 | +union() { |
| 31 | + h = compartment_height; |
| 32 | + translate([0, x + 20, h]) { |
| 33 | + difference() { |
| 34 | + compartment(1, h); |
| 35 | + translate([0, 0, 1]) compartment(0, h); |
| 36 | + screw_holes(h, 2); |
| 37 | + } |
| 38 | + translate([0, 0, 0]) difference() { |
| 39 | + screw_holes(h-1, 3); |
| 40 | + screw_holes(h-1, 1); |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + } |
| 45 | + |
| 46 | +module base() { |
| 47 | + r = 25; |
| 48 | + h = base_height; |
| 49 | + p = 15; |
| 50 | + |
| 51 | + |
| 52 | + difference() { |
| 53 | + hull() { |
| 54 | + compartment(); |
| 55 | + emitters(); |
| 56 | + } |
| 57 | + // compartment(-1); |
| 58 | + translate([0, 0, -1]) difference() { |
| 59 | + scale([0.85, 0.8, 1]) hull() { |
| 60 | + compartment(); |
| 61 | + emitters(-5); |
| 62 | + } |
| 63 | + hull() { |
| 64 | + scale([1.3, 1, 1]) carveout(); |
| 65 | + translate([0, 0, -100]) scale([1.3, 100, 1]) carveout(); |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + translate([0, 0, -1]) screw_holes(h-1, 0.8); |
| 70 | + } |
| 71 | +} |
| 72 | + |
| 73 | +module compartment(o=0, h=base_height) { |
| 74 | + r = 2; |
| 75 | + translate([0, 0, -h]) linear_extrude(h) { |
| 76 | + hull() offset(o) { |
| 77 | + translate([x, y]) circle(r); |
| 78 | + translate([-x, y]) circle(r); |
| 79 | + translate([x, -y]) circle(r); |
| 80 | + translate([-x, -y]) circle(r); |
| 81 | + } |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +module screw_holes(h, r=2) { |
| 86 | + translate([0, 0, -h]) linear_extrude(h) { |
| 87 | + union() { |
| 88 | + translate([x, y]) circle(r); |
| 89 | + translate([-x, y]) circle(r); |
| 90 | + translate([x, -y]) circle(r); |
| 91 | + translate([-x, -y]) circle(r); |
| 92 | + } |
| 93 | + } |
| 94 | +} |
| 95 | + |
| 96 | +module carveout() { |
| 97 | + h = gap_distance; |
| 98 | + r = r + 4; |
| 99 | + translate([-h/2, 0, 10]) rotate([0, 90, 0]) scale([1,2,1]) cylinder(h, r=r); |
| 100 | +} |
| 101 | + |
| 102 | +module emitters(extra_distance=0) { |
| 103 | + translate([0, 0, extra_height]) { |
| 104 | + emitter_housing(extra_distance); |
| 105 | + mirror([1, 0, 0]) emitter_housing(extra_distance); |
| 106 | + } |
| 107 | +} |
| 108 | + |
| 109 | +module emitter_negatives() { |
| 110 | + translate([0, 0, extra_height]) { |
| 111 | + emitter_housing_cutouts(); |
| 112 | + mirror([1, 0, 0]) emitter_housing_cutouts(); |
| 113 | + } |
| 114 | +} |
| 115 | + |
| 116 | +module emitter_housing(extra_distance) { |
| 117 | + h1 = 10; // body height |
| 118 | + h2 = 1.5; // cap height |
| 119 | + h3 = quartz_thickness; |
| 120 | + |
| 121 | + translate([-h1-h2-g+extra_distance/2, 0, r+t]) rotate([0, 90]) { |
| 122 | + hull() { |
| 123 | + cylinder(h1, r=r+t); |
| 124 | + translate([0, 0, h1]) cylinder(h2, r=r+t - 0.5); |
| 125 | + } |
| 126 | + } |
| 127 | +} |
| 128 | + |
| 129 | +module emitter_housing_cutouts(h1=10, h2=1.5, h3=quartz_thickness) { |
| 130 | + h1 = 10; // body height |
| 131 | + h2 = 1.5; // cap height |
| 132 | + h3 = quartz_thickness; |
| 133 | + |
| 134 | + translate([-h1-h2-g/2, 0, r+t]) rotate([0, 90]) { |
| 135 | + cylinder(h1, r=r); |
| 136 | + translate([0, 0, h1]) cylinder(h2, r=r-1); |
| 137 | + translate([0, 0, h1+h2-h3]) cylinder(h2, r=r); |
| 138 | + } |
| 139 | +} |
0 commit comments