environmental
Interfacing Rain Sensor with Arduino Uno
What is the Rain Sensor?
Rain Sensor practical reference
A conductive-trace PCB that detects rainfall or spilled liquid, commonly paired with servo-driven window/roof closers in weather projects. The sensing board is a grid of exposed parallel copper traces whose resistance drops sharply when bridged by water droplets, and a companion driver board (usually built around an LM393 comparator) converts that resistance change into both a digital threshold output and a proportional analog signal — a simple, low-cost way to detect the presence and rough intensity of rain or spilled liquid.
Key specifications
- Sensor type: Conductive-trace rain/moisture sensing PCB with LM393 comparator driver board
- Operating voltage: 3.3V–5V DC
- Operating current: ~15-20 mA typical
- Digital output (DO): Goes LOW when water bridges enough traces to cross the threshold set by the onboard potentiometer (HIGH when dry, on most boards)
- Analog output (AO): Continuous voltage proportional to how much of the sensing grid is wetted — lower resistance (more water) gives a lower/higher voltage depending on wiring convention
- Sensitivity adjustment: Onboard trimmer potentiometer sets the digital-output trigger threshold
- Interface: 1 digital pin (threshold trigger) + 1 analog pin (intensity reading)
- Durability note: Exposed copper traces will oxidize/corrode with repeated wetting over time — treat as a low-cost, semi-consumable sensor rather than a permanent outdoor fixture
Pinout and connection notes
Mount the sensing board at a slight tilt so water can run off rather than pool on the traces, which extends its usable life and reduces false lingering triggers after rain has stopped. Because the exposed copper traces corrode over repeated exposure to water, expect to eventually replace the sensing board itself in long-term outdoor installations, even though the separate driver board typically remains fine.
- VCC: Power, 3.3–5V DC
- GND: Ground
- DO: Digital output — threshold-triggered rain/no-rain signal
- AO: Analog output — proportional to how wet the sensing grid is
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up Rain Sensor with Arduino Uno
Library
None — built-in analogRead/digitalRead by —
No library needed; uses core Arduino functions only.
Wiring
| Component pin | Arduino Uno pin | Note |
|---|---|---|
| VCC | 5V | |
| GND | GND | |
| AO | A0 | Lower value = more water on the plate. |
| DO | D2 | Digital trip point, set by onboard potentiometer. |
Swipe sideways to see every column →
- The exposed copper traces on the sensing plate corrode over time — fine for demos and short-term projects, not a durable outdoor install without conformal coating.
- Lower AO values mean more water bridging the traces; a dry board reads close to the max (1023).
Related Components
A3144
Digital Hall-effect switch for contactless magnetic detection
ACS712
Measure AC or DC current with an analog Hall-effect sensor
ADXL345
Low-power 3-axis accelerometer with tap/double-tap and freefall detection for wearables.
AHT10
A tiny I2C sensor that packs temperature and humidity sensing into the smallest footprint possible.
Related Guides & Projects
Arduino Uno R4 Minima Pinout: Every GPIO, ADC, DAC, and Op-Amp Pin Explained
A complete Arduino Uno R4 Minima pinout reference — digital I/O, ADC, DAC, op-amp, CAN, dual UART, and exactly what it leaves out compared to the WiFi variant.
Mastering PWM on Arduino: Dimming LEDs and Controlling Motors
Understand what PWM actually is on Arduino, dim an LED smoothly, and safely control a DC motor's speed with a driver chip -- plus the mistakes (like wiring a motor straight to a pin) that damage boards.
4-Digit 7-Segment Counter with TM1637 & Arduino
Drive a TM1637-based 4-digit 7-segment display with Arduino Uno to show a real-time up/down counter, elapsed timer, and scrolling text. Covers library setup, brightness control, and custom segment mapping.
Arduino Uno R4 Minima vs WiFi: Which One Should You Choose?
Same processor, same memory, different price. Here's what the WiFi variant's extra hardware actually gets you, and when the Minima is the smarter buy.