   }
 }
 
-// when rain gauge is triggered
+// When rain gauge is triggered
+// This also checks for and rules out strange static flip readings
 void rainInterrupt() {
-  if (millis() - rainDebounce > RAIN_DEBOUNCE_TIME) { // if we're not within the debounce time
-    Serial.println(TEXT_RAIN_FLIP);     // then output that we flipped.
-    rainDebounce = millis();            // update the last debounce time
+  int triggers = 0;
+  for (int i=0;i<10;i++) {
+    if (digitalRead(RAIN_PIN) == 0)
+      triggers++;
+    delay(10);
+  }
+
+  //Only consider it as tripped if at least 90% of the 100ms after trip is also tripped
+  if (triggers > 8) {
+    if (millis() - rainDebounce > RAIN_DEBOUNCE_TIME) { // if we're not within the debounce time
+      Serial.println(TEXT_RAIN_FLIP);     // then output that we flipped.
+      rainDebounce = millis();            // update the last debounce time
+    }
   }
 }
 

  }
}

// when wind gauge is triggered
void windInterrupt() {
  if (micros() - windDebounce > WIND_DEBOUNCE_TIME) { // if we're not within the debounce time
    half_revolutions++;              // increment the half revolutions


DHT dht(TEMP_PIN_1, TEMP_PIN_1_TYPE);    // Declare the DHT sensor

// Setup code, runs once upon boot:
void setup() {
  pinMode(LED_PIN, OUTPUT);        // set led pin as output
  pinMode(WIND_PIN, INPUT_PULLUP); // enable pullup for wind sensor
