RAK1902 Pressure causing phantom interrupt

I have added a RAK1902 sensor and inserted sketch requriements into existing sketch. Once this was uploaded to board (4631), the rainfall incremented by one count every time. I then added it to a simple sketch just to test the interrupt (raincounter). Same problem. If I comment out the 1902 requirements, it works perfectly, and when I add it in, the counter increments by one every time. Any thoughts as to why this is happening?

Here is the sketch…

#define rainPin WB_IO1
int rain = 0;

//Barometric Pressure
#include <Adafruit_LPS2X.h>
#include <Adafruit_Sensor.h> // Click here to get the library: http://librarymanager/All#Adafruit_LPS2X
Adafruit_LPS22 g_lps22hb;

void setup() {


//*****Barometric Pressure*****

if (!g_lps22hb.begin_I2C(0x5c))
Serial.println(“Failed to find LPS22 chip”);
while (1)


void loop()
Serial.print("Rain = ");Serial.println(rain);

//Barometric Pressure******************************************************************
sensors_event_t tempbox;
sensors_event_t pressure;
g_lps22hb.getEvent(&pressure, &tempbox);
Serial.print(“Temperature: “);Serial.print(tempbox.temperature);Serial.println(” degrees C”);
Serial.print(“Pressure: “);Serial.print(pressure.pressure);Serial.println(” hPa”);

void raincounter() {
//Debounce switch
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
// If interrupts come faster than 200ms, assume it’s a bounce and ignore
if (interrupt_time - last_interrupt_time > 200)
rain = rain + 1;
last_interrupt_time = interrupt_time;

And here is the screenshot of the serial…

Regards, Andrew.

Hello Andy,
The rain sensor (RAK12005/RAK12030) is using WB_IO6, not WB_IO1

If you have the RAK1902 in Slot A, you are reading interrupts from the barometric pressure sensor, not from the rain sensor.

Hi @beegee, I’m not using a Wisblock rain sensor, I’m using a Davis weather station rain counter connected to WB_I01, and that’s the one counting by 1 each time.

In which slot is the barometer RAK1902?

Slot A. Happy to try another if that helps?

Please try another slot.
RAK1902 has an interrupt output connected to WB_IO1 and that interferes with the input from your rain sensor.
Slot A uses WB_IO1 and WB_IO2
Slot B uses WB_IO2 and WB_IO1
Slot C uses WB_IO3 and WB_IO4
Slot D uses WB_IO5 and WB_IO6

I propose to use Slot C or Slot D

Ahhhh, ok, that makes a lot of sense. Thanks for the help @beegee …yet again…

Just as a follow up @beegee, If I put a RAK1906 BME680 on Slot C, that will still only use WB_I03 and WB_I04? Or do different sensors use potentially more…? I assume not as they are I2C, but just want to clarify.

Hi @Andy
The sensor slots have only 2 IO’s, as I listed above. So in Slot C it will occupy only WB_IO3 or WB_IO4.

We are working on a web based IO Mapper, that can show which sensor will occupy which IO’s, but that is unfortunately not ready yet.

Excellent, thanks for the clarification @beegee