Rain Gauge
A rain gauge with a magnified scale. Rain falls into a funnel with a sharp round mouth and runs into a narrower measuring tube, so one millimetre of rain raises the level by mouth area / tube area millimetres (6.25 mm with the default 80 mm mouth and 32 mm tube). The engraved marks are placed from that ratio: a numbered mark every 5 mm of rain, a mark every 1 mm and, where there is room, every 0.5 mm; the file measures both areas on the finished solid and checks the ratio and the volume under the 5 mm mark. A tab behind the tube takes two 4 mm screws for a post, or bolts to the printed ground stake with M4 screws and nuts. The default gauge is 84 x 84 x 158 mm and holds 20 mm of rain; the plate with the stake is 154 x 170 x 158 mm. Print it upright with no supports in a clear or translucent filament, with 3 or 4 perimeters so it is watertight. Mouth and tube diameter, capacity, wall thickness and the stake are parameters.
# Rain Gauge - funnel of known mouth area on a narrower measuring tube, scale in mm of rain
#
# Rain falls into a funnel with a sharp-edged round mouth and runs into a tube that is
# narrower than the mouth, so the water column is taller than the rain was deep:
# magnification = mouth area / tube area = (mouth_d / tube_d)^2
# One millimetre of rain therefore raises the level by `magnification` millimetres, and the
# marks engraved on the tube are placed at floor + rain x magnification: a long numbered
# mark every 5 mm of rain, a mark every 1 mm and, where there is room, a short one every
# 0.5 mm. The scale is valid up to `capacity` mm of rain, where the tube is full.
# The file measures the mouth and tube areas on the finished solid and checks the ratio and
# the volume under the 5 mm mark.
# Mount: the flat tab behind the tube takes two 4 mm screws - into a post (keep the mouth
# above the top of the post), or into the printed ground stake with M4 screws and nuts.
# Printing: upright as laid out, no supports. It must be WATERTIGHT: use at least 3 or 4
# perimeters and solid floor layers, and test it with water before use. Print it in a clear
# or translucent filament and read the level against the light, at the bottom of the
# meniscus; empty it by tipping.
@param 50..150 step:5 group:"Gauge" desc:"Inner diameter of the mouth (mm): the catching area"
$mouth_d = 80
@param 15..60 step:1 group:"Gauge" desc:"Inner diameter of the measuring tube (mm)"
$tube_d = 32
@param 5..40 step:1 group:"Gauge" desc:"Rain the tube holds (mm): sets the tube height"
$capacity = 20
@param 1.6..3 step:0.2 group:"Gauge" desc:"Wall and floor thickness (mm)"
$wall = 2
@param group:"Stake" desc:"Add the ground stake to the plate"
$stake = true
@param 100..220 step:10 group:"Stake" desc:"Stake length (mm)"
$stake_len = 170
# --- Magnification and heights ------------------------------------------------------------------
$Ri = $mouth_d / 2
$ri = $tube_d / 2
$mag = ($mouth_d / $tube_d) ** 2 # level rise per mm of rain
assert $mag >= 2 # a tube as wide as the mouth magnifies nothing
$th = $wall + $capacity * $mag # top of the measuring tube = start of the funnel
$e = 0.414 * $wall # makes the 45 deg funnel wall as thick as the tube wall
$Hc = $Ri - $ri # funnel height at 45 deg
$rim_h = 6
$top = $th + $e + $Hc + $rim_h
$ro = $ri + $wall
$Ro = $Ri + $wall
assert $top <= 260 # too tall to print: lower capacity or widen the tube
def mark_z($mm) = $wall + $mm * $mag # height of the mark for $mm of rain
# --- Body: one revolved profile -----------------------------------------------------------------
# the rim is bevelled on the outside, so the edge that divides the rain is the inner diameter
$body = workplane XZ | polyline [(0, 0), ($ro, 0), ($ro, $th), ($Ro, $th + $Hc), ($Ro, $top - $wall), ($Ri, $top),
($Ri, $th + $e + $Hc), ($ri, $th + $e), ($ri, $wall), (0, $wall)] | revolve Z
$envelope = workplane XZ | polyline [(0, 0), ($ro, 0), ($ro, $th), ($Ro, $th + $Hc), ($Ro, $top - $wall), ($Ri, $top), (0, $top)] | revolve Z
# --- Mounting tab behind the tube (+Y) ----------------------------------------------------------
$tab_t = 4
$tab_h = 50
$hole_x = $ro + 7 # screws pass beside the tube
$hole_z = $tab_h / 2
$tab_w = 2 * ($hole_x + 7)
$m4 = 4.5
$tab_y = $ro - 1 # the tab is sunk 1 mm into the tube wall, not into the bore
$tab_plate = box $tab_w $tab_t $tab_h center:(true, false, false) | translate 0 $tab_y 0
def tab_hole($x) = cylinder ($m4 / 2) ($tab_t + 2) | rotate 90 0 0 | translate $x ($tab_y + $tab_t / 2) $hole_z
# a saddle fills the wedge between the round tube and the flat tab, so the tab is held across the
# whole tube width and not along one line; it stops short of the bore
$saddle_box = box (2 * $ro) $tab_y $tab_h center:(true, false, false)
$saddle = $saddle_box - (cylinder ($ri + $wall / 2) (3 * $tab_h))
$tab = $tab_plate + $saddle - tab_hole($hole_x) - tab_hole(-$hole_x)
# --- Scale on the front of the tube (-Y), engraved --------------------------------------------
$eng = 0.4
assert $wall - $eng >= 1.2 # what is left behind a mark stays watertight
$halves = $mag >= 5 # room for 0.5 mm marks (2.5 mm apart or more)
$step = if $halves then 0.5 else 1
$nmarks = floor($capacity / $step) + 1
$groove = (cylinder ($ro + 1) 0.6 center:(true, true, true)) - (cylinder ($ro - $eng) 2 center:(true, true, true))
def sector($len) = $groove * (box $len ($ro + 2) 2 center:(true, false, true) | translate 0 (-$ro - 2) 0)
$g_long = sector(12)
$g_mid = sector(7)
$g_short = sector(4)
def is_whole($i) = abs($i * $step - round($i * $step)) < 0.01
def is_five($i) = abs($i * $step / 5 - round($i * $step / 5)) < 0.01
def mark($i) = if is_five($i) then $g_long else (if is_whole($i) then $g_mid else $g_short)
$marks = union [mark($i) | translate 0 0 mark_z($i * $step) for $i in range($nmarks)]
# numbers every 5 mm, to the right of the long marks
$nlab = floor($capacity / 5)
$lab_ang = (6 + 4.5) / $ro * 180 / pi # past the end of the long mark
def lab($n) = text ("" + $n) 6 | extrude 2 | rotate 90 0 0
def put($t, $z) = $t | translate (-$t.bbox.center[0]) (-$ro + $eng - 0.1 - $t.bbox.min[1]) ($z - $t.bbox.center[2]) | rotate 0 0 $lab_ang
$labels = union [put(lab(5 * ($i + 1)), mark_z(5 * ($i + 1))) for $i in range($nlab)]
$unit = put(lab("mm"), mark_z(0) + 5)
$solid = $body + $tab
$gauge = $solid - $marks - $labels - $unit
# --- Ground stake: flat, bolts to the tab, printed lying down -----------------------------------
$st_t = 4
$st_w = 24
$head_h = 30
$stake_blank = polyline [(-$tab_w / 2, 0), ($tab_w / 2, 0), ($tab_w / 2, -$head_h), ($st_w / 2, -$head_h - ($tab_w - $st_w) / 2),
($st_w / 2, -$stake_len + 30), (0, -$stake_len), (-$st_w / 2, -$stake_len + 30),
(-$st_w / 2, -$head_h - ($tab_w - $st_w) / 2), (-$tab_w / 2, -$head_h)] | extrude $st_t
$st_holes = (cylinder ($m4 / 2) 20 | translate $hole_x (-$head_h / 2) 0) + (cylinder ($m4 / 2) 20 | translate (-$hole_x) (-$head_h / 2) 0)
$stake_part = $stake_blank - $st_holes
$stake_on_plate = $stake_part | translate ($Ro + 6 + $tab_w / 2) ($stake_len / 2) 0
$out = if $stake then union [$gauge, $stake_on_plate] else $gauge
# --- Checks -------------------------------------------------------------------------------------
$plug = $envelope - $solid # the water space of the built part (the marks are outside it)
$slab = box 400 400 1 center:(true, true, false)
$mouth_slice = $plug * ($slab | translate 0 0 ($top - 2))
$tube_slice = $plug * ($slab | translate 0 0 ($wall + 3))
$under5 = $plug * (box 400 400 (mark_z(5)) center:(true, true, false))
assert $gauge.solids == 1
assert $plug.solids == 1
assert $mouth_slice.volume ~ (pi * $Ri * $Ri) tol:0.5% # mouth area (mm2)
assert $tube_slice.volume ~ (pi * $ri * $ri) tol:0.5% # tube area (mm2)
assert $mouth_slice.volume / $tube_slice.volume ~ $mag tol:1% # magnification = area ratio
assert $under5.volume ~ (5 * pi * $Ri * $Ri) tol:1% # 5 mm of rain over the mouth fills to the 5 mark
assert mark_z($capacity) ~ $th tol:0.01 # the last mark is at the top of the tube
assert $gauge.bbox.z ~ $top tol:0.01
assert $gauge.bbox.min[2] ~ 0 tol:0.001
assert $gauge.bbox.x ~ max(2 * $Ro, $tab_w) tol:0.01
assert $tab_h + 5 <= $th # the tab is on the tube, below the funnel
# the screws pass the tab, and beside the tube
$pins = (cylinder ($m4 / 2 - 0.1) 60 | rotate 90 0 0 | translate $hole_x $tab_y $hole_z) + (cylinder ($m4 / 2 - 0.1) 60 | rotate 90 0 0 | translate (-$hole_x) $tab_y $hole_z)
assert clear($gauge, $pins)
assert $stake_part.solids == 1
assert clear($gauge, $stake_on_plate)
print "magnification" $mag "mouth area (mm2)" $mouth_slice.volume "tube area (mm2)" $tube_slice.volume
print "level rise per mm of rain (mm)" $mag "mark step (mm of rain)" $step "marks" $nmarks
print "gauge" $gauge.bbox
print "plate" $out.bbox
$out