I'm using the correct #define
#define ENABLERAINBUCKET RAINBUCKET_80422
And in the controller defines, the amount per pulse is correct too.
#define RAINBUCKET_80422 2 // Weather Meters Kit by Sparkfun Electronics
#define RAINFALLMM_80422 (0.2794) // mm per interrupt [0.011"]
#if (RAINBUCKET == RAINBUCKET_80422)
// Each interrupt (tip) of the rain bucket is worth 0.2794 mm
// [0.011"] of rain
_rbg_minute_total = (float)_total_ints_per_minute * RAINFALLMM_80422;
#endif
**Please check your distance setting? is it set to Imperial or Metric? **
So the software all looks good with the correct amount etc
So from here it would point to the h/w connection and the pulse interrupt counters.
For
void IRAM_ATTR RainBucket_sensor_isr() { in file rain_bucket_cpp are you using the old code or the new code?
(see management server)
Which RTC are you using?
in the same file, rain is calculated every 60s change this
`
portENTER_CRITICAL(&rbg_interrupts_Mux);
_total_ints_per_minute = rbg_interrupt_counter;
// reset interrupt counter, be ready for the next 60s about to start
rbg_interrupt_counter = 0;
portEXIT_CRITICAL(&rbg_interrupts_Mux);
**to **
portENTER_CRITICAL(&rbg_interrupts_Mux);
_total_ints_per_minute = rbg_interrupt_counter;
// reset interrupt counter, be ready for the next 60s about to start
rbg_interrupt_counter = 0;
portEXIT_CRITICAL(&rbg_interrupts_Mux);
Serial.print("60s interrupts = ");
Serial.println(_total_ints_per_minute);
`
Now you can follow with a test
use a clock source - phone, computer so that you can cout 60s
when at 0s, and before the minute is up
manually activate the bucket and count each time u do that within a 60s
If you flipped the rain bucket like 3 times in 60s
So when the 1m counter happens in the rain bucket, I would expect this
60s interrupts = 3
If you dont have the interrupt count right, less means some pulses were lost and higher means there is bounce causing a higher interrupt count.
Is the 10K R6 fitted to the PCB?
Use new code when the interrupt coun is much larger. Adjust the _raininterruptpulsewidth
till the interrupt count is correct. Can be changed using Management Server /admin13
. Recommend lower value if count is missing pulses) and higher count has too many pulses.
range check has these values 10-200 (60 default) milliseconds.
Please let me know what you find
Regards
Robert
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
**Please check your distance setting? is it set to Imperial or Metric? **
I'm using metric
The thing is... the pulses are accounted for. I tried with a syringe filled with water.
Every 1,6ml the bucket clicked and in the rain meter it summed 0,02mm. I did it 10 times and it summed up 0,29mm of rain (should be 2,9mm). so it looks like it is counting 10x less rain.
I'm Using the ESP32 RTC, no external RTC.
I'm using the new code
Yes the 10k R6 is fitted to the board.
I've tried from 10 to 200 the pulse width to the same result
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
#define RAINFALLMM_80422 (0.2794) // mm per interrupt
in rain_bucket.cpp
#if (RAINBUCKET == RAINBUCKET_80422)
// Each interrupt (tip) of the rain bucket is worth 0.2794 mm
// [0.011"] of rain
_rbg_minute_total = (float)_total_ints_per_minute * RAINFALLMM_80422;
#endif
place a few serial prints like this
#if (RAINBUCKET == RAINBUCKET_80422)
// Each interrupt (tip) of the rain bucket is worth 0.2794 mm
// [0.011"] of rain
_rbg_minute_total = (float)_total_ints_per_minute * RAINFALLMM_80422;
Serial.print("total-ints-per-min = ");
Serial.println(_total_ints_per_minute);
Serial.println("RAINFALLMM = ");
Serial.println(RAINFALLMM_80422);
Serial.print("rgbmintotal = ");
Serial.println(_rbg_minute_total);
#endif
It might be the equation that is wrong
_rbg_minute_total = (float)_total_ints_per_minute * RAINFALLMM_80422;
Hi
In the APP, Raining or rain comes from the rain sensor, not the rain tip bucket.
Raining is 0 or 1
// To enable the analog rain sensor, uncomment next line//#define RAINSENSOR
In the App, and in the Webserver/MQTT publish the value of raining should be the same (0 or 1).
Here is how I tested rain
Start web browser to connect to controller and display home page
192.168.2.128
If I use the cmds argument to the webserver I get a list of commands. Of note are
/rain gives json response for the rain group
/ra gives value of raining
/set?raining=0 sets the value of rain
rain is 0 or 1
Next, I set the value of rain to 1 by using a set command
192.168.2.128/set?raining=1
Next, go back to index page,
raining shows as Yes
And in the app, using Get All button, Rain shows 1
In MQTT I used MQTT.fx app, and have MQTT defined in firmware, the pusblished MATT message looks like
{ "devicename":"mySQM+ 138-28","firmware":138,"uptime":"000:01:52","date":"17/07/2024","time":"05:45:36","sqm":5.08,"nelm":-8.57,"lux":1000.0000,"ambient":18.25,"humidity":50.0,"dewpoint":7.66,"pressure":1031.25,"slpressure":1031.25,"bme280alt":30.20,"skyambient":19.00,"skyobject":19.00,"skystate":1,"cloudcover":100.00,"raining":1,"rvout":0.00,"rainprevhr":0.00,"raincurrhr":0.00,"raincurrday":0.00,"windspd":0.00,"windavg":0.00,"windgust":0.00,"windchill":100.00,"beaufort":0,"winddir":0,"gpsdate":"01/01/1900","gpstime":"00:00:00","gpslat":"77.000 S","gpslon":"166.000 E","gpsalt":0.0,"gpssat":0,"gpsfix":0, "mac":"24:62:AB:B0:8C:DC","vpd":10.48 }
Using a query to the web server like
192.168.2.128/rain
I get this response
{ "raining":1,"rvout":0.00,"raincurrhr":0.00,"rainprevhr":0.00,"raincurrday":0.00,"rainprevday":0.00 }
and the reverse case if i use the set command to set rain to 0.
Sometimes rain may say Yes or No - this is fixed in the next release as 1 or 0 across all ways to show rain,. In web_server.cpp, line 1266 there is this
which shows up in mqtt publish messages and in the Windows app
So all the surrounding code is fine, BUT since "generation" of the rainfall value looks like something is wrong. I did the above to show that the problem for rainfall is in the generation of the value.
I have looked over the rain bucket code for a few hours today - and there are some things that may contribute to your issue, which I am recoding now.
I think I have made progress. Please send me an email to my g mail address - see PDF
Hello!
I'm using a Misol rain tipping bucket. Every time it clicks, instead of totalizing 0,25mm of rain, the controller sums 0,02mm of rain.
I'm using the correct #define
#define ENABLERAINBUCKET RAINBUCKET_80422
And in the controller defines, the amount per pulse is correct too.
What can I do to correct this?
Thanks!
Any help, please?
Hi Rudolph
I will take a look.
It may have already been fixed in the next release, so I will check that first.
Regards
Robert
For the sparkfun weather rainfall bucket
**Please check your distance setting? is it set to Imperial or Metric? **
So the software all looks good with the correct amount etc
So from here it would point to the h/w connection and the pulse interrupt counters.
For
void IRAM_ATTR RainBucket_sensor_isr() {
in file rain_bucket_cpp are you using the old code or the new code?
(see management server)
Which RTC are you using?
in the same file, rain is calculated every 60s
change this
`
portENTER_CRITICAL(&rbg_interrupts_Mux);
_total_ints_per_minute = rbg_interrupt_counter;
// reset interrupt counter, be ready for the next 60s about to start
rbg_interrupt_counter = 0;
portEXIT_CRITICAL(&rbg_interrupts_Mux);
**to **
portENTER_CRITICAL(&rbg_interrupts_Mux);
_total_ints_per_minute = rbg_interrupt_counter;
// reset interrupt counter, be ready for the next 60s about to start
rbg_interrupt_counter = 0;
portEXIT_CRITICAL(&rbg_interrupts_Mux);
Serial.print("60s interrupts = ");
Serial.println(_total_ints_per_minute);
`
Now you can follow with a test
use a clock source - phone, computer so that you can cout 60s
when at 0s, and before the minute is up
manually activate the bucket and count each time u do that within a 60s
If you flipped the rain bucket like 3 times in 60s
So when the 1m counter happens in the rain bucket, I would expect this
60s interrupts = 3
If you dont have the interrupt count right, less means some pulses were lost and higher means there is bounce causing a higher interrupt count.
Is the 10K R6 fitted to the PCB?
Use new code when the interrupt coun is much larger. Adjust the _raininterruptpulsewidth
till the interrupt count is correct. Can be changed using Management Server /admin13
. Recommend lower value if count is missing pulses) and higher count has too many pulses.
range check has these values 10-200 (60 default) milliseconds.
Please let me know what you find
Regards
Robert
The thing is... the pulses are accounted for. I tried with a syringe filled with water.
Every 1,6ml the bucket clicked and in the rain meter it summed 0,02mm. I did it 10 times and it summed up 0,29mm of rain (should be 2,9mm). so it looks like it is counting 10x less rain.
I'm Using the ESP32 RTC, no external RTC.
I'm using the new code
Yes the 10k R6 is fitted to the board.
I've tried from 10 to 200 the pulse width to the same result
And one interesting thing:
I set RAINFALLMM_80442 to 2.9 instead of 0.29
And it still sums only 0,01 or 0,02mm por bucket click!
in controller_defines.h
in rain_bucket.cpp
place a few serial prints like this
It might be the equation that is wrong
_rbg_minute_total = (float)_total_ints_per_minute * RAINFALLMM_80422;
perhaps try
_rbg_minute_total = (float)_total_ints_per_minute ) * (float) RAINFALLMM_80422l
I am unable to test or debug code right now
Regards
Robert
Hello, sorry for the delay.
Here is the output after 3 clicks on the bucket:
Then 2 more clicks:
And in the APP:

