hydreon rain gauge coding issue
Hi paul,
im currently connect my teensy board(2++) to my rain gauge (hydreon) and there's no output(serial monitor) for my arduino 1.8.5 whenever the hydreon (tipping bucket mode) activated.
im unsure whether this is correct cause im following this website (
http://cactus.io/hookups/weather/rain/hydreon/hookup-arduino-to-hydreon-rg-11-rain-sensor) and i need help in term of the pin/coding whether it's correct ornt.
my pin is connect to f7 on the teensy board 2++
this is my coding
#define BOARD "Teensy++ 2.0"
#define RG11_Pin 45
#define Bucket_Size 0.01
volatile unsigned long tipCount; // bucket tip counter used in interrupt routine
volatile unsigned long ContactTime; // Timer to manage any contact bounce in interrupt routine
long lastCount;
float totalRainfall;
float AverageperTime;
void setup() {
lastCount = 0;
tipCount = 0;
totalRainfall = 0;
AverageperTime = 0;
Serial.begin(1200);
Serial.println("Hydreon RG-11 Rain Sensor");
Serial.print("Bucket Size: "); Serial.print(Bucket_Size); Serial.println(" mm");
pinMode(RG11_Pin, INPUT); // set the digital input pin to input for the RG-11 Sensor
// attach interrupt handler to input pin.
// we trigger the interrupt on the voltage falling from 5V to GND
sei(); //Enables interrupts
}
void loop() {
// we only display the tip count when it has been incremented by the sensor
cli(); //Disable interrupts
if(tipCount != lastCount) {
lastCount = tipCount;
totalRainfall = tipCount * Bucket_Size;
AverageperTime = totalRainfall / tipCount; //This is the code i wrote
Serial.print("Tip Count: ");
Serial.print(tipCount);
Serial.print("\tTotal Rainfall: ");
Serial.println(totalRainfall);Serial.println("mm/hr");Serial.println(AverageperTime); //Test it out see whether can work
}
sei(); //Enables interrupts
}
// Interrrupt handler routine that is triggered when the rg-11 detects rain
void rgisr () {
if ((millis() - ContactTime) > 15 ) { // debounce of sensor signal
tipCount++;
ContactTime = millis();
}
}
// end of rg-11 rain detection interrupt handler
Thank you!