Component guide · Beginner · 3 min read
Rain and Water Level Sensor Modules
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
A rain sensor module is a board of exposed interleaved traces plus a small LM393 comparator board. Water on the traces lowers the resistance, so the analog output changes and the digital output goes LOW past a threshold set by a trimmer. Water level strips work the same way in a tank. Power them only while reading, because constant current corrodes the traces. For reliable tank levels, use a float switch.
Key specs at a glance
- Supply
- 3.3 to 5 V
- Outputs
- AO (analog) and DO (digital, LOW when wet)
- Comparator
- LM393 with a sensitivity trimmer
- Sensing pad
- Exposed nickel-plated or tinned traces
- Response
- Detects water, not rainfall amount
- Lifespan
- Short if powered continuously (electrolytic corrosion)
How it works and wiring
Connect the pad to the comparator board with the two-pin lead. On the comparator board, VCC goes to 3.3 V or 5 V, GND to GND, AO to an analog pin and DO to a digital pin. A dry pad reads high on AO (near VCC) and DO is HIGH; as drops bridge the traces, AO falls and DO switches LOW once it crosses the trimmer setting. The on-board LED shows the DO state, which helps when setting the threshold.
Use AO for "how wet" and DO for a simple "is it raining" alarm or a wake-up interrupt.
Stop the traces corroding
DC current through water slowly eats the traces, and after a few weeks outdoors readings drift or stop. Power the module from a GPIO pin instead of the 5 V rail: set the pin HIGH, wait about 10 ms, read, then set it LOW. Reading once every few minutes extends life greatly. Tilt the pad so water runs off, and dry readings return quickly. Capacitive sensors with no exposed metal last far longer; see the soil moisture guide for the same idea.
Water level in tanks
The cheap "water sensor" strip with S, + and − pins gives an analog reading that rises as more of the strip is wet, but it is only a few centimetres long and corrodes like the rain pad. For a real tank, use: - Float switches for reliable full or empty points, ideal for switching a pump. - Waterproof ultrasonic sensors such as the JSN-SR04T, mounted above the water, for continuous level. - Pressure sensors at the bottom of deep tanks.
Try it: Voltage divider calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Powering the pad continuously so it corrodes.
- Laying the pad flat so water pools and it never dries.
- Expecting a rainfall amount; use a tipping-bucket gauge for that.
- Leaving the comparator board exposed to rain.
- Using a short water strip to measure a deep tank.
Frequently asked questions
Why does my rain sensor stop working after a few weeks?
Constant DC current corrodes the traces. Power it from a GPIO pin only while taking a reading.
What does the potentiometer on the rain sensor do?
It sets the threshold where the digital output switches from HIGH (dry) to LOW (wet).
Can a rain sensor measure how much rain fell?
No. It detects wetness. Use a tipping-bucket rain gauge to measure rainfall in millimetres.
Does it work with ESP32?
Yes. Power it at 3.3 V so the analog output stays within the ESP32's input range.
What is the best sensor for a water tank?
A float switch for on/off points, or a waterproof ultrasonic sensor for a continuous level reading.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 40 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.


