Rain Gauge (SENS-15901) connected to Photon Weather Shield (DEV-13674) registers false interrupts

I am trying to figure out how to prevent registering false interrupts for a tipping rain gauge.

I have a weather meter kit (SENS-15901) connected to a Photon Weather Shield (DEV-13674) with a Particle Photon plugged in. The tipping bucket rain gauge registers an interrupt call every so often. The data is sent through a Particle webhook every 5 minutes to Influxdb. Below shows a 12 hour window of readings received every 5 minutes from influxdb. The large spike at 11:30 can be ignored as that was manual input while removing the reed switch. However, the small, random inputs you see are false triggers. The device is setup on a tripod under a patio cover and no possible rain or moisture going into the rain bucket during the 12 hour window. The readings after the large spike were with the reed switch removed from the case and placed on the support arm to ensure the magnet wasn’t somehow triggering the switch.

I have had the same results using a Particle Boron in place of the Photon (with an adapter plate to match Photon pinout). Once deployed I plan to use the Boron, but to save LTE data for development I’m using the Photon. The weather station is in central California where rain fall is infrequent and most often at a slow precipitation rate. Getting this to register correctly is important as it may not be uncommon to only have 0.011 inch of rainfall in a 5 minute period during a normal light rain event.

Here is the code that reads the Rain pin interrupt:

//===========================================================================
// Rain Gauge
//===========================================================================
int RainPin = D2;
volatile unsigned int rainEventCount;
unsigned int lastRainEvent;
float RainScaleInches = 0.011; // Each pulse is .011 inches of rain

void initializeRainGauge() {
  pinMode(RainPin, INPUT_PULLUP);
  rainEventCount = 0;
  lastRainEvent = 0;
  attachInterrupt(RainPin, handleRainEvent, FALLING);
  return;
  }
  
void handleRainEvent() {
    // Count rain gauge bucket tips as they occur
    // Activated by the magnet and reed switch in the rain gauge, attached to input D2
    unsigned int timeRainEvent = millis(); // grab current time
    
    // ignore switch-bounce glitches less than 10mS after initial edge
    if(timeRainEvent - lastRainEvent < 10) {
      return;
    }
    
    rainEventCount++; //Increase this interval's amount of rain
    lastRainEvent = timeRainEvent; // set up for next event
}

float getAndResetRainInches()
{
    float result = RainScaleInches * float(rainEventCount);
    rainEventCount = 0;
    return result;
}

Is there a way to fix this in software or do I need to create a hardware solution to debounce or filter out the noisy reed switch?

UPDATE: Previously I had tried a couple of different power supplies. After reading on an Arduino forum about a similar issue with false interrupts on an Argent rain gauge they noted that the issue wasn’t present with battery power. I powered the Photon from a 5V 8,000mAh USB power bank for the last 10+ hours and it hasn’t had any false triggers. This at least gives me a clue that it may be due to an unstable 3.3v or GND causing pin D2 to “see” a falling edge when there isn’t one. I thought about trying the Weather Shield’s onboard regulator, but that won’t work for running it with the Boron because of the 150ma current limit. But I could try it for the Photon just to see if the design of the LDO with the caps on the output cleans up the power/GND enough to prevent the false trips. I am open to any other suggestions on how to alleviate this issue. I’m somewhat of a newbie to electronics and definitely don’t understand all the nuances of clean power supply.

Below is an updated graph showing the difference between running on a CanaKit (Model DCAR-052A5) 5V 2.5A micro-usb power supply and the USB battery bank. In both cases the USB cable is plugged into the Photon and using its power regulator and not the Weather Shield regulator.

I’m having the same issue. Did you ever find a way to power this correctly without a battery.

Thanks!