Rain data handling on custom driver

86 views
Skip to first unread message

thago...@gmail.com

unread,
Jan 17, 2021, 6:16:41 AM1/17/21
to weewx-user
Hello all!

So, I've beed doing some searching & reading about how WeeWX handles rain data from various weather station devices. However, it's not clear to me what would the right strategy be in my case.

I'm using a Microbit climate kit and wrote a custom microbit program to serialise and send weather data through USB to a Raspberry pi which feeds it to WeeWX. Similarly, I used weesx-arduino-weather-station driver as a base driver and modified it for my case. I also read how HP1000 driver handles rain (I read it in a previous post in this forum if I remember correctly) but I can't say I found it enlightening (it probably has to with my level of comprehension for WeeWX code).

I attach my version of the driver. It's as simple as I my mind could program it. Please do not pay attention to my current way of reading rain data. I know it doesn't work. If I only correct the data binding, WeeWX stores rain data incrementally for every LOOP packet, as expected.

Subsequently, my question is not how to retrieve rain data from the weather station, rather than how to feed it to WeeWX in order to get meaningful observations. The limitations on my microbit weather station are these:
* No real time clock available on Microbit. I could use uptime, but it's not so useful as the microbit refuses to work properly every few days, so it needs to be reset. I could reset it manually with a cronjob if needed.
* Rain data from the weather station only includes one number = bucket tips (which I convert to mm on microbit) which can only go up until microbit is reset - and it needs not be reset once in a while.

How does one handle the last_rain, total_rain and rain data in WeeWX? The official documentation did not answer my question so if you could point me on the right direction or ideally describe the strategy I should follow, it would be great!

Thank you all for your time! Cheers!
microbit.py

Tom Keffer

unread,
Jan 17, 2021, 9:40:06 AM1/17/21
to weewx-user
You've commented out the relevant code (in _augment_packet()), but it looks to me like you're doing it the right way. 

The only type that needs to be emitted is 'rain', but it's always a good idea to augment the packet with anything else that can be relied on. So, you might consider emitting 'totalRain' as well. It can always be calculated from the database, but some people like to store it in the database along with 'rain'.

I couldn't quite parse your sentence about whether the number of bucket tips needs to be reset once in a while, or need not be reset. Assuming the former, and assuming it's an unsigned integer, you could just let it roll over, which calculate_rain() will detect. 

Hope that helps. Not sure I answered your question.



--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/00e5c25d-87c8-4f1d-91ce-2effcb98761an%40googlegroups.com.

thago...@gmail.com

unread,
Feb 15, 2021, 6:23:28 AM2/15/21
to weewx-user
Thank you for your answer!

The rain bucket does not need to be reset, but I could toggle the power on USB which would simulate a reset. This would allow the rain bucket reading to return to zero.

In my current version of the driver, I've reversed the commented out section which calculates rain delta.

My current reading reported from the microbit is 1.95mm of total rain. This is the actual reading I'm able to get.
microbit_reading.jpg
This total_rain reading is repeated in every loop packet until microbit is manually reset, which would return the reading to zero.

The high-chart graph in my belcher town skin shows this:
belchertown_graph.jpg
(green line is total_rain, blue line is rain_rate)

I don't do any unit conversions on WeeWX and rain is configured and always measured in millimetres.

It seems that something is wrong with my microbit.py. I probably use something incorrectly. To be honest I still haven't grasped how exactly WeeWX processes rain data, thus I would need further assistance.

Thanks again!
microbit.py

Tom Keffer

unread,
Feb 16, 2021, 8:25:35 AM2/16/21
to weewx-user
One thing that pops out at me is that you are using the weewx.METRIC unit system for your packets. This unit system measures rain in centimeters, not millimeters. See the appendix Units in the Customizing Guide. Perhaps you want the weewx.METRICWX system?

Reply all
Reply to author
Forward
0 new messages