I need to count the pulses of a rain gauge I recently bought on AliExpress. It has a cable with two wires on it, and it short-circuits them for a few tens of ms when the pan inside it fills with water and tilts to the other side. Each such pulse represents some constant level of rain in mm, so I want to count them.
I placed the rain gauge on the roof and extended its cable to about 6 metres, connecting it in the middle of its length and sealing it with heat shrink tubing with glue inside. I connected the wires to the NodeMCU board with the ESP8266 inside - one to GND and the other to GPIO14. I set this input to pullup mode so that the pulse is counted every time it is shorted to GND.
Everything works when the rain starts. However, after it rains for a while (tens of minutes, maybe over an hour), the circuit starts generating these pulses like crazy. I noticed that when I cut the cable and leave it like that in the rain (because I already suspected water getting under the heat shrink and wanted to improve the bonding), after a while this effect starts again very clearly. So I rather rule out false pulse generation by the rain gauge (unless it itself has poor insulation somewhere). In any case, it is encapsulated in such a way that no water can get into the PCB it has inside.
I would like advice on how to approach the subject. Am I guessing correctly that by some miracle (I don't know enough), some micro current is able to get through the insulation somewhere and cause a false grounding (or whatever you want to call it) that generates these pulses for me?
Alternatively, what I am testing now is to switch the input to pulldown mode and generate a positive pulse. For now I am verifying that this will work, but I would like to ask you if my suspicion, for this initial configuration, is correct. The same happens on other GPIOs I have tested, including on a board with ESP32.
Thanks!