And in the webpage of the controller:
Now what can I do?
Hi
In the APP, Raining or rain comes from the rain sensor, not the rain tip bucket.
Raining is 0 or 1
In the App, and in the Webserver/MQTT publish the value of raining should be the same (0 or 1).
Here is how I tested rain
Start web browser to connect to controller and display home page
If I use the cmds argument to the webserver I get a list of commands. Of note are
/rain gives json response for the rain group
/ra gives value of raining
/set?raining=0 sets the value of rain
rain is 0 or 1
Next, I set the value of rain to 1 by using a set command
Next, go back to index page,
raining shows as Yes
And in the app, using Get All button, Rain shows 1
In MQTT I used MQTT.fx app, and have MQTT defined in firmware, the pusblished MATT message looks like
{ "devicename":"mySQM+ 138-28","firmware":138,"uptime":"000:01:52","date":"17/07/2024","time":"05:45:36","sqm":5.08,"nelm":-8.57,"lux":1000.0000,"ambient":18.25,"humidity":50.0,"dewpoint":7.66,"pressure":1031.25,"slpressure":1031.25,"bme280alt":30.20,"skyambient":19.00,"skyobject":19.00,"skystate":1,"cloudcover":100.00,"raining":1,"rvout":0.00,"rainprevhr":0.00,"raincurrhr":0.00,"raincurrday":0.00,"windspd":0.00,"windavg":0.00,"windgust":0.00,"windchill":100.00,"beaufort":0,"winddir":0,"gpsdate":"01/01/1900","gpstime":"00:00:00","gpslat":"77.000 S","gpslon":"166.000 E","gpsalt":0.0,"gpssat":0,"gpsfix":0, "mac":"24:62:AB:B0:8C:DC","vpd":10.48 }
Using a query to the web server like
I get this response
{ "raining":1,"rvout":0.00,"raincurrhr":0.00,"rainprevhr":0.00,"raincurrday":0.00,"rainprevday":0.00 }
and the reverse case if i use the set command to set rain to 0.
Sometimes rain may say Yes or No - this is fixed in the next release as 1 or 0 across all ways to show rain,. In web_server.cpp, line 1266 there is this
void WEB_SERVER::handler_raining() {
send_xhtml((raining) ? T_YES : T_NO);
}
which now looks like
void WEB_SERVER::handler_raining() {
send_xhtml(string(raining));
}
See next message re Rainfall
Regards
Robert
The tip bucket RAINBUCKET_80422 generates Rainfall, current hour, etc with measurements over 120s (international standard).
On the web page rainfall shows as
Rainfall current hour 0.00
Rainfall current day 0.00
using /rain gives
{ "raining":1,"rvout":0.00,"raincurrhr":0.00,"rainprevhr":0.00,"raincurrday":0.00,"rainprevday":0.00 }
/rh rain current hour
/ry rain current day
Any change in rainfall is a running average over the last/current 120s cycle. using a set command I can set the current hour rainfall
192.168.2.128/set?raincurrhr=2.1
results in (using /rain)
{ "raining":0,"rvout":0.00,"raincurrhr":2.10,"rainprevhr":0.00,"raincurrday":0.00,"rainprevday":0.00 }
which shows up in mqtt publish messages and in the Windows app
So all the surrounding code is fine, BUT since "generation" of the rainfall value looks like something is wrong. I did the above to show that the problem for rainfall is in the generation of the value.
I have looked over the rain bucket code for a few hours today - and there are some things that may contribute to your issue, which I am recoding now.
I think I have made progress. Please send me an email to my g mail address - see PDF
Regards
Robert
Yeah that is not a problem, the rain sensor was disconnected while I was testing the bucket, so we can ignore the values for now.
In your example it too differs the values from the web server and windows app from the "internal" log.
You said
Not sure I follow you? I can't see it
regards
Robert