Go Down

Topic: Rain measurement in 24 hours (Read 1 time) previous topic - next topic

hard2tell

Oct 09, 2010, 04:41 pm Last Edit: Oct 09, 2010, 04:43 pm by hard2tell Reason: 1
Hi All
I am a newb programmer working on a weather station. The only sensor I cant configure is the rain gauge which is a tipping bucket that generates digital interrupts. I can record them and the time between them but what I want is a way to see the rainfall in the last 24 hours.  I guess I need some kind of circular array but I cant find examples that will compile.
I'd love to see a complete example.

This is what I have so far.
Any help would be appreciated ;D
thanks

int pulsePin =3;
unsigned long counter = 0;
unsigned long duration = 0;
unsigned long timeout = 1000000; // in microseconds

void setup() {
 pinMode(pulsePin, INPUT);
 // enable the 20K pull-up resistor to steer
 // the input pin to a HIGH reading.
 digitalWrite(pulsePin, HIGH);
 Serial.begin(9600);

}

void loop() {
 duration = pulseIn(pulsePin, HIGH, timeout);
 if (duration == 0) {
   Serial.print("Pulse started before the timeout.");
   Serial.println("");
 } else {
   counter++;
   //Serial.print(counter);
  // Serial.print(", ");
   Serial.print(duration*.000001);
   Serial.println(" s");
   //Serial.println("");
   Serial.print (counter*.2794);
   Serial.println(" mm");
}
}

PaulS

Quote
The only sensor I cant configure is the rain gauge which is a tipping bucket that generates digital interrupts.

OK.

Quote
I can record them and the time between them but what I want is a way to see the rainfall in the last 24 hours.


Quote
This is what I have so far.

Where is the code for handling the interrupt? I don't see an interrupt handler being registered, or any code for recording when the interrupt occurred.

Do you have a link to the rain gauge sensor?

floresta

The rain gauge should be the simplest weather device to implement since all you have to do is count pulses.

Each pulse represents a certain amount of rain so each time a pulse occurs you have accumulated that much more rain.  Count the pulses for any amount of time and you have the total rainfall for that time period.

The time between pulses will indicate the rate of fall of the rain which might also be of interest.

Don

Techguru

Hard2tell, where are you on implementing your rain gauge?  I have been working on this for some time now and there is far more to it than just counting pulses. Perhaps we can start a dialog that will be helpful to others who are considering a project like this.



LAVco

#4
Jan 10, 2011, 04:47 am Last Edit: Jan 10, 2011, 04:54 am by LAVco Reason: 1
Quote
I have been working on this for some time now and there is far more to it than just counting pulses.


There isn't much more to it.  The one item that was left out is knowing the tipping bucket's capacity and using de-bounce code (search for it because a library already exists) to count pulses.  Place a resistor across your wires going to the relay (switch being closed after a tip which is counted).  24 Hr precipitation is a totalization over a 24hr period (reset at 00:00 UTC) and is commonly derived by precipitation rate e.g. mm/hr.

The best place to find the information on meteorological applications is via WMO Vol 8 (global standard except US) or NWS for US.
Common sense is not so common...

Go Up