A rain gauge.
Each time the rain gauge accumulates
1⁄100″
of rain, it momentarily opens a set of contacts.
I've connected them to a serial port in such a way that carrier detect
is asserted when the contacts open.
When CD is asserted, the OS allows an open of the port to succeed.
A simple daemon waits for the port to open and writes a timestamp into a file
when it does:
#!/bin/ksh
trap "" HUP
SECONDS=$(/local/bin/gnu/date +%s)
while :</dev/ttyB11; do
print $SECONDS >> /usr/adm/rain
sleep 2
done
A utility reads the datafile and generates a
report based on it.