[chbot] No-code weather-station to web dashboard

Stephen Irons stephen at irons.nz
Fri May 6 00:00:28 BST 2022


Thanks Robin. My 1 hour and 24 hour calculations do pretty much the 
same. I know that I have two bugs lurking in my calculation code:
total rainfall returns to zero when the batteries in the sensor are 
changedwrap-around
This started as a no-code project; I guess I will have to fix these 
issues sooner or later.

Also, while inspecting the wind sensor this morning, I noticed that it 
is not pointing in the direction that it should be. It turns out the 
the mounting pole was not fixed firmly enough and must have rotated in 
a strong wind. I have no idea when it moved, but it means that my 3 
days of recorded wind-direction history is wrong.

Stephen Irons

On Fri, May 6, 2022 at 00:36, Robin Gilks <gb7ipd at gmail.com> wrote:
> Here is a simple rainfall totalling function that works for me 
> (global vars for clarity!!) - it handles the 12 bit rain data my 
> system produces.
> 
> int16_t rain_mins[60];
> int16_t rain_hours[24];
> int16_t rain1h;                 /* rain in last hour */
> int16_t rain24h;                /* rain in last day */
> int16_t gRain;
> 
> // keep a history of raw total rainfall over 1 hour and 1 day
> // so that actuals can be calculated when required.
> static void
> update_rain (void)
> {
>    RT_t calendartime;
> 
>    ReadDateTime (&calendartime);
> 
>    rain_mins[calendartime.min] = gRain;
>    rain_hours[calendartime.hour] = gRain;
>    // allow for wraparound of data from remote
>    rain1h = (gRain + 4096 - rain_mins[(calendartime.min + 1) % 60]) % 
> 4096;
>    rain24h = (gRain + 4096 - rain_hours[(calendartime.hour + 1) % 
> 24]) % 4096;
> }
> 
> The rest (of the really old arduino code) can be found on my github 
> page - this is extracted from a later port to stm32F1/F4
>  
> <https://github.com/g8ecj/bertos/blob/all/boards/arduino/examples/arduino_WxRx/main.c>
> 
> --
> Robin
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20220505/a0200031/attachment.html>


More information about the Chchrobotics mailing list