[rrd-users] Measuring rain from weatherstation
Simon Hobson
linux at thehobsons.co.uk
Sun Dec 7 23:15:07 CET 2014
Alex van den Bogaerdt <alex at vandenbogaerdt.nl> wrote:
> After getting above mentioned stuff right, you could try to increase the accuracy of your rainfall meter. It involves remembering values read from it. An example works best:
>
> At time 09:55 you get "<1".
> At time 10:00 you get "<2".
> Upto and including time 13:55 you get "<2".
> At time 14:00 you get "<5".
> Upto and including time 17:55 you get "<5".
> At time 18:00 you get "<10".
> So far you have been logging this as "1", "2", "5" and "10", but with some programming you could achieve more accurate results.
>
> If you remember the read values and timestamps, then you can do something like this:
> * do not update the database for rainfall, unless the value changes
> * do update the database every midnight, even if there was no change
> * as soon as the read value changes, you record the previous value in the database.
>
> The result: at 10:00 you record "1". Then you wait. At time 14:00 you record "2". RRDtool will automatically fill the time intervals between 10:00 and 14:00 with the new computed rate of 1mm in 4 hours = 1/14400 mm/s.
> At time 18:00 you feed RRDtool the number 5. The computed rate will be 4mm in 4 hours = 1/3600 mm/s.
>
> If the value does not change anymore, then at midnight you have a choice. Either log 5 again, or log 10, or log 7.5 being the average of those two. You really do not know how much rain has fallen, you only know it is less than 10 but not less than 5.
If you have the option of resetting the counter after an arbitrary reading, then I could see a way of getting it more accurate.
Read the value "quite often". While it is returning "<0.5" then assume 0. When it switched to "<1" then use 0.5 and reset the counter. You will potentially lose a tiny amount of rainfall, but you'd have to be resetting the counter just at the point where the bucket tips (assuming it's a tipping bucket system) - but unless your reading points are a long way apart, that's unlikely.
You now have a value that's normally 0 but "pulses" to 0.5 each time 0.5 units of rain are measured. My mind isn't working well enough right now to work out the best way to put that into the RRD database.
One thought is to accumulate "units" of rain into a file which is read by your script that updates the rest of the weather parameters.
Another is just to insert 0 or 0.5 at frequent intervals - you'll get a spike each time the rainfall reaches 0.5mm, which can be averaged out by RRD. Probably need to use derive and insert 0.5 followed by 0 one second later.
You'd need to allow for larger values - in case your script gets delayed for some reason.
More information about the rrd-users
mailing list