Rain Gauge creates stupid values

Hi all,

I bought a simple rain gaguge at AliExpress which most of you probably already know:
https://de.aliexpress.com/item/1000001838878.html

I have connected the device (green) to GPIO35 of my ESP32 and (red) to GND.
For configuration I have used exactly the code like provided in the other

I’ve also tried to use a sum up function like described here:

Especially the sum up function shows a linear rising value oder the day with values which would cause me to buy a boat rather than a Christmas tree…

It seems that the sensor always report similar values. The following values are recorded with the code from the first link here from the forum:
device/sensor/rainfall/state 1101.73
device/sensor/rainfall/state 1101.73
device/sensor/rainfall/state 1101.37
device/sensor/rainfall/state 1101.00
device/sensor/rainfall/state 1101.37

Any idea which can cause such issues?

I think what’s happening here is that the pin you chose does not actually have an internal pull-up resistor, but a pull-up resistor is crucial for this wiring to work. So, either use a different pin, or add an external pull-up resistor (see here for suitable pins: ESP32 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials).

2 Likes

That should generate a visible error in ESPHome too.

Untitled

Thank you very much for your hints. I have attached a 4,7K pullup and so war it did not rain and the value is 0.0.
I’m wondering on one thing: I have the same setup for a wind speed pulse input on GPIO34. There I did not see any issue (yet) …

Hi all
I attached a 4.7K resistor to my GPIO to pullup because i think de GPIO32 input pull up is too high…

I have always glitch on input (counter) when switching on/off light as 230V… near the ESP32. I have 20m of cables with the 230V line for light and the POE line which power my ESP32.
Note the source alim in the main panel are not on the same fuse…

At each power on / off I have an impulse which increment my counter which is 0.2mm of raining… When light switch on/off 10x a night, the rain counter is very bad…

Do I have to add a capacitor to ground on the GPIO input ?

Regards

No, you have to resolve that low pulse at boot.
What board/Gpio you are using?

Or put a code to reduce count by 1 when it reboots
on_boot:

Hi
No my problem is not at ESP32 boot !
My glitch’s are present at each switch on/off the light on the 230V line where the cable is near my ethernet POE line…
I’m using an ESP32 dev board
https://www.amazon.fr/AZDelivery-Development-successeur-Compatible-incluant/dp/B071P98VTG?source=ps-sl-shoppingads-lpcontext&ref_=fplfs&smid=A1X7QLRQH87QA3&th=1

and my rain gauge is connected directly on the pin with this type of cables

I think my problems is induce current. My ESP is powered with POE to USB converter.

I have made a “cable”’ which add serial resistor to rain gauge, 4,7K pullup and 100nF + 1uF to GND without success for these glitches

I’m also finding on the net a PCB for this devcard for weather station I didn’t find.
I have just need RJ11 connector for Davis wind sensor and rain gauge…

Sorry for that!
Did you try filtering in your code

    filters:
      - delayed_on: 1ms

So wiring between sensor and Esp is only 20cm with jumper cable?

Those wires are for prototyping or making temporary circuits on a breadboard… Those things arent for permanent installation in walls or directly next to 220v AC mains.

When you switch the mains light switch, it causes glitches with your sensor reading? Ya, no kidding! Its just like sticking a high power magnet against a TV screen and it distorts the picture. Thats exactly whats happening to your rain sensor.

This is why you never see mains AC wires in the same wall space or same conduit pipe with any DC wires or especially any dc wires that carry data/communication.

You need to physically separate the wires if possible and if you cant, then you need to separate them as fsr as possible and you can try switching to a shielded wire. You may even be able to use foil or something similar to make your own shielding between the sensor and AC wires.

Whatever you do, atleast take those dang breadboard wires off and never use them again for a permanent project! Those things a garbage and very unreliable.

So OK but what is the solution. Create a proper PCB ?
RC Filter will be close to CPU, ok for this but the wire between rain gauge and PCB is about 15m. It’s an original cable of Davis Instrument.
So their weather station seams with no issues ?