Source: https://mokxi.com/parts/rain
Updated: 2026-11-10

Part

# Rain sensor

A plate of interleaved traces. Rain on it and AO falls; past the trimmer DO goes low.

See every part

- 4 pins
- 1 setting
- In 2 projects
- In 2 lessons

Drawn live by the editor's own code, at the size you see it.

At a glance

## The Rain sensor in brief

What it is, and every setting the properties panel gives it.

The rain sensor is the FC-37 or YL-83 kit: a plate of interleaved traces wired to a small LM393 comparator board with a blue trimmer. The board’s pins are VCC, GND, DO and AO, at 3.3 to 5 volts. On an Uno, VCC goes to 5 V, AO to an analog pin and DO to any digital pin; on an ESP32, power it from 3.3 V so AO and the DO pull-up stay inside what its pins take. The plate sits under a 10 k pull-up, so dry reads the full supply and wet reads lower, and DO pulls low and lights its lamp when AO falls under the trimmer, the threshold property, half the supply by default. As the slider goes from dry to 100 percent wet, Mokxi takes the plate from open circuit to 5 k x (100 / w)^1.2, which on a 5 V Uno reads 1023 dry, the high hundreds with a few drops and the low three hundreds soaked. The classic mistake is powering it all the time; feed VCC from a pin only while reading. Corrosion, drying time and how salty the water is are not modeled.

Family

Sensors

Pins

4

threshold

0.5

Pins

## 4 pins

Named as the editor names them, so a wire lands where you expect it.

Pin

Role

What it does

VCC

Input or output

Supply, 3.3 V to 5 V.

GND

Input or output

Ground.

DO

Output

Low when the plate is wet enough. Open collector with a 10 k pull-up.

AO

Output

The plate under its pull-up: lower means wetter.

How to use it

## How to use a rain sensor module with an Arduino

The plate wires to the little comparator board, and the board’s four pins go to the Uno: VCC to 5 V, GND to GND, AO to an analog pin and DO to a digital pin. In the plant monitor, AO is on A1 and DO on pin 7, beside a soil sensor and a water level sensor.

analogRead(A1) gives 1023 dry and falls as the plate gets wetter, so lower means more rain. DO is the board’s own answer, low when AO drops under the blue trimmer, so digitalRead(7) == LOW is a plain “it is raining” with no arithmetic. The plant monitor lights its lamp only when the soil is dry and it is not raining.

A real plate powered all the time corrodes in weeks. Feed VCC from a digital pin, set it HIGH, wait a few milliseconds, read, and set it LOW again; an unpowered board drives nothing here either, so the same sketch runs in the simulator.

Part pin

Board pin

VCC

5 V

GND

GND

DO

Pin 7

AO

A1

On an ESP32, power the board from 3.3 V: AO then tops out at 3.3 V and DO’s 10 k pull-up goes to 3.3 V, both safe for its pins.

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

Both outputs of a rain sensor

How it is modeled

## What is true about the Rain sensor, here

In its help article’s own words: what the simulation gets right, and where it stops.

### Modeled

The plate's resistance falls as a power of how wet it is, 5 k x (100 / w)^1.2, and
it is open when dry. On a 5 V Arduino that reads 1023 dry, the high hundreds with a few
drops, the middle in a good shower and the low three hundreds soaked, which is what
people see. An unpowered board drives nothing at all, which matters because of the
advice below.

### Not modeled

That curve is a shape, not a measurement: what a wet plate reads depends on how much
salt is in the water as much as on how much water there is, and rain, tap water and a
finger read nothing like one another. The plate corroding is not modeled: a DC current
through wet traces is electrolysis, and a real plate powered all the time corrodes in
weeks. Nor is how long the water takes to dry off, which is what makes a real one slow
to say the rain has stopped. The comparator has no hysteresis, as on the real board.

From Rain sensor, in full.

Projects

## See the Rain sensor in a project

2 built-in projects use it. Each opens in the editor, already wired.

Lessons

## Where it turns up in a lesson

2 lessons place it in their own circuits.

### Learn articles

2 lessons

- Arduino Soil Moisture Sensor: Code and Wiring
- Arduino Rain Sensor: Wiring, Code and Readings

Boards

## The boards it is shown on

This board has a built-in project with the Rain sensor in it.

- Arduino Uno R3

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## Wire up the Rain sensor

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building free Open the editor
