Pages: [1]   Go Down
Author Topic: Rain measurement in 24 hours  (Read 1807 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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");
}
}
« Last Edit: October 09, 2010, 09:43:24 am by hard2tell » Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 631
Posts: 50064
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 39
Posts: 4382
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


Logged

Nova Scotia, CA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 64
A world that runs on bits and bytes!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: January 09, 2011, 10:54:05 pm by LAVco » Logged

Common sense is not so common...

Pages: [1]   Go Up
Jump to: