pilotak / WeatherMeters

Arduino library for processing wind speed, wind wane and rain gauge sensors (WH 1080, Sparkfun)
MIT License
15 stars 6 forks source link

Some enhancements #5

Open HomeKidd opened 1 year ago

HomeKidd commented 1 year ago

Hi!

First of all I'm appreciate the work you've put into this library! 😄

Some more features would be great to have in the library, because most of the metrics are needed for most Weather APIs (e.g.: WeatherUnderground, etc..)

Like:

I've already made an array for collecting Wind speeds for 1min average, also I can get the Windgust by searching for the highest number in the 1 min array 😄

The other thing can be useful is calibrating the Wind direction, since ADC values can be off and this can effect the whole wind direction. Currently i'm just simply adding/subtracting a value from the actual (degree) reading. It works for most of the time, but some wind positions are still wrong since its not related to the actual position rather than the ADC values.

pilotak commented 1 year ago

Thanks, I can understand that those values are important, so it's temperature, dew point, etc. and are not part of this library. I wanted it to be as simple as possible - I'm not a fan of fully featured library where noboby really knows what it going on (like WifiManager). But it could be easy done by extending this class which will have it as depency.

Regarding windgust, what you do at the moment is choosing the max wind speed not gust - this more advanced, it takes from 1 sec to only up to 20 sec + it's more than 5m/s above average speed and usually counted only >=12m/s. This is on my wish list... but i can understand your approach it's simple and quite efective.

About the ADC calibration, you are right, this could be done better like passing an array instead of defining a table in lib. Do you want to submit a PR for that?

https://github.com/pilotak/WeatherMeters/blob/afb156e24ab0314fbf11964882221b902378b494/WeatherMeters.h#L50-L67

BTW checkout my MeteoFunctions library i'm sure you will find it interesting too

HomeKidd commented 1 year ago

Thanks, I can understand that those values are important, so it's temperature, dew point, etc. and are not part of this library. I wanted it to be as simple as possible. But it could be easy done by extending this class which will have it as depency.

BTW checkout my MeteoFunctions library i'm sure you will find it interesting too

I'm already using it, partially 😄 Some calculations are the same as mine (which I've done 5-6 years ago) but the Apparent temperature calculations in that lib is way off 😄

Currently I'm doing the rain rate calculations, collecting the past 5 min rain data and using the this formula: (rainrate = rain accumulated / 5 mintues 60 min -> 0.28mm / 5min 60min -> 3.36mm/h

Regarding windgust, what you do at the moment is choosing the max wind speed not gust - this more advanced, it takes from 1 sec to only up to 20 sec + it's more than 5m/s above average speed and usually counted only >=12m/s. This is on my wish list... but i can understand your approach it's simple and quite efective.

Yep, in my earlier version of my Weather Station I've measured the wind speed on 10-15 second intervals too for looking for wind gusts, but that was based on esp-open-rtos and I can't find the source files 😂 This is why I'm chosen the simple solution 😄

About the ADC calibration, you are right, this could be done better like passing an array instead of defining a table in lib.

That would be great to pass an (optional) for the ADC values on init 😄

pilotak commented 1 year ago

Currently I'm doing the rain rate calculations

This looks perfect. Don't you want to make a lib for all of those features? it feels like you know what you are doing which is unfortunately uncommon these days.

That would be great to pass an (optional) for the ADC values on init

i'm not sure if it should be optional, i would rather make it mandatory - calibration table will always be in the sketch rather than a lib itself. If done this way, you can save some flash, otherwise you will end up with two tables in which only one being used. What do you think